pianoplayer icon indicating copy to clipboard operation
pianoplayer copied to clipboard

Using pianoplayer inside Jupyter notebooks

Open psychemedia opened this issue 6 years ago • 5 comments

Have you looked at integrating pianoplayer with Jupyter notebooks?

I have a demo repository here which includes requirements to run the repo interactively on MyBinder.

To display the score should be simple if, if there's a pianoplayer function available that returns the score as a PNG or SVG image file.

psychemedia avatar Jan 19 '19 17:01 psychemedia

This is going to be the efficient way for researches and education in musical field.

mhoangvslev avatar Jan 19 '19 18:01 mhoangvslev

Unfortunately I'm not very familiar with jupiter notebooks.. at the moment the program writes to output a music21 stream.

marcomusy avatar Jan 20 '19 20:01 marcomusy

The tool can be used from any python code (including jupyter notebooks) by instantiating a Hand object, setting the parameters, and then calling the generate method of Hand objects. The python code in bin/pianoplayer (after line 118) can give a good indication on how to do so.

The finger labels are written to a music21 stream (the one passed as an argument to the reader function that's used to instantiate the noteseq attribute of the Hand instance), so by using the .show method of music21 streams, you can generate several formats to see the labelled score.

Alia-morsi avatar May 06 '20 21:05 Alia-morsi

Thanks Alia for your comments, lately i've been quite busy and could not dedicate time to this project.. if you have some working notebook it would be great to add it as an example of usage!

marcomusy avatar May 06 '20 22:05 marcomusy

Ok i'll let you know when I have one ready :))

Alia-morsi avatar May 06 '20 22:05 Alia-morsi