Coder Social home page Coder Social logo

andreamust / biab-library Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 96 KB

Python library for opening and managing Band-in-a-Box (BIAB) files.

License: Other

Python 8.12% C++ 91.88%
computational-musicology computer-music mir music-information-retrieval band-in-a-box biab

biab-library's Introduction

BIAB Library

A pybind11 module built with a CMake-based build system for converting Band-in-a-Box files.

The C++ source code has been provided by Andrew Choi, to whom all credits must be given.

Installation

Installation via pip

You can install the library using pip, by running the command:

pip install biab-library

You can also find the PyPi documentation at this link.

Local installation

For installing the library locally, you can follow these steps:

  • clone this repository running git clone https://github.com/andreamust/biab-library.git
  • run pip install ./biab-library

Usage

The library implements three different methods for accessing the data stored in the Band-in-a-Box files.

The methods are as follows:

  • biab_data: given a Band-in-a-Box file path, it returns all the data stored in the file;
  • biab_meta: given a Band-in-a-Box file path, it returns the file metadata;
  • biab_chords: given a Band-in-a-Box file path, it returns all the chords contained in the file.

All the methods aforementioned can be called as follows:

import biab

biab_path = "path/to/biabfile"

biab_data = biab.biab_data(biab_path)
biab_meta = biab.biab_meta(biab_path)
biab_chords = biab.biab_chords(biab_path)

Output

The output of the biab_meta() method consists of a list containing the following elements:

[Track Title, Metre numerator, Metre denominator, Key, Tempo]

The output of the biab_chords() method consists of a list of lists, each of which containing the following elements:

[Chord starting time, Chord duration, Chord value]

The output of the biab_data() method consists of a tuple which is the combination of the biab_meta() and the biab_chords() outputs.

Below, you can find an example of a biab_data() method call:

(['April In Paris', '4', '4', 'C', '130'], 
    [
        ['0', '4', 'F:min'], 
        ['4', '4', 'C:maj7'], 
        ['8', '4', 'D:(b3,b5,b7)'], 
        ['12', '4', 'G:(3,5,b7)'], 
        ['16', '8', 'C:maj7'], 
        ['24', '4', 'G:min(b7)'], 
        ['28', '4', 'C:(3,5,b7)'], 
        ['32', '4', 'F:maj7'], 
        ['36', '4', 'F:maj7'], 
        ['40', '2', 'B:(b3,b5,b7)'], 
        ['42', '2', 'E:(3,5,b7)'], 
        ['44', '2', 'A:min'], 
        ['46', '2', 'A:min/G'], 
        ['48', '4', 'F#:(b3,b5,b7)/D'], 
        ['52', '4', 'B:(3,5,b7,b9)'], 
        ['56', '2', 'B:min(b7)'], 
        ['58', '2', 'E:(3,5,b7)'], 
        ['60', '2', 'E:(b3,b5,b7)'], 
        ['62', '2', 'A:(3,5,b7,b9)'], 
        ['64', '2', 'D:min(b7)'], 
        ['66', '2', 'F:min'], 
        ['68', '2', 'C:maj/E'], 
        ['70', '2', 'Eb:dim'], 
        ['72', '2', 'D:(b3,b5,b7)'], 
        ['74', '2', 'F:min'], 
        ['76', '4', 'C:maj'], 
        ['80', '2', 'B:(b3,b5,b7)'], 
        ['82', '2', 'E:(3,5,b7)'], 
        ['84', '2', 'A:min'], 
        ['86', '2', 'A:min/G'], 
        ['88', '2', 'F#:(b3,b5,b7)/D'], 
        ['90', '2', 'B:(3,5,b7,b9)'], 
        ['92', '2', 'E:maj7'], 
        ['94', '1', 'D:min(b7)'], 
        ['95', '1', 'G:(3,5,b7,9)'], 
        ['96', '4', 'F:min'], 
        ['100', '4', 'C:maj7'], 
        ['104', '4', 'E:(b3,b5,b7)'], 
        ['108', '4', 'A:(3,#5,b7)'], 
        ['112', '4', 'D:(3,5,b7,9)'], 
        ['116', '2', 'D:(b3,b5,b7)'], 
        ['118', '2', 'G:(3,5,b7)'], 
        ['120', '4', 'C:maj']
    ]
)

Tests

TBD

Building the documentation

Documentation for the example project is generated using Sphinx. Sphinx has the ability to automatically inspect the signatures and documentation strings in the extension module to generate beautiful documentation in a variety formats. The following command generates HTML-based reference documentation; for other formats please refer to the Sphinx manual:

  • cd python_example/docs
  • make html

License

pybind11 is provided under a BSD-style license that can be found in the LICENSE file. By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.

biab-library's People

Contributors

andreamust avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

biab-library's Issues

Return converted bass

The chord returned by the parser are not expressed in a valid Harte syntax.
This is due to the fact that the bass is expressed as a note (e.g. "D") instead of a degree (e.g. "b3").

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.