[sc-users] Re: sending messages from SERVER to SCLANG

Daniel Peterson dmartinp at gmail.com
Sat Dec 2 13:28:08 PST 2006


In the helpfile it shows you how to do this.  You use SendTrig.kr  So  
just put your amplitude data in the 3rd argument for SendTrig:

something like this...

SynthDef(\trigs, {arg inbus, id;
	var trig, amp, in;
	in = In.ar(inbus);
	amp = Amplitude.kr(in);
	trig = Trig1.ar(Impulse.ar(0.05)); // trigger
	SendTrig.ar(trig, id, amp); // send the current amplitude back to  
the lang
	}).load(s);

then access it in the lang like this....

OSCresponderNode(s.addr, '/tr', {arg time, resp, msg;
		var id, amp;
		id = msg[2];
		// check if this is the correct trigger
		(id == proc.group).if({
		amp = msg[3].postln;
	}))


I don't know what you want to do with it...

the msg arg in the OSCresponder node will be an array of 3 values  
that are sent by the SendTrig,  so msg[3] will be you amplitude data  
and msg[2] will be the trigger's id to make sure you are talking to  
the correct trigger.

Hope this makes sense.

Daniel

On Dec 2, 2006, at 1:14 PM, morgan packard wrote:

> thanks daniel,
>
> This is a step in the right direction.
>
> But can I send OSC messages from inside a SynthDef? I"m not sure  
> how I would go about translating data from Amplitude.kr in to an  
> OSC message.
>
> thanks,
>
> -morgan
>
> Daniel Peterson <dmartinp at gmail.com> wrote:
> Check out the OSCresponderNode helpfile, I think that will tell you  
> all you need to know.
>
> Daniel
>
> On Dec 2, 2006, at 12:59 PM, morgan packard wrote:
>
>> Scratch what I said aboutt NodeWatcher. Completely not what I'm  
>> looking for. So, again, anyone have any ideas how to get amplitude  
>> data (presumably using the Amplitude ugen) in to one of my own  
>> SCLang objects?
>>
>> thanks a bunch,
>>
>> -morgan
>>
>> morgan packard <morganpackard at yahoo.com> wrote:
>> Hello List,
>>
>> Here's what I'm trying to do:
>>
>> Read a sound file in to a buffer, track the amplitude of the  
>> soundfile in the buffer, and send that data to a SCLang object.  
>> Problem is, once I'm inside a synthdef, I'm not quite sure how to  
>> send info out, or access SCLang objects.
>>
>> The NodeMessaging helpfile mentions NodeWatcher, which I'm going  
>> to look in to now. If anyone has any better ideas, please let me  
>> know.
>>
>> thanks a bunch,
>>
>> -morgan
>>
>>
>> +++++++++++++++++++++++++++++++++++
>> morganpackard.com
>> myspace.com/morganpackard
>> +++++++++++++++++++++++++++++++++++
>>
>>
>>
>> +++++++++++++++++++++++++++++++++++
>> morganpackard.com
>> myspace.com/morganpackard
>> +++++++++++++++++++++++++++++++++++
>> _______________________________________________
>> sc-users mailing list
>> sc-users at create.ucsb.edu
>> http://www.create.ucsb.edu/mailman/listinfo/sc-users
>
> _______________________________________________
> sc-users mailing list
> sc-users at create.ucsb.edu
> http://www.create.ucsb.edu/mailman/listinfo/sc-users
>
>
>
> +++++++++++++++++++++++++++++++++++
> morganpackard.com
> myspace.com/morganpackard
> +++++++++++++++++++++++++++++++++++
> _______________________________________________
> sc-users mailing list
> sc-users at create.ucsb.edu
> http://www.create.ucsb.edu/mailman/listinfo/sc-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.create.ucsb.edu/pipermail/sc-users/attachments/20061202/221f5a50/attachment.htm


More information about the sc-users mailing list