electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks GalleryGallery 
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
ChucK & Wiimote question
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [14 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
L.N.



Joined: Jul 03, 2007
Posts: 3
Location: Helsinki/Finland

PostPosted: Tue Jul 03, 2007 2:54 pm    Post subject: ChucK & Wiimote question Reply with quote  Mark this post and the followings unread

Greetings all!

Has anybody tried out using a Wiimote with ChucK?
I'm trying it out at the moment, it shows up as a HID joystick device (as 'Nintendo RVL-CNT-01' in XPSP2) , but doesn't seem to be sending any data... It has been working quite well with other tools.

I'd be happy to hear from others who are experimenting with the controller.

I'm also quite new to ChucK and am wondering if the handling should be different, although i can see

hidDev => now;
//<-- nothing happens past this point.
while( hidDev.recv( hidMsg ) )
...

Cheers,
Lassi
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 6248
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Jul 04, 2007 2:49 am    Post subject: Reply with quote  Mark this post and the followings unread

I think Spencer is working on native support for the Wiimote, he talked about that on the list, I think.

For now you could look into some of those wii-mote=>MIDI tools that have been floating around the web?

_________________
while(!machine.crash() ) <<<"all is well">>>;
Back to top
View user's profile Send private message Send e-mail Visit poster's website
L.N.



Joined: Jul 03, 2007
Posts: 3
Location: Helsinki/Finland

PostPosted: Wed Jul 04, 2007 10:45 am    Post subject: Reply with quote  Mark this post and the followings unread

Kassen wrote:
I think Spencer is working on native support for the Wiimote, he talked about that on the list, I think.

For now you could look into some of those wii-mote=>MIDI tools that have been floating around the web?


Yeah, glovepie seems to be working fine for this, although I'll lose quite a bit of precision with the accelerometers & tilt sensors,,, at least it'll provide a wide range of possibilities.

Another option would be to use the API and program a bridge between wiimote and OSC, that might also be useful.

Best,
Lassi
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 6248
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Jul 04, 2007 12:28 pm    Post subject: Reply with quote  Mark this post and the followings unread

Yeah, true. I didn't touch a Wii yet but Nintendo always used quality analogue controlers with a high resolution so it'd be a waste to sacrefice that to MIDI.
_________________
while(!machine.crash() ) <<<"all is well">>>;
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Plasticman



Joined: Feb 25, 2008
Posts: 11
Location: Ireland

PostPosted: Mon May 05, 2008 1:11 am    Post subject: Reply with quote  Mark this post and the followings unread

Foe a project in college, we used a program called OSCulator to send Wiimote date via OSC, to be interpreted by ChucK...
Back to top
View user's profile Send private message
Inventor



Joined: Oct 13, 2007
Posts: 1168
Location: Florida, USA
Audio files: 50

PostPosted: Mon May 05, 2008 1:43 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi folks, just thought I'd chime in... If you're on a linux system, nescivi wrote a tool called wiiosc that i think would do the job. The link is in a related thread (a recent one), and if you want it and can't find it, I'll go look for you.

I wish my machines had Bluetooth, cause I'd love to run a wiimote on my HID setup, but it looks like I will be making a custom thingie with some $35 boards available on the web. It's a USB approach, so there's a wire, but the guitar is USB also so it's ok.

By the way, does anyone know of a little bitty hub that could combine two or more USB signals into one? Or is wireless USB an option for later? Sorry to drift off-topic, but I do that...

_________________
@(ºoº)@ ><}}}º> ~(^.^) <:3 )~
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 6248
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed May 07, 2008 4:15 pm    Post subject: Reply with quote  Mark this post and the followings unread

Inventor wrote:

By the way, does anyone know of a little bitty hub that could combine two or more USB signals into one? Or is wireless USB an option for later? Sorry to drift off-topic, but I do that...


Yes, they are called "USB hubs" and are available everywhere and are cheap. Some keyboards have them build-in as well. Just ask you local computer store, they should have dozens, not a exotic device at all.

A bit of topic drifting is fine with me; I think giving space to the natural flow of thought is much more ChucKian then fencing everything off in little boxes.

_________________
while(!machine.crash() ) <<<"all is well">>>;
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Inventor



Joined: Oct 13, 2007
Posts: 1168
Location: Florida, USA
Audio files: 50

PostPosted: Thu May 08, 2008 9:51 pm    Post subject: Reply with quote  Mark this post and the followings unread

