mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-18 09:08:30 +00:00
Add 'sysex' control
- sysex(id, data) and both arguments are patternable
This commit is contained in:
parent
a4792e29f5
commit
57c48f0c45
@ -1616,3 +1616,10 @@ export const ar = register('ar', (t, pat) => {
|
|||||||
const [attack, release = attack] = t;
|
const [attack, release = attack] = t;
|
||||||
return pat.set({ attack, release });
|
return pat.set({ attack, release });
|
||||||
});
|
});
|
||||||
|
export const sysex = register('sysex', (args, pat) => {
|
||||||
|
if (!Array.isArray(args)) {
|
||||||
|
throw new Error('sysex expects an array of [id, data]');
|
||||||
|
}
|
||||||
|
const [id, data] = args;
|
||||||
|
return pat.sysexid(id).sysexdata(data);
|
||||||
|
});
|
||||||
|
|||||||
@ -153,6 +153,8 @@ Pattern.prototype.midi = function (output) {
|
|||||||
sysexdata,
|
sysexdata,
|
||||||
} = hap.value;
|
} = hap.value;
|
||||||
|
|
||||||
|
console.log('hap', hap.value);
|
||||||
|
|
||||||
velocity = gain * velocity;
|
velocity = gain * velocity;
|
||||||
|
|
||||||
// note off messages will often a few ms arrive late, try to prevent glitching by subtracting from the duration length
|
// note off messages will often a few ms arrive late, try to prevent glitching by subtracting from the duration length
|
||||||
@ -213,6 +215,21 @@ Pattern.prototype.midi = function (output) {
|
|||||||
device.sendProgramChange(progNum, midichan, { time: timeOffsetString });
|
device.sendProgramChange(progNum, midichan, { time: timeOffsetString });
|
||||||
}
|
}
|
||||||
// Handle sysex
|
// Handle sysex
|
||||||
|
// sysex data is consist of 2 arrays, first is sysexid, second is sysexdata
|
||||||
|
// sysexid is a manufacturer id it is either a number or an array of 3 numbers.
|
||||||
|
// list of manufacturer ids can be found here : https://midi.org/sysexidtable
|
||||||
|
// if sysexid is an array the first byte is 0x00
|
||||||
|
|
||||||
|
// if (sysex !== undefined) {
|
||||||
|
// console.log('sysex', sysex);
|
||||||
|
// if (Array.isArray(sysex)) {
|
||||||
|
// if (Array.isArray(sysex[0])) {
|
||||||
|
// //device.sendSysex(sysex[0], sysex[1], { time: timeOffsetString });
|
||||||
|
// } else {
|
||||||
|
// //device.sendSysex(sysex[0], sysex[1], { time: timeOffsetString });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
if (sysexid !== undefined && sysexdata !== undefined) {
|
if (sysexid !== undefined && sysexdata !== undefined) {
|
||||||
//console.log('sysex', sysexid, sysexdata);
|
//console.log('sysex', sysexid, sysexdata);
|
||||||
if (Array.isArray(sysexid)) {
|
if (Array.isArray(sysexid)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user