sound on keypress??
sound on keypress??
(OP)
hi i am trying to create something that acts as a kind of midi keyboard but using a conventional ascii keyboard. I have so far worked out how to call up sounds on keypress using this:
on keydown me
if "1" = the key then
sound(2).play(member("edgyrockguitar"))
else if "2" = the key then
sound(3).play(member("ambientguitar 3"))
and so on
i want to know if it is possible to keep a sound playing for the length of the keypress (i.e. like on an organ)
any ideas?????
much appreciated
on keydown me
if "1" = the key then
sound(2).play(member("edgyrockguitar"))
else if "2" = the key then
sound(3).play(member("ambientguitar 3"))
and so on
i want to know if it is possible to keep a sound playing for the length of the keypress (i.e. like on an organ)
any ideas?????
much appreciated
RE: sound on keypress??
I think if you can figure out how to get the sound to loop on keyDown then stop looping on keyUp that may be the best way to do it?
perhaps:
on keydown me
if "1" = the key then
sound(2).play(member("edgyrockguitar"))
repeat/loop??
end if
end
on keyUp me
if "1" = the key then
sound(2).stop(member("edgyrockguitar"))
end if
end
Sorry i couldnt be anymore specific, someone else will no doubt reply, but im only a beginner but theoretically i think thats the right sort of idea...
Peter Butler
Tandokuno Design
RE: sound on keypress??
Kenneth Kawamoto
www.materiaprima.co.uk
RE: sound on keypress??
Thanks for the input, im sure that will help!!
Useful thing to learn too i didnt know you could do that >_>
Peter Butler
Tandokuno Design
RE: sound on keypress??
on keydown me
if "1" = the key then
sound(2).play(member("edgyrockguitar"))
end if
end
on keyUp me
if "2"= the key then
sound(2).stop(member("edgyrockguitar"))
end if
end
but it doesnt work it replays the sound from the start on every press and the loop/repeat idea that goes below the .play section doesnt work either (script error)????>?
RE: sound on keypress??
--
on startMovie
sound(2).queue([#member: member("edgyrockguitar"), #loopCount: 0])
end startMovie
on keyDown
if the key = "1" then
sound(2).play()
end if
end
on keyUp
if the key = "1" then
sound(2).pause()
end if
end
--
Kenneth Kawamoto
www.materiaprima.co.uk
RE: sound on keypress??
variable used beor assigned a value
RE: sound on keypress??
Kenneth Kawamoto
www.materiaprima.co.uk
RE: sound on keypress??
RE: sound on keypress??
-- Movie script
on startMovie
sound(2).queue([#member: member("edgyrockguitar"), #loopCount: 0])
the keyDownScript = "handleMousedown"
the keyUpScript = "handleKeyUp"
end startMovie
on handleMousedown
if the key = "1" then
sound(2).play()
end if
end handleMousedown
on handleKeyUp
if the key = "1" then
sound(2).pause()
end if
end handleKeyUp
--
Kenneth Kawamoto
www.materiaprima.co.uk
RE: sound on keypress??
RE: sound on keypress??
Funny thing is that there are no variables in that line. Do you see the words "sound", "queue", "member" and "loopCount" all in green? Then they are not variables.
May be your Director itself is the problem. If you type in "put version" in the message window do you get "8.5.1"? If not, update.
Kenneth Kawamoto
www.materiaprima.co.uk
RE: sound on keypress??
RE: sound on keypress??
Anyway I tested on D10 and the script works fine (however, "the key" should be "_key.key" in D10).
If you copy & paste sound(2).queue([#member: member("edgyrockguitar"), #loopCount: 0]) into Message window and press return, do you get the same error?
Kenneth Kawamoto
www.materiaprima.co.uk