Kassen wrote:
Inventor wrote:

By the way, does anyone know of a little bitty hub that could combine two or more USB signals into one? Or is wireless USB an option for later? Sorry to drift off-topic, but I do that...


Yes, they are called "USB hubs" and are available everywhere and are cheap. Some keyboards have them build-in as well. Just ask you local computer store, they should have dozens, not a exotic device at all.


Oh, yes, Kassen, I've seen USB hubs advertised, but I think I didn't ask my question properly. The scenario is that I have two (or more but let's say two) USB devices on my guitar: the guitar's USB and the motion sensor's USB. I'd like a hub to mux them down to 1 line without being large, bulky, and made to sit on a desktop - you know, a slim little in-line thingie. That would go along with some really short USB cables (like a few inches (2.5cm/in)), and then ultimately the hub or a replacement hub would have battery power so that I could step up to wireless USB for the whole setup.

That, or a battery-juiced wireless USB thingie-majingie would be another solution. Again, I'm climbing up the mast and looking thru the lens to sight land, as it will be some time before I can buy said goodies, but I like to think ahead. Actually I've moved up the date of the guitar purchase so that if all goes well I'll be pickin' strings in about two weeks! So, any thoughts on the future or present of wireless USB products?

_________________
@(ºoº)@ ><}}}º> ~(^.^) <:3 )~
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 10753
Location: Netherlands, Enschede
Audio files: 22
G2 patch files: 287

PostPosted: Fri May 09, 2008 3:00 am    Post subject: Reply with quote  Mark this post and the followings unread

like http://uk.gizmodo.com/2006/07/31/lindys_micro_usb_hub.html ?

I just googled for "tiny usb hub"

Some more show up, like : http://gadgets.boingboing.net/2008/04/25/tiny-usb-hub-with-yc.html

But whatever you do, don't make one yourself.

_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Inventor



Joined: Oct 13, 2007
Posts: 1168
Location: Florida, USA
Audio files: 50

PostPosted: Fri May 09, 2008 3:45 am    Post subject: Reply with quote  Mark this post and the followings unread

Blue Hell wrote:
I just googled for "tiny usb hub"

But whatever you do, don't make one yourself.


Thanks Jan, that little Lindy model is just the ticket! For some silly reason I didn't think to Google before asking, duh! Oh, and yes, this is one thing I'm piecing together instead of making a custom board - the chips are so small and I wouldn't begin to know how to properly program all the ID information! Best left to the experts.

_________________
@(ºoº)@ ><}}}º> ~(^.^) <:3 )~
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Inventor



Joined: Oct 13, 2007
Posts: 1168
Location: Florida, USA
Audio files: 50

PostPosted: Fri May 09, 2008 4:39 am    Post subject: Reply with quote  Mark this post and the followings unread

On a related note, here is a miniature USB to bluetooth adapter for $40:

http://www.everythingusb.com/kensington-bluetooth-usb-micro-adapter-14147.html

That or similar products opens up the door to using a wimote for my application, since I don't have bluetooth. There is a wealth of fun USB products to read about on the everything usb web site, it's worth a look just for entertainment purposes!

_________________
@(ºoº)@ ><}}}º> ~(^.^) <:3 )~
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hirsute



Joined: May 15, 2008
Posts: 3
Location: Ireland

PostPosted: Fri May 16, 2008 12:13 pm    Post subject:  wii motes! Reply with quote  Mark this post and the followings unread

Hey all, first post! woo!

Anyway, as Plasticman said, as part of a college project we had wiimotes providing input to a chuck program via OSC packets.

For those of you using macs, go to osculator.net and download OSCulator. It's free and all, so no worries there. Unfortunatley its mac only, but there do exist windows/linux programs that do the same thing, you'll just have to configure the OSC packets they send manually. (it should be easy enough to go through the program and find what packets are needed).

For the mac guys though I've attached the OSCulator configuration file for the wiimote programs, which are also attached inside a zip file. OSCulator supports up to four wiimotes simultaneously, and there are four chuck programs to go along with it, all slightly different in their printouts and OSC packets and whatnot.


Below is the code for wiimote number one for those who want to have a quick peek. (Please excuse the lack of comments and the general unreadability of the code. I didn't think it'd be read by anyone except myself when I wrote it).

