You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently plugin.webaudio.js plays samples from the soundfont buffers always at their original pitch because the playbackRate is set to a constant value of 1. This means that pitch bend commands do not have any effect.
I added a bend parameter to the midi.noteOn() function and used its value to set the source.playbackRate.value. Thus one can shift the pitch of a note by some amount (typically less than a semitone). My implementation does not create a glissando effect - it simply changes the pitch of the note by some cents.
My intention was to use the new bend parameter to achieve just intonation, so all my pitch bend corrections are within a range of +/- 20 cents.
As you cannot expect a midi file to contain all the tiny bend changes which are necessary to produce just intonation (or other scale systems like "Werckmeister") I added a user definable callback function
to player.js in function startAudio() to the case statement for noteOn, noteOff. The callback function calculates bend changes based on just intonation (for a certain key) and returns its result to startAudio(). There the new bend parameter gets added to the schedule and will later be applied when the noteOn function of plugin.webaudio.js is called. In standard MIDI pitch bends apply to all notes of a track. My implementation does not have this restriction because it manipulates single noteOn events.
By the way: the same callback could also perform other manipulations like muting a track, applying transpositions, changing dynamics etc.
I suggest to add these two features (pitch bends and a user definable callback during the schedule creation phase) to MIDI.js.
The text was updated successfully, but these errors were encountered:
Currently
plugin.webaudio.js
plays samples from the soundfont buffers always at their original pitch because theplaybackRate
is set to a constant value of 1. This means that pitch bend commands do not have any effect.I added a
bend
parameter to themidi.noteOn()
function and used its value to set thesource.playbackRate.value
. Thus one can shift the pitch of a note by some amount (typically less than a semitone). My implementation does not create a glissando effect - it simply changes the pitch of the note by some cents.My intention was to use the new bend parameter to achieve just intonation, so all my pitch bend corrections are within a range of +/- 20 cents.
As you cannot expect a midi file to contain all the tiny bend changes which are necessary to produce just intonation (or other scale systems like "Werckmeister") I added a user definable callback function
to
player.js
in functionstartAudio()
to thecase statement
fornoteOn, noteOff
. The callback function calculates bend changes based on just intonation (for a certain key) and returns its result tostartAudio()
. There the new bend parameter gets added to the schedule and will later be applied when thenoteOn
function ofplugin.webaudio.js
is called. In standard MIDI pitch bends apply to all notes of a track. My implementation does not have this restriction because it manipulates singlenoteOn
events.By the way: the same callback could also perform other manipulations like muting a track, applying transpositions, changing dynamics etc.
I suggest to add these two features (pitch bends and a user definable callback during the schedule creation phase) to MIDI.js.
The text was updated successfully, but these errors were encountered: