soloud icon indicating copy to clipboard operation
soloud copied to clipboard

Support midi without external dependencies (portmidi / timidity)

Open fungos opened this issue 6 years ago • 3 comments

Expected behavior:

Be able to play a midi files as music stream in a simple API without requiring 3rd party dlls/libraries. A music.play("file.mid") API using a default (but with option to use a different) soundfont2 (sf2) file would be great to have.

https://github.com/schellingb/TinySoundFont is a very good candidate for this.

Actual behavior:

SoLoud is able to use portmidi to generate midi audio, but it does not seems to have support to playing .mid files via a WaveStream or a similar API.

fungos avatar Nov 19 '18 23:11 fungos

TinySoundFont has a too restrictive license for SoLoud; it requires attribution.

At the moment you can use libmodplug to play .mid files through SoLoud.

jarikomppa avatar Nov 20 '18 06:11 jarikomppa

Hi again! :)

I did implement MIDI support for my own use, but I'm having trouble with a noise that happens due to SAMPLE_GRANULARITY being 512. I'm not sure to understand what is happening, but if I set this to 8 the sound is perfect, any other value has different kinds of noise.

I tried to a lot of different things, but I fear not grasp enough about sound stuff to fix this.

If you want to take a look, my implementation is here: https://github.com/fungos/ass/commit/458f0f9231f8791fb0fe8466ed61bd7e6435111b

Thanks

fungos avatar Nov 29 '18 03:11 fungos

Granularity shouldn't matter, as then everything else would also break.

jarikomppa avatar Dec 03 '18 07:12 jarikomppa