Basically the code allows the 5 different base oscillator types (selected by the left and right arrows) the pitch of which is controlled by the pitch of the wiimote. The range of frequencies is controlled by the up and down arrows of the wiimote.
There are also 5 LFO oscillator types whose rate is controlled by the roll of the wiimote (right = faster, left = slower). You can select a different waveform by holding the A button and pressing left or right arrows. The range of the LFO rate is changed by holding A and pressing the up and down arrows. The LFO can be toggled on or off with the 1 button.
There are the 3 different reverbs available too, toggled using the number 2 button. To scroll between them, hold down the B button (trigger button) and use the left and right arrow buttons. The amount of reverb is controlled by holding B and using the up and down arrows.

Additionally the plus and minus buttons control the volume of the wiimote, and the Home button is a mute toggle.

When the program is run you first have to press all the buttons on the wiimote in turn (not in any particular order) to activate them. Kind of like a set up. Upon pressing the last remaining button the program will produce sound. At first there might be a backlog of OSC packets, leading to a bit of distortion, but that will calm down soon enough. The program starts with both the LFO and base waveforms as sin waves and with the JCRev reverb on, but they can be toggled off at your preference.

wow, this is turning out to be a long post....
Anyway, feel free to modify the code to suit yourself, and if you come up with anything cool or interesting post it up! And have fun!

(Again, apologies for the state of the code) Rolling Eyes

Code:



Echo e;

Gain wii1gain;
1 => wii1gain.gain;
wii1gain => dac;

//reverbs

PRCRev prcRev => wii1gain;
JCRev jcRev => wii1gain;
NRev nRev => wii1gain;

0 => prcRev.op => nRev.op;
1 => jcRev.op; //default to JCRev

fun void updateReverbMix(float rMix){
   rMix => prcRev.mix => jcRev.mix => nRev.mix;
}

fun void selectReverb(int wrev){
               if (wrev == 0)
                                        {
                                                0 => nRev.op => jcRev.op;
                                                1 => prcRev.op;
                                                <<<"Wiimote 1: reverb = PRC">>>;
                                        }
                                        else if(wrev == 1){
                                                0 => prcRev.op => nRev.op;
                                                1 => jcRev.op;
                                                <<<"Wiimote 1: reverb = JC">>>;
                                        }
                                        else if(wrev == 2){
                                                0 => prcRev.op => jcRev.op;
                                                1 => nRev.op;
                                                <<<"Wiimote 1: reverb = N">>>;
                                        }

}

0 => int whichReverb;
selectReverb(whichReverb);
//end reverbs

//base oscillators

   
        SinOsc sin => prcRev;
        SawOsc saw => prcRev;
        PulseOsc pulse => prcRev;
        SqrOsc sqr => prcRev;
        TriOsc tri => prcRev;
   
   sin => jcRev;
        saw => jcRev;
        pulse => jcRev;
        sqr => jcRev;
        tri => jcRev;

   sin => nRev;
        saw => nRev;
        pulse => nRev;
        sqr => nRev;
        tri => nRev;

        0 => saw.op => pulse.op => sqr.op => tri.op;
   1 => sin.op; //default to sin oscillator.

fun void updateBaseFreq(float f){
   
   f => sin.freq => saw.freq => pulse.freq => sqr.freq => tri.freq;
}

fun void selectOsc(int wosc){
               if (wosc == 0)
                                        {
                                                0 => saw.op => pulse.op => sqr.op => tri.op;
                                                1 => sin.op;
                                                <<<"Wiimote 1: sin wave">>>;
                                        }
                                        else if (wosc == 1)
                                        {
                                                0 => sin.op => pulse.op => sqr.op => tri.op;
                                                1 => saw.op;
                                                <<<"Wiimote 1: saw wave">>>;
                                        }
                                        else if (wosc == 2)
                                        {
                                                0 => sin.op => saw.op => sqr.op => tri.op;
                                                1 => pulse.op;
                                                <<<"Wiimote 1: pulse wave">>>;
                                        }
                                        else if (wosc == 3)
                                        {
                                                0 => sin.op => saw.op => pulse.op => tri.op;
                                                1 => sqr.op;
                                                <<<"Wiimote 1: square wave">>>;
                                        }
                                        else if (wosc == 4)
                                        {
                                                0 => sin.op => saw.op => pulse.op => sqr.op;
                                                1 => tri.op;
                                                <<<"Wiimote 1: triangle wave">>>;
                                        }
}

0 => int whichOsc;
selectOsc(whichOsc);
//end base oscs

