Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'live' score generation with m21j #80

Open
Kaamir opened this issue Jan 22, 2021 · 1 comment
Open

'live' score generation with m21j #80

Kaamir opened this issue Jan 22, 2021 · 1 comment

Comments

@Kaamir
Copy link

Kaamir commented Jan 22, 2021

Hello. I am currently involved in a project where we wish to produce ‘live’ music notation in the browser. The app will be a javascript program that composes music based on an algorithm. Our goal is that as the composition program is running, the music notation will generate note by note in the browser. And one of the reasons for this, is that we would like to eventually use it for live performance – music that is being generated right before the eyes of the person performing it and that can change compositional direction depending on various variables during the performance. 

However I’ve been having problems with music21j, and I’m no longer even sure if what we are attempting is even possible with the library. Here are our current biggest questions:

  • Do dynamics currently work with music21j? I can’t get them to render and I couldn’t find any examples of dynamics being used in the code from Github.

  • The generation of notes gradually gets slower and slower with every new note that is added to the piece (stream). I’m using ‘replaceDOM()’ after each beat or bar that has been composed. I assume that it gets slower and slower because it has to regenerate an ever growing svg file. What would be the best way to avoid this?

  • Is it possible to export an xml or midi file the way the python version does? Once a piece has been composed, we would love to save it somehow.

Many, many, thanks in advance!

@mscuthbert
Copy link
Member

Hi @Kaamir -- sorry to miss this. To answer your Q:

(1) Dynamics don't work using the expressions.dynamics module, but I believe it does work if you set .volume on the notes. (See music21-python's docs on how to do that)

(2) Are you creating one giant stream or using substreams (Measures, etc.)? With the latter I can get to hundreds--maybe 1000 notes with decent speed. The other approach is to try using the canvas backend, which is much less memory intensive, which is the big problem with SVGs.

(3) Exporting isn't yet supported natively in music21j,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants