Coder Social home page Coder Social logo

rhythm-generator's Introduction

Rhythm Generator

A simple rhythm score generator based on abjad package which uses lilypond.

Usage

To use a rhythm generator, just instantiate a RhythmGenerator object. If no settings are provided, default are being used.

from rhygen import RhythmGenerator
rhythm_generator = RhythmGenerator()

Calling a RhythmGenerator generates n groups of m measures with certain rhythm patterns. To save a score to an image, one can use an auxiliary function save_score:

from rhygen.misc import save_score

score = rhythm_generator()
save_score(score, 'score.png')

Use rhythm_generator.cache for raw strings of score.

Settings

Settings provides information about following elements:

  • groups โ€” number of different groups
  • measures โ€” number of measures
  • settings for each group (containing set of possible notes and phrases) via method set_group, including a default setting default_group_settings.

A GroupSettings object contains two fields:

  • notes a list of notes
  • phrases a list of phrases (i.e. list of notes)

rhygen can interpret a note in two ways:

  • as integer, its length is an inverse of provided value
  • a fraction, i.e. tuple of the form (numerator, denominator) of length numerator / denominator

For example 4 is the same as (1, 4) and corresponds to a quarter note. Dotted half-note is (3, 4). A phrase [4, 8, 8, 4] corresponds to a quarter note, two eighths notes and a quarter note.

Not every possible note is supported. For example, triplets (notes such as (1, 3)) are not supported yet.

rhythm-generator's People

Contributors

jakimpl avatar

Stargazers

Jorge Gomez avatar

Watchers

 avatar

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.