Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for pitch bending, vibrato #1

Open
Tails opened this issue Aug 27, 2014 · 3 comments
Open

Support for pitch bending, vibrato #1

Tails opened this issue Aug 27, 2014 · 3 comments

Comments

@Tails
Copy link

Tails commented Aug 27, 2014

Does the library support pitch bends and vibrato? (small and large?)

@dingram
Copy link
Owner

dingram commented Aug 28, 2014

Not explicitly.

For pitch bends you could probably do something like:

myTrack.events.push(new Midi.MidiEvent({
  type: Midi.MidiEvent.PITCH_BEND,
  channel: channel, // e.g. 0
  param1: lowerPitchbendBits(bend),
  param2: upperPitchbendBits(bend),
  time: time, // time since previous event
})

Then the other two *Bits functions would be something like (UNTESTED!):

var lowerPitchbendBits = function(b) { return (b) & 0x7F; }
var upperPitchbendBits = function(b) { return (b >> 7) & 0x7F; }

See the "Pitch Bend Change" command in (for example) http://www.midi.org/techspecs/midimessages.php

Similarly for vibrato:

myTrack.events.push(new Midi.MidiEvent({
  type: Midi.MidiEvent.CONTROLLER,
  channel: channel, // e.g. 0
  param1: 76, // vibrato rate
  param2: vibrato_rate, // 0-127
  time: time, // time since previous event
})
myTrack.events.push(new Midi.MidiEvent({
  type: Midi.MidiEvent.CONTROLLER,
  channel: channel, // e.g. 0
  param1: 77, // vibrato depth
  param2: vibrato_depth, // 0-127
  time: time, // time since previous event
})
myTrack.events.push(new Midi.MidiEvent({
  type: Midi.MidiEvent.CONTROLLER,
  channel: channel, // e.g. 0
  param1: 78, // vibrato delay
  param2: vibrato_delay, // 0-127
  time: time, // time since previous event
})

Of course, I have no idea what these values actually mean 😀

Pull requests welcome 😉

@Tails
Copy link
Author

Tails commented Sep 1, 2014

Thanks, i'll be experimenting with it in the coming days. I'll make a pull request if anything proper comes out of it.

@dingram
Copy link
Owner

dingram commented Sep 3, 2014

Thanks, that would be awesome 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants