1

Looking at 4-note polyphony, where notes are sampled audio (wav/mp3/ogg files). Is there some asynchronous audio library where I can tell the library to play an audio file (to completion, or a certain length), without blocking ? While the previous audio segment is still playing, I could invoke the library again to play another note, also without blocking. Thus I achieve polyphony, and can play upto 4-note chords ?

I am looking for an approach suitable for a very low end ARM9 (260MHz) + 64MB RAM type of device, running Linux. I am trying to keep the software as lean as possible, and thus cannot imagine putting a full-scale software synth on it. Also the user interaction of my simple 4-note polyphony, "poor-man's synth", needs to be programmatically achieved.

Only decent options I've found so far, seems to be SDL, but not clear how well it might fit my needs and meets the low-eright constraints.

Edit:

Found this SO Q&A but I am hoping that there is a more elegant solution, that has emerged in the 3 years since.

Community
  • 1
  • 1
bdutta74
  • 2,798
  • 3
  • 31
  • 54

1 Answers1

1

There is a list if Python sound/music libraries at https://wiki.python.org/moin/PythonInMusic; several of these appear to suit your needs (in the section Music programming in Python). Those with MIDI support may be particularly useful (there is also a section MIDI Mania), but others may also meet your needs.

Clifford
  • 88,407
  • 13
  • 85
  • 165
  • Thanks @Clifford. I had gone through the list and gone through documentation of many of the libraries. Unfortunately, so far I've not found a single one which allow playing sound files asynchronously, which in turn would permit polyphony. – bdutta74 Aug 02 '15 at 13:35
  • @icarus74 : MIDI is intrinsically capable of representing polyphonic music, so I would imagine that any library supporting MIDI must be able to do that. You might have to compose your sequence as MIDI data. Alternatively you might be able to use multiple threads to issue each note simultaneously. – Clifford Aug 02 '15 at 15:31
  • @icarus74 : It seems also that the libraries that use numpy may also meet your needs: http://stackoverflow.com/questions/11570942/how-to-translate-a-numpy-array-to-polyphonic-music. To use MIDI you can generate teh MIDI data using MidiUtil : http://stackoverflow.com/questions/13795959/making-midi-files-in-python-that-are-polyphonic-and-different-instruments. – Clifford Aug 02 '15 at 15:40