mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 13:48:40 +00:00
fix midibend and miditouch
This commit is contained in:
parent
e19d059c0f
commit
3189b365c8
@ -1710,14 +1710,13 @@ export const { sysexid } = registerControl('sysexid');
|
||||
*/
|
||||
export const { sysexdata } = registerControl('sysexdata');
|
||||
|
||||
|
||||
/**
|
||||
* MIDI pitch bend: Sends a MIDI pitch bend message.
|
||||
* @name midibend
|
||||
* @param {number | Pattern} midibend MIDI pitch bend (-1 - 1)
|
||||
* @example
|
||||
* note("c4").midibend(sine.slow(4).range(-0.4,0.4)).midi()
|
||||
*/
|
||||
*/
|
||||
export const { midibend } = registerControl('midibend');
|
||||
/**
|
||||
* MIDI key after touch: Sends a MIDI key after touch message.
|
||||
|
||||
@ -163,8 +163,6 @@ Pattern.prototype.midi = function (output) {
|
||||
sysexdata,
|
||||
} = hap.value;
|
||||
|
||||
console.log('hap', hap.value);
|
||||
|
||||
velocity = gain * velocity;
|
||||
|
||||
// note off messages will often a few ms arrive late, try to prevent glitching by subtracting from the duration length
|
||||
@ -267,18 +265,20 @@ Pattern.prototype.midi = function (output) {
|
||||
|
||||
// Handle midibend
|
||||
if (midibend !== undefined) {
|
||||
if (typeof midibend !== 'number' || midibend < 1 || midibend > -1) {
|
||||
if (typeof midibend == 'number' || midibend < 1 || midibend > -1) {
|
||||
device.sendPitchBend(midibend, midichan, { time: timeOffsetString });
|
||||
}else{
|
||||
throw new Error('expected midibend to be a number between 1 and -1');
|
||||
}
|
||||
device.sendPitchBend(midibend, midichan, { time: timeOffsetString });
|
||||
}
|
||||
|
||||
// Handle miditouch
|
||||
if (miditouch !== undefined) {
|
||||
if (typeof miditouch !== 'number' || miditouch < 1 || miditouch > 0) {
|
||||
if (typeof miditouch == 'number' || miditouch < 1 || miditouch > 0) {
|
||||
device.sendKeyAfterTouch(miditouch, midichan, { time: timeOffsetString });
|
||||
}else{
|
||||
throw new Error('expected miditouch to be a number between 1 and 0');
|
||||
}
|
||||
device.sendKeyAfterTouch(miditouch, midichan, { time: timeOffsetString });
|
||||
}
|
||||
|
||||
// Handle midicmd
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user