I would like to be able to have an event pattern that is capable of outputting note events and MIDI events simultaneously so that I can record both the sound result and the originating MIDI data on an external DAW.
To do this, after starting the server and instantiating a MidiOut:
s.boot;
MIDIClient.init;
MIDIIn.connectAll;
~midi_out = MIDIOut(0);
I tried the first thing that came to mind, which was to use the \type
key and assign it a symbols list containing \note
(for note events) and \midi
(for midi events):
(
Pbindef(\test,
\type, [\note, \midi],
// MIDI stuff
\midicmd, \noteOn,
\midiout, ~midi_out,
\chan, 0,
// "sound synthesis" stuff
\instrument, \default,
\octave, 5,
\degree, 0,
\dur, 1,
\amp, 1.0,
\out, 0,
).quant_([4]).play;
);
But while this causes SC to output sound, as I expect, it does not produce any MIDI data output.
- why?
- How can I achieve the desired result?
In order to better understand the inner workings of SC, I ask a further question: why does it work and produce two independent sounds?
(
Pbindef(\test2,
\instrument, \default,
\octave, 5,
\degree, [0,4],
\dur, 1,
\amp, 1.0,
\out, 0,
).quant_([4]).play;
);
- Is it actually two note events, or is it rather a single note event?
- It occurs to me that when a list is passed as an argument, the event pattern behaves differently depending on whether the key is
\type
or something else (e.g.\degree
).