//lfo oscs

   SinOsc lfoSin => blackhole;
   SawOsc lfoSaw => blackhole;
   PulseOsc lfoPulse => blackhole;
   SqrOsc lfoSqr => blackhole;
   TriOsc lfoTri => blackhole;
   0 => lfoSaw.op => lfoPulse.op => lfoSqr.op => lfoTri.op;
   1 => lfoSin.op;

fun void updateLFOFreq(float newFreq){

   newFreq => lfoSin.freq => lfoSaw.freq => lfoPulse.freq => lfoSqr.freq => lfoTri.freq;
}

fun void selectLFO(int wlfo){

               if (wlfo == 0)
                                        {
                                                -1 => lfoSaw.op => lfoPulse.op => lfoSqr.op => lfoTri.op;
                                                1 => lfoSin.op;
                  <<<"Wiimote 1: LFO = sin">>>;
                                        }
                                        else if (wlfo == 1)
                                        {
                                                -1 => lfoSin.op => lfoPulse.op => lfoSqr.op => lfoTri.op;
                                                1 => lfoSaw.op;
                  <<<"Wiimote 1: LFO = saw">>>;
                                        }
                                        else if (wlfo == 2)
                                        {
                                                -1 => lfoSin.op => lfoSaw.op => lfoSqr.op => lfoTri.op;
                                                1 => lfoPulse.op;
                  <<<"Wiimote 1: LFO = pulse">>>;
                                        }
                                        else if (wlfo == 3)
                                        {
                                                -1 => lfoSin.op => lfoSaw.op => lfoPulse.op => lfoTri.op;
                                                1 => lfoSqr.op;
                  <<<"Wiimote 1: LFO = square">>>;
                                        }
                                        else if (wlfo == 4)
                                        {
                                                -1 => lfoSin.op => lfoSaw.op => lfoPulse.op => lfoSqr.op;
                                                1 => lfoTri.op;
                  <<<"Wiimote 1: LFO = triangle">>>;
                                        }
}





0 => int whichLFO;
selectLFO(whichLFO);
//end lfos

PitShift pitchShifter;

SqrOsc s;
SinOsc lfo;

// OSC receiver
OscRecv orec;
9000 => orec.port;
orec.listen();

float a;
float b;
float pitch;
float roll;
float yaw;
float pryAccel;
float one;
float two;
float up;
float down;
float left;
float right;
float plus;
float minus;
float x;
float y;
float z;
float home;



int baseFreq;
1500 => baseFreq;//default base to multiply pitch value by
float lfoFreq;
10 => lfoFreq;//default lfo
float reverbAmount;
0.4 => reverbAmount;//default reverb amount
float currentVolume;
1 => currentVolume;

updateReverbMix(reverbAmount);

int bCount;
int aCount;
int baseCount;
1 => aCount;
1 => bCount;
1 => baseCount;
         ///change above to -1?
// OSC event
orec.event("/wii/1/b, f") @=> OscEvent bButton;
orec.event("/wii/1/a, f") @=> OscEvent aButton;

orec.event("/wii/1/home, f") @=> OscEvent homeButton;

orec.event("/wii/1/pry, f f f f") @=> OscEvent oe;
orec.event("/wii/1/xyz, f f f") @=> OscEvent acceloe;

orec.event("/wii/1/left, f") @=> OscEvent leftButton;
orec.event("/wii/1/right, f") @=> OscEvent rightButton;
orec.event("/wii/1/up, f") @=> OscEvent upButton;
orec.event("/wii/1/down, f") @=> OscEvent downButton;

orec.event("/wii/1/plus, f") @=> OscEvent plusButton;
orec.event("/wii/1/minus, f") @=> OscEvent minusButton;

orec.event("/wii/1/one, f") @=> OscEvent oneButton;
orec.event("/wii/1/two, f") @=> OscEvent twoButton;


   spork ~aEvent();
   spork ~bEvent();
   spork ~plusEvent();
   spork ~minusEvent();
   spork ~upEvent();
   spork ~downEvent();
   spork ~leftEvent();
   spork ~rightEvent();
   spork ~homeEvent();
   spork ~oneEvent();
   spork ~twoEvent();

   //spork ~panEvent();
   
