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 

pitch or roll to midi-note??
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie
View previous topic :: View next topic  
Author Message
jjcomet



Joined: 23 Apr 2007
Posts: 87

Digg It
PostPosted: Thu May 03, 2007 10:24 pm    Post subject: pitch 2 midi

I do appreciate your assistance, and accept that I am new to the forum; however
1. I would put my script up 'like everyone else' if there was guidance on how to do it. How did you post your very first scripts I wonder?
2. Oooh, sh*t, I've just seen the Quote button! is that it? sorry no.1!
3. I wasn't at my laptop when I wrote that last 'script' and you're right, it was a wee bit naughty; sorry no.2!
5. What happened to 4; and finally
4. Ah, there it is


Here's the working script

Quote:
midi.DeviceOut=2//my setting

Wiimote.Leds = 15

var.note = MapRange(Wiimote.Pitch, -90, 90, 0, 100)

if pressed (var.note <5) then
midi.C5 = false
endif

//var.note 'ranges' hereafter allow a gap between each note-sector

if pressed (var.note >=5 and var.note <=24) then
midi.C5 = true
midi.D5 = false
midi.E5 = false
midi.F5 = false
debug = "C"
wait 200ms
endif

if pressed (var.note >24 and var.note <28) then
midi.C5 = false
midi.D5 = false
endif

if pressed (var.note >=28 and var.note <=48) then
midi.C5 = false
midi.D5 = true
midi.E5 = false
midi.F5 = false
debug = "D"
wait 200ms
endif

if pressed (var.note >48 and var.note <52) then
midi.D5 = false
midi.E5 = false
endif


if pressed (var.note >=52 and var.note <=75) then
midi.C5 = false
midi.D5 = false
midi.E5 = true
midi.F5 = false
wait 200ms
debug = "E"
endif

if pressed (var.note >75 and var.note <79) then
midi.E5 = false
midi.F5 = false
endif

if pressed (var.note >79 and var.note <95) then
midi.C5 = false
midi.D5 = false
midi.E5 = false
midi.F5 = true
wait 200ms
debug = "F"
endif

if pressed (var.note >95) then
midi.F5 = false
endif

this one does work
best wishes and thanks again





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



Joined: 18 Feb 2007
Posts: 121

Digg It
PostPosted: Fri May 04, 2007 3:41 am    Post subject:

very nice work. ive tried it out and it does the job!

maybe add in so that if you press a button it will become midi c or midi b etc.
Maybe take out the midi.DeviceOut=2 if you want it to work on other people's computer, as i dont have a second midi output device, and not sure what others have.

Not to be too annoying Smile but
Quote:
How did you post your very first scripts I wonder?


http://www.wiili.org/forum/wiipc-v331-with-gui-the-most-powerful-media-remote-t1528.html#9125

Any way, I like what you've done and hope you continue working on it!
Back to top
View user's profile Send private message
jjcomet



Joined: 23 Apr 2007
Posts: 87

Digg It
PostPosted: Fri May 04, 2007 12:58 pm    Post subject: pitch to midinote

Thanks, I'm still tweaking that one; saw your 'first-script' link, wow, lots of expertise in there. I'm using the wiimote only for basic mouse control and as a midi-controller, so it's beyond my needs (and knowledge). Sort of on that topic, does the syntax exist to ensure that movement on one axis prevents movement on another; meaning if the wiimote is 'pitching' then roll is 'silenced', and vice-versa. I've trawled this site, and I've tried this:
Quote:

midi.ByteControl100=MapRange(Wiimote.SmoothRoll,-90,90,0,127)/127

midi.ByteControl101=MapRange(Wiimote.SmoothPitch,-90,90,0,127)/127

if Wiimote.SmoothRoll>0 then
Wiimote.SmoothPitch=0
endif

if Wiimote.SmoothPitch>0 then
Wiimote.SmoothRoll=0
endif


without success; I'm guessing that the problem lies in the if statements; and the inconsistencies in human hand-control,
thanks for any advice you can offer
Brendan
Back to top
View user's profile Send private message
tic



Joined: 18 Feb 2007
Posts: 121

Digg It
PostPosted: Fri May 04, 2007 5:15 pm    Post subject:

Quote:
Sort of on that topic, does the syntax exist to ensure that movement on one axis prevents movement on another


I dont think thats possible, but I dont think its necessary either. In your if loops, just include the dimensions you wish, and not the other, in that way it only looks at which one you want.

Code:
if Wiimote.SmoothRoll > 0 and Wiimote.SmoothPitch < 0
//code goes here
endif


so just put in the values you want into each variable, using "and", "and not" and "or"

You cant actually physically prevent movement on an axis in your script, as you are doing it and the program cant control what your hand does! Smile but you can filter it out with loops
Back to top
View user's profile Send private message
jjcomet



Joined: 23 Apr 2007
Posts: 87

Digg It
PostPosted: Sat May 05, 2007 8:45 am    Post subject:

thanks
sorry to be a dunce, but do i include the cc# like this:

Quote:

midi.ByteControl101 = MapRange(Wiimote.SmoothPitch//...whatever
midi.ByteControl100 = MapRange(Wiimote.SmoothRoll//...etc

if Wiimote.SmoothRoll > 0 and Wiimote.SmoothPitch < 0 then

//would it be midi.ByteControl100 = true
//analog functions can't be true or false can they?
endif


i found the mouse-script with the precision and sensitivity settings i mentioned earlier; i'll try to adapt and implement it, then post the result if i have any success
thanks again
Back to top
View user's profile Send private message
tic



Joined: 18 Feb 2007
Posts: 121

Digg It
PostPosted: Sat May 05, 2007 4:31 pm    Post subject:

What are you wanting this script to so? I might be able to help better if I know the what you want the outcome to be. If youre trying to make a accel mouse using maprange, I wouldnt recommend it. I made 1 as a test and found that it was too jerky, and I couldnt add in smoothing, as this would make it very annoying when youre movin gin 1 direction and then change to the other direction, it will average with that, so will slightly move in the wrong direction before it moves in the correct direction.
Back to top
View user's profile Send private message
jjcomet



Joined: 23 Apr 2007
Posts: 87

Digg It
PostPosted: Sat May 05, 2007 10:51 pm    Post subject: pitch to midi note

Thanks for getting back
what I'm trying to achieve is one midi controller on the X axis and then another midi controller on the Y axis. I have already successfully completed this script, thanks to this forum; but i've just found it a bit frustrating that if I raise the wiimote (Y axis) then there will be slight movement in the X axis too; I would like to be able to ensure that movement in one axis prevents transmission/reception of data in the other. It's no biggy; but any advice you can offer would, as usual, be gratefully received
best
Brendan
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
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
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