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

Re: [sc-users] changing parameters in a running Pbind



Am 28.12.2015 um 00:34 schrieb Rags musicaal <ragsmusica@xxxxxxxxx>:

> This is the pattern. I want to change f1 on the fly with a midi controller.
> (
> ~seqArp1 = Pseq(([60, 74, 67, 74, 64, 79, 72, 79]-24).midicps, inf).asStream;
> ~patArp1 = Pbind(
> 	\instrument, \vocal,
> 	\freq, ~seqArp1,
> 	\f1, HERE I NEED SOMETHING,
> 	\dur, 0.25
> 	).play;
> )
> 
> Should I use a bus?



Hi,

you don't need to employ a bus here, data can be received by language 
and you need it in the language for the Pbind / EventStreamPlayer. 
With MIDIFunc you can set a variable and take it over by a 
Pattern using a Function, e.g. Pfunc

// connect MIDI

MIDIIn.connectAll


(
SynthDef(\vocal, {|freq = 110, f1 = 1000, f2 = 2300|
	var sig, frq, frmt, env;
	env = EnvGen.kr(Env.perc, doneAction: 2);
	sig = Mix.new(Formant.ar([freq, freq*3], [f1, f2], 800, [0.2, 0.03] * env));
	Out.ar(0, sig.dup)
}).add;
)


(
// define MIDIFunc to assign midi num to variable 
MIDIFunc.noteOn { |vel, num, chan, src| ~f1 = num }; 

MIDIIn.doNoteOnAction(1, 1, 55, 60); // spoof a note on

~seqArp1 = Pseq(([60, 74, 67, 74, 64, 79, 72, 79]-24).midicps, inf);
~patArp1 = Pbind(
	\instrument, \vocal,
	\freq, ~seqArp1,
	\f1, Pfunc { ~f1.midicps },
	\dur, 0.25
	).trace.play;
)

// change on the fly by MIDI spoof (or your controller)

MIDIIn.doNoteOnAction(1, 1, 85); 

MIDIIn.doNoteOnAction(1, 1, 65); 


~patArp1.stop


Regards

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/