« Return to Thread: WiiMote example code request

Re: WiiMote example code request

by nescivi :: Rate this Message:

Reply to Author | View in Thread

WiiMote.start;    // start the eventloop
WiiMote.discover; // discover a new device (wait for post about connected)
WiiMote.all;      // post an array of all devices
w = WiiMote.all[0];
x = WiiMoteGUI.new( w ); // create a GUI (only covers the WiiMote and
NunChuk currently)

w.enableMotionSensor( 1 );
w.enableExpansion( 1 );

// create bus on the server
b = Bus.control( s, 1 );

w.setAction( \ax, { |v| b.set( v ) } ); // write the value to the bus.

SynthDef( \wii_example, { |out=0,amp=0|
        Out.ar( out, SinOsc.ar( 300, 0, 0.01*amp.abs ) );
}).load( s );
)

x = Synth.new( \wii_example );
x.map( \amp, b );
x.free;

// same but using In.kr to read from bus
SynthDef( \wii_example2, { |out=0,controlbus=0|
        var amp;
        amp = In.kr( controlbus, 1 );
        Out.ar( out, SinOsc.ar( 300, 0, 0.01*amp.abs ) );
}).load( s );
)

x = Synth.new( \wii_example2, [\controlbus, b] );
x.free;


On 5/16/08, Tomer Harari <hatanin@...> wrote:

>
> I guess the code is not clear enough for me.
> Is it rude to ask you to spell it out for me?
> How does this action look like?
> Thanks for your patience
> Tomer
>
>
> nescivi wrote:
>>
>> Is the example code in the helpfile not clear enough?
>>
>> You can just set the action to put the value on a control bus for the
>> sensors that you are interested in. Then you can use the values
>> directly inside a SynthDef by reading from the control bus.
>>
>> sincerely,
>> Marije
>>
>> On 5/14/08, Tomer Harari <hatanin@...> wrote:
>>>
>>> Hi,
>>> I am looking for some example code for using the wiimote and nunchuk.
>>> I had luck with Pete Moss's WiimoteLib, but it does not support the
>>> nunchuk.
>>> so, I would like to get some examples of how to tap in to the
>>> accelerometers, and map them to a control bus or use them inside a
>>> SynthDef
>>> with the WiiMote class that comes with SC.
>>> Thanks a lot
>>> Tomer
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/WiiMote-example-code-request-tp17240482p17240482.html
>>> Sent from the Supercollider - User mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> sc-users mailing list
>>> sc-users@...
>>> http://lists.create.ucsb.edu/mailman/listinfo/sc-users
>>>
>> _______________________________________________
>> sc-users mailing list
>> sc-users@...
>> http://lists.create.ucsb.edu/mailman/listinfo/sc-users
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/WiiMote-example-code-request-tp17240482p17270252.html
> Sent from the Supercollider - User mailing list archive at Nabble.com.
>
> _______________________________________________
> sc-users mailing list
> sc-users@...
> http://lists.create.ucsb.edu/mailman/listinfo/sc-users
>
_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

 « Return to Thread: WiiMote example code request

LightInTheBox - Buy quality products at wholesale price