[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] Midi event type and timingoffset key
Am 01.01.2018 um 12:57 schrieb badnumbersmusic@xxxxxxxxx:
> But when I try to use the same trick with a midi event pattern, to control
> an external synthesiser, there's no variation in the rhythm:
>
>
> Can anyone tell me why? I can't think of why \timingOffset can't be applied
> to MIDI messages as well as OSC messages.
Hi,
simply because it's not built in.
See the midi event type in Event.sc:
midi: #{|server|
var freqs, lag, dur, sustain, strum;
var bndl, midiout, hasGate, midicmd;
freqs = ~freq = ~detunedFreq.value;
~amp = ~amp.value;
~midinote = (freqs.cpsmidi).round(1).asInteger;
strum = ~strum;
lag = ~lag;
sustain = ~sustain = ~sustain.value;
midiout = ~midiout.value;
~uid ?? { ~uid = midiout.uid }; // mainly for sysex cmd
hasGate = ~hasGate ? true;
midicmd = ~midicmd;
bndl = ~midiEventFunctions[midicmd].valueEnvir.asCollection;
bndl = bndl.asControlInput.flop;
bndl.do {|msgArgs, i|
var latency;
latency = i * strum + lag;
if(latency == 0.0) {
midiout.performList(midicmd, msgArgs)
} {
thisThread.clock.sched(latency, {
midiout.performList(midicmd, msgArgs);
})
};
if(hasGate and: { midicmd === \noteOn }) {
thisThread.clock.sched(sustain + latency, {
midiout.noteOff(*msgArgs)
});
};
};
},
But you can use lag instead which takes the delay in seconds.
A general remark: please check if examples are reproducable when posting. E.g. this one contains interpreter variables m,q, and h, people have to rewrite for testing, this is frustrating. Chances to get an answer are higher if examples are working out of the box.
Greetings and Happy 2018
Daniel
-----------------------------
www.daniel-mayer.at
-----------------------------
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/