while (1)
{
        // Wait for event
        oe => now;

        // Pop message
        while (oe.nextMsg())
        {

                // fetch packet contents
                oe.getFloat() => pitch;             
                oe.getFloat() => roll;
      oe.getFloat() => yaw;
      oe.getFloat() => pryAccel;      

//debug text
//      <<<"First status">>>;
//                Machine.status();
//                <<<pitch>>>;

      
      baseFreq *=> pitch;
      lfoFreq *=> roll;
      10 *=> yaw;
//      <<<pitch>>>;

      
      play(whichOsc,pitch,roll,yaw);
               
   //   Machine.status();

        }


}

fun void oneEvent(){
//toggle LFO
while(1){
   while(oneButton.nextMsg()){
      oneButton => now;
      oneButton.getFloat() => one;
      <<<"Wiimote 1: toggle LFO">>>;
//      <<<one>>>;
      if(one == 0){
      
         -1 *=> aCount;
         if(aCount == 1){
            -1 => lfoSaw.op => lfoPulse.op => lfoSqr.op => lfoTri.op => lfoSin.op;
//                                0 => lfoSaw.op => lfoPulse.op => lfoSqr.op => lfoTri.op => lfoSin.op;

         }else{
            selectLFO(whichLFO);
         }
      }
   }
}
}

fun void twoEvent(){
//toggle reverb
while(1){
        while(twoButton.nextMsg()){
                twoButton => now;
      twoButton.getFloat() => two;
      <<<"Wiimote 1: toggle reverb">>>;
//      <<<two>>>;

                if(two == 0){

                        -1 *=> bCount;
                        if(bCount == 1){
            -1 => jcRev.op => nRev.op => jcRev.op;
//                                0 => jcRev.op => nRev.op => jcRev.op;

                        }else{
                                selectReverb(whichReverb);
                        }
                }
        }
}
}


fun void homeEvent(){
//when home button is pressed, mute the corresponding device

while(1){
   
   while(homeButton.nextMsg()){
      
      homeButton => now;
      homeButton.getFloat() => home;
      if(home == 0 ){
         -1*=>baseCount;
         if(baseCount == 1){
            currentVolume => wii1gain.gain;
         }
         else{
            0 => wii1gain.gain;
            <<<"Wiimote 1: mute">>>;
         }   
      }
   }
}
}

fun void leftEvent(){

while(1){
        while(leftButton.nextMsg()){
                leftButton=>now;
      leftButton.getFloat() => left;
                if(left == 0.0){
                        if(a == 0){
               (whichLFO -1) => whichLFO;
               if(whichLFO <0> whichLFO;
               }
                                  selectLFO(whichLFO);
                        }else{
                                if(b == 0){
                                         (whichReverb -1) => whichReverb;
               if(whichReverb <0> whichReverb;
                                        }               
               selectReverb(whichReverb);
         }else{
               (whichOsc -1) => whichOsc;
               if(whichOsc <0> whichOsc;
               }                                     
               selectOsc(whichOsc);
                                }
                        }
                }
        }
}
}


fun void rightEvent(){

while(1){
        while(rightButton.nextMsg()){
                rightButton=>now;
      rightButton.getFloat() => right;
                if(right == 0.0){
                        if(a == 0){

                                        ((whichLFO + 1) % 5) => whichLFO;
               
               selectLFO(whichLFO);

               }else{
                                   if(b == 0){
                                         ((whichReverb + 1) % 3) => whichReverb;
                  selectReverb(whichReverb);                                       

               }else{
                                        ((whichOsc + 1) % 5) => whichOsc;

               selectOsc(whichOsc);
                                     }
                        }

                }
        }
}
}



//fun void bEvent(JCRev rev){
fun void bEvent(){
//trigger button
while(1){
   while(bButton.nextMsg()){
      bButton => now;

                bButton.getFloat() => b;
 //               <<<"pressed, b is ">>>;
 //               <<<b>>>;
      //reverbAmount => rev.mix;      

                //if(b == 0.0){
                 //       -1*=>bCount;
                  //      bCount=>rev.op;
              // }
   }
}   
}



//fun void play(PulseOsc posc, SinOsc sosc, float i, float j, float last)
fun void play(int oscNumber, float i, float j, float last)

