WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Nunchuk - ouptut 8 midi messages

 
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie
View previous topic :: View next topic  
Author Message
dchild



Joined: 17 May 2007
Posts: 18

Digg It
PostPosted: Fri May 25, 2007 4:01 pm    Post subject: Nunchuk - ouptut 8 midi messages

I'm trying to customise the script below so that it can output 8 midi messages. Can someone explain how i can do this?


Quote:


//no buttons held - top row of clips
if (var.nunJoyX < -.90 and var.nunJoyY < .2 and not var.nunC and not var.nunZ and not wiimote1.Two)
midi.c4 = true
endif
if (var.nunJoyX > -.80 and var.nunJoyX < -.2 and var.nunJoyY < -.6 and var.nunJoyY > -.9 and not var.nunC and not var.nunZ and not wiimote1.Two )
midi.d4 = true
endif
if (var.nunJoyX > -.20 and var.nunJoyX < 0.2 and var.nunJoyY < -.8 and var.nunJoyY < -.8 and not var.nunC and not var.nunZ and not wiimote1.Two )
midi.e4 = true
endif
if (var.nunJoyX < 0.90 and var.nunJoyX > 0.2 and var.nunJoyY < -.5 and var.nunJoyY > -.9 and not var.nunC and not var.nunZ and not wiimote1.Two )
midi.f4 = true
endif
if (var.nunJoyX > .90 and var.nunJoyY < .2 and not var.nunC and not var.nunZ and not wiimote1.Two)
midi.g4 = true
endif

Back to top
View user's profile Send private message
R.Legault



Joined: 24 Feb 2007
Posts: 111

Digg It
PostPosted: Fri May 25, 2007 10:27 pm    Post subject:

You really didn't really need to post a new topic...

In your script you only have 5 conditions and you want to play eight notes... Instead of posting the code it would be easier if you just said what 8 conditions you want to be able to play each note.

Alright lets take a look at your script. Firstly is there a reason why you have:
"and not var.nunC and not var.nunZ and not wiimote1.Two"
in every single if statement
Do you plan on using the buttons to toggle between notes or is this just part of a bigger script?

Anyway you can simplify your code by using nested ifs (I am assuming all of the joystick values you've defined all specify a separate case so I have used elseifs.. it would make it easier to know what each if statement is for if you commented your code)

Anyway here is your script with a few changes:

Code:
var.nunJoyX = Wiimote.Nunchuk.JoyX
var.nunJoyY = Wiimote.Nunchuk.JoyY

if (Wiimote.nunchuk.CButton = false) and (Wiimote.nunchuk.ZButton = false) and (Wiimote.Two = false)
   
   if (var.nunJoyX < -.90 and var.nunJoyY < .2)
      midi.c4 = true
      wait 500ms
      midi.c4 = false
   elseif (var.nunJoyX > -.80 and var.nunJoyX < -.2 and var.nunJoyY < -.6 and var.nunJoyY > -.9)
      midi.d4 = true
      wait 500ms
      midi.d4 = false

   elseif (var.nunJoyX > -.20 and var.nunJoyX < 0.2 and var.nunJoyY < -.8 and var.nunJoyY < -.8)
      midi.e4 = true
      wait 500ms
      midi.e4 = false

   elseif (var.nunJoyX < 0.90 and var.nunJoyX > 0.2 and var.nunJoyY < -.5 and var.nunJoyY > -.9)
      midi.f4 = true
      wait 500ms
      midi.f4 = false

   elseif (var.nunJoyX > .90 and var.nunJoyY < .2)
      midi.g4 = true
      wait 500ms
      midi.g4 = false
   elseif (0.7 < var.nunJoyX < .90 and var.nunJoyY > .2)
      midi.g5 = true
      wait 500ms
      midi.g5 = false
   elseif (0.5 < var.nunJoyX < .70 and var.nunJoyY > .5)
      midi.g6 = true
      wait 500ms
      midi.g6 = false
   elseif (0 < var.nunJoyX < .5 and var.nunJoyY > .8)
      midi.g7 = true
      wait 500ms
      midi.g7 = false

   endif
/* //Other button combinations (if that is what you are planning on using to select which notes to play) each of which could play a different combination of the notes like the above code
elseif (var.nunJoyX < -.90 and var.nunJoyY < .2)
      midi.c1 = true
      wait 500ms
      midi.c1 = false
   elseif (var.nunJoyX > -.80 and var.nunJoyX < -.2 and var.nunJoyY < -.6 and var.nunJoyY > -.9)
      midi.d1 = true
      wait 500ms
      midi.d1 = false
   elseif (var.nunJoyX > -.20 and var.nunJoyX < 0.2 and var.nunJoyY < -.8 and var.nunJoyY < -.8)
      midi.e1 = true
      wait 500ms
      midi.e1 = false
   elseif (var.nunJoyX < 0.90 and var.nunJoyX > 0.2 and var.nunJoyY < -.5 and var.nunJoyY > -.9)
      midi.f1 = true
      wait 500ms
      midi.f1 = false

   elseif (var.nunJoyX > .90 and var.nunJoyY < .2)
      midi.g1 = true
      wait 500ms
      midi.g1 = false
   elseif (0.7 < var.nunJoyX < .90 and var.nunJoyY > .2)
      midi.g2 = true
      wait 500ms
      midi.g2 = false
   elseif (0.5 < var.nunJoyX < .70 and var.nunJoyY > .5)
      midi.g3 = true
      wait 500ms
      midi.g3 = false
   elseif (0 < var.nunJoyX < .5 and var.nunJoyY > .8)
      midi.g4 = true
      wait 500ms
      midi.g4 = false
   endif

elseif (Wiimote.nunchuk.CButton =false) and (Wiimote.nunchuk.ZButton = true) and (Wiimote.Two = false)

elseif (Wiimote.nunchuk.CButton = false) and (Wiimote.nunchuk.ZButton = false) and (Wiimote.Two = true)

elseif (Wiimote.nunchuk.CButton = true) and (Wiimote.nunchuk.ZButton = true) and (Wiimote.Two = false)

elseif (Wiimote.nunchuk.CButton = true) and (Wiimote.nunchuk.ZButton = false) and (Wiimote.Two = true)

elseif (Wiimote.nunchuk.CButton = false) and (Wiimote.nunchuk.ZButton = true) and (Wiimote.Two = true)
*/
endif


Really this method isn't really that great as the angle of the thumbstick is just a guess... The other script I posted should separate notes by the same angles which I think is a much better way of doing it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group