surikov / webaudiofont

Use full GM set of musical instruments to play MIDI and single sounds or effects. Support for reverberation and equaliser. No plugins, no Flash. Pure HTML5 implementation compatible with desktop and mobile browser. See live examples.
https://surikov.github.io/webaudiofont/
GNU General Public License v3.0
891 stars 92 forks source link

Pitch-bend range (sensitivity) #93

Closed page200 closed 1 year ago

page200 commented 1 year ago

I uploaded passport.mid to https://surikov.github.io/webaudiofont/examples/midiplayer.html and the pitch bends (for example played in the last non-drum channel around the 92% progress mark, i.e. at time 1:51) sound different than in non-web MIDI players. Maybe the pitch-bend value gets multiplied by a wrong factor or so.

surikov commented 1 year ago

https://surikov.github.io/webaudiofont/examples/midiplayer.html - a small example of using WrebAudioFont. WebAudioFont is an engine for playing music, not for parsing music files. Write your own MIDI parser if you need to parse a "pitch-bend" event in a special way.

page200 commented 1 year ago

Thank you for the quick reply! :)

The example MIDI file parser at https://github.com/surikov/webaudiofont/blob/master/examples/MIDIFile.js#L1020, instead of dividing by 6, should divide by 64 and multiply by the number of semitones of the pitch-bend range (2 per default, or otherwise set via specific RPN messages, usually followed by specific "Data Entry" messages: http://midi.teragonaudio.com/tech/midispec/rpn.htm).

It would be great if you could fix this. Otherwise even the pitch bends in the demo song from "The Good, the Bad and the Ugly" on your page are affected.

surikov commented 1 year ago

Author of MIDIFile.js is https://github.com/nfroidure Ask him to modify his parser. You can use any other parser.

Again WebAudioFont is an engine for playing music, not for parsing music files.

page200 commented 1 year ago

Neither https://github.com/nfroidure/midifile nor its ahead forks (nor its accompanying repos https://github.com/nfroidure/midievents (which is also part of your MIDIFile.js) and https://github.com/nfroidure/midiplayer) seem to have slides (pitch bends) or parseSong. Maybe you had implemented that. So I made a pull request for your repo rather than for the original MIDIFile.js

page200 commented 1 year ago

The author of the original MIDIFile.js repo welcomes a pull request with the updates that are unique to your repo (slides (pitch bends), parseSong(), ...).

You're most qualified for this because you wrote the updates, and because you'll be able to simultaneously turn MIDIFile.js in your repo into an external dependency, so the repos won't get out of sync. But maybe someone else can make the pull request, too.