I have tried to build a AudioUnit virtual MIDI instrument using AudioUnitBuilder in SC3.6.6 in OSX 10.9.5.
(
var name, func, specs, componentType, componentSubtype, builder;
name = "www";
func = {
|vol, midinote|
var notes, on, off;
p = Platform.resourceDir +/+ "sounds/a11wlk01.wav";
b = Buffer.read(s, p);
SynthDef(\help_Buffer, { | out = 0, bufnum, freq, amp|
var sig;
sig = PlayBuf.ar(1, bufnum, freq/64*BufRateScale.kr(bufnum))*amp;
Out.ar( out, sig )
}).send(s);
MIDIClient.init;
MIDIIn.connectAll;
notes = Array.newClear(128); // array has one slot per possible MIDI note
on = MIDIFunc.noteOn({ |veloc, num, chan, src|
notes[num] = Synth(\help_Buffer, [\out, 0, \bufnum, b, \freq, num.midicps, \amp, veloc * 0.00315]);
});
off = MIDIFunc.noteOff({ |veloc, num, chan, src|
notes[num].release;
});
q = { on.free; off.free; };
};
specs = #[
[0, 0.5 , \Linear, 0.1,\LinearGain ]
];
componentType = \aumu;
componentSubtype = \CGPG;
builder = AudioUnitBuilder.new(name, componentSubtype, func, specs, componentType);
builder.makeInstall;
)
SC3.6.6 successfully created an AU instrument from the code above.
I have tested the plugin under Logic 9, Logic X and Finale.
Logic X does not recognise the plugin. Could be the compatibility between 6bit host and 32 bit plugin?
Moreover, in Logic 9 and in Finale I don't hear any sound.