Python Forum
Print random musik to wav file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Print random musik to wav file
#1
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.
Reply
#2
Not sure, but perhaps one of these: https://pypi.org/search/?q=music+random
Reply
#3
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".
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python logging RotatingFileHandler writes to random file after the first log rotation rawatg 0 341 Feb-15-2024, 11:15 AM
Last Post: rawatg
  Saving the print result in a text file Calli 8 1,700 Sep-25-2022, 06:38 PM
Last Post: snippsat
  failing to print not matched lines from second file tester_V 14 5,946 Apr-05-2022, 11:56 AM
Last Post: codinglearner
  Print to a New Line when Appending File DaveG 0 1,189 Mar-30-2022, 04:14 AM
Last Post: DaveG
Sad Want to Save Print output in csv file Rasedul 5 10,688 Jan-11-2022, 07:04 PM
Last Post: snippsat
  Convert legacy print file to XLSX file davidm 1 1,768 Oct-17-2021, 05:08 AM
Last Post: davidm
  Why it does not print(file.read()) Rejaul84 1 2,309 Jul-01-2021, 10:37 PM
Last Post: bowlofred
  Random pictures from a file aliwien 2 4,279 Apr-23-2021, 06:00 PM
Last Post: snippsat
  get two characters, count and print from a .txt file Pleiades 9 3,291 Oct-05-2020, 09:22 AM
Last Post: perfringo
  Cannot redirect print to a file tester_V 3 2,454 Sep-11-2020, 12:21 AM
Last Post: tester_V

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020