Python Forum
Print random musik to wav file - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Print random musik to wav file (/thread-17047.html)



Print random musik to wav file - Pereskia - Mar-26-2019

I need to generate a set of random music files in wav format. I need to save information about which notes I play and the duration it have in a separate file (this is not the problem).

The part I don't now how to do:
How do I easiest make a wav file with piano sounds from a list of notes and durations. The notes can be represented as midi note numbers (or other note numbering system). The duration has to be in seconds. It would be nice if different piano sounds can be used, but it need to be somewhat realistic piano sound.

Grateful for help, I have no idea of which library to use.


RE: Print random musik to wav file - Larz60+ - Mar-26-2019

Not sure, but perhaps one of these: https://pypi.org/search/?q=music+random


RE: Print random musik to wav file - Pereskia - Mar-27-2019

Thank you!

There is a library called music in that list which seems to do what I want (and a lot more). However, it needs some kind of additional software callet jythonMusic that I cant install.

I did a workaround now and created a midi file with library "midiutil". I then transform the midi file to a wav by running timidity synth using python library "subprocess".