schellingb / TinySoundFont

SoundFont2 synthesizer library in a single C/C++ file
MIT License
608 stars 71 forks source link

Support MIDI CC 64 Sustain. #88

Open nwhitehead opened 3 months ago

nwhitehead commented 3 months ago

This change adds support for MIDI CC 64, sustain pedal.

This is a commonly used MIDI CC message and not too much work to support at the channel level in TinySoundFont. It requires adding a bit of state to every playing voice to remember which voices are playing because sustain is on. Every channel also gets a field to record whether sustain is on or off.

BLumia commented 2 months ago

I would just like to say thanks for this patch! After play with some MIDI files collection of my own, it works quite good and perfectly addressed the CC64 issue mentioned in https://github.com/schellingb/TinySoundFont/issues/86. It would be even better if this change could be merged. Anyway, thanks again!

nwhitehead commented 2 months ago

@BLumia Glad it works! Thanks for the test. If you have a project that uses TinySoundFont and you need the change before it's officially merged, you can point the project to the repo git@github.com:nwhitehead/TinySoundFont.git and the sustain branch, or just copy the file https://github.com/nwhitehead/TinySoundFont/blob/sustain/tsf.h