[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] voicer
you know, you could just use an IdentityDictionary to map midi notes to
synth functions. ie:
(
var dict;
// map midi notes to Voicer newEventFuncs
dict = IdentityDictionary[
60 -> { EnvGen.ar(Env.asr(1, 1, 1), SinOsc.ar(200, 0, 0.1)) },
61 -> { EnvGen.ar(Env.asr(1, 1, 1), WhiteNoise.ar(0.1)) },
62 -> { EnvGen.ar(Env.asr(1, 1, 1), Saw.ar(400, 0.1)) }
];
play({
Voicer.ar({ arg voicer, i, synth, deltaTime, channel, note;
dict.at(note.asInt).value;
}, 1, 1, dict.size)
});
)
Johannes Quint wrote:
>
> why does the first version work, the second one not:
> I.
> (
> var snds,snd, index;
> {Voicer.ar( { arg voicer, cnt, synth, deltaTme, channel, note,
> velocity;
> snds = [...snd1...,...snd2..., etc.];
> index = note - 60;
> if (index == 0 {snd = snds.at(0)});
> if (index == 1 {snd = snds.at(1)});
> if (index == 2 {snd = snds.at(2)});
> ... etc.
> snd},
> 1,1,8)}.play
> )
> II.
> (
> var snds,snd, index;
> {Voicer.ar( { arg voicer, cnt, synth, deltaTme, channel, note,
> velocity;
> snds = [...snd1...,...snd2..., etc.];
> index = note - 60;
> snd = snds.at(index)},
> 1,1,8)}.play
> )
> ???
> thanks for help,
> j.quint
>
> _______________________________________________
> sc-users mailing list
> sc-users@xxxxxxxxxxxxxxx
> http://www.create.ucsb.edu/mailman/listinfo/sc-users