{//contains constant changes to the current sound.
   
   updateLFOFreq(j);   
//   j => lfo.freq;   //roll
//   z => lfo.freq;   //yaw
   updateLFOFreq(j);


//needs a function to return the last (or current) rnning lfo

//   (jcRev.last() * 50) + i + 100 => float indata;
//        (lfoSin.last() * 50) + i + 100 => float indata;
float indata;
//700 => indata;
    if (whichLFO == 0){
            (lfoSin.last() * 50) + i + 100 => indata;
      }else{ if (whichLFO == 1){
         (lfoSaw.last() * 50) + i + 100 => indata;
                }else{ if (whichLFO == 2){
                   (lfoPulse.last() * 50) + i + 100 => indata;
      }else{ if (whichLFO == 3){
         (lfoSqr.last() * 50) + i + 100 => indata;
                }else{ if (whichLFO == 4){
                (   lfoTri.last() * 50) + i + 100 => indata;
      }
      else{         
         (lfoSin.last() * 50) + i + 100 => indata;
               <<<"default">>>;
      }   }}}}


   updateBaseFreq(indata);

//        Machine.status();
//        <<<"shred status">>>;

        1::ms => now;
}


//fun void aEvent(SinOsc so){
fun void aEvent(){
while(1){
        while(aButton.nextMsg()){
//                <<<"waiting">>>;
                aButton => now;

                aButton.getFloat()=>a;
//                <<<"pressed, a is ">>>;
//                <<<a>>>;
//      if(a == 0.0){
//                   -1*=>aCount;
//                  aCount=>so.op;
//               }
        }
}
}


fun void plusEvent(){

while(1){
   while(plusButton.nextMsg()){
      plusButton=>now;
      plusButton.getFloat() => plus;
      if(plus == 0.0){
         (currentVolume + 0.1) => currentVolume => wii1gain.gain;
   
         <<<"Wiimote 1: volume increased">>>;
      }
   }
}

}

fun void minusEvent(){

while(1){
        while(minusButton.nextMsg()){
                minusButton=>now;
      minusButton.getFloat() => minus;
                if(minus == 0.0){
         if(currentVolume <0> currentVolume;
                        }else{

                        (currentVolume - 0.1) => wii1gain.gain => currentVolume;
                       <<<"Wiimote 1: volume decreased">>>;

         }
                }
        }
}

}

fun void upEvent(){

while(1){
        while(upButton.nextMsg()){
                upButton=>now;
      upButton.getFloat() => up;
      <<<"Wiimote 1: up">>>;
                if(up == 0.0){
         if(a == 0){
            1 +=> lfoFreq;
         }else{
            if(b == 0){
               0.1 +=> reverbAmount;
               updateReverbMix(reverbAmount);
            }else{
               100 +=> baseFreq;
            }
         }               
      }
        }
}
}


fun void downEvent(){

while(1){
        while(downButton.nextMsg()){
                downButton=>now;
      downButton.getFloat() => down;
      <<<"Wiimote 1: down">>>;
                if(down == 0.0){
                        if(a == 0){
                                1 -=> lfoFreq;
                        }else{
            if(b == 0){
               0.1 -=> reverbAmount;
               updateReverbMix(reverbAmount);
            }else{
                                   100 -=> baseFreq;
            }
                        }
                }
        }
}
}


[/code]


WiiStuff.zip
 Description:
Contains the osculator config file and the 4 wiimote chuck programs.

Download
 Filename:  WiiStuff.zip
 Filesize:  22.95 KB
 Downloaded:  10 Time(s)

Back to top
View user's profile Send private message
Inventor



Joined: Oct 13, 2007
Posts: 1168
Location: Florida, USA
Audio files: 50

PostPosted: Fri May 16, 2008 12:53 pm    Post subject: Reply with quote  Mark this post and the followings unread

hirsute, welcome to electro-music.com and thank you for this most excellent contribution to the HID effort! One of the reasons that I had hesitated to use a wiimote on my guitar project was because I didn't have many good examples of how to do it. Plus my primary ChucK platform is indeed a Mac. So I'll be checking out your code in due time. I love collaboration and sharing work with one another, so I'm very pleased to see your work posted here. Thanks for taking time to post it!

p.s. I think you need deeper indentation in that code, 32 spaces just isn't enough! lol, I joke, I joke! Best wishes hirsute.

_________________
@(ºoº)@ ><}}}º> ~(^.^) <:3 )~
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hirsute



Joined: May 15, 2008
Posts: 3
Location: Ireland

PostPosted: Sat May 17, 2008 8:42 am    Post subject: Reply with quote  Mark this post and the followings unread

yeah.... Laughing

The indentations are a result of copy/pasting between text editors with different tab widths, and with vim doing silly things with whitespaces instead of tabbing it out Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [14 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to: