[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] MIDIOut error



Hi, I'm having a problem with a MIDIOut patch. I've included a brief example
of the problem below. I'm controlling some animations in Director using SC2,
the error below occurs when ever I move focus to another application while
the MIDIOut patch is running, even if I click on the finder. As soon as the
error occurs Director stops receiving midi data.  Anybody got any ideas?
Thanks,
Tim



? ERROR: OMSWriteDataAsync failed: 5




({
    var livein,freq,hasFreq,amp,iacOut,newFreq,lastFreq=0,flag=false,chan;
    
    iacOut = MIDIOut.new(0);
    chan=1;
    livein = AudioIn.ar(1);
    amp = Amplitude.kr(livein,0.01,0.01) thresh:0.02;
    #freq,hasFreq = Pitch.kr(livein);
    
    thisSynth.trepeat(0.1,0.08,{
    if(hasFreq.poll==1,{
        newFreq=freq.poll.cpsmidi.round(1);
        newFreq.postln;
        iacOut.noteOn(chan,lastFreq,0);
     });
});
SinOsc.ar(freq,mul:amp);
}.play)