Pages: 1
Topic closed
I have just posted a simple project called Pianichi.
But, I am not satisfied with it.
It is very simple.
[blocks]
<when[ ]key pressed>
<play note( )for( )secss>
[/blocks]
However, the duration of each note is fixed.
In fact what I want is that the note sounds while key remains pressed and stops when it will be released.
Is it possible todo that?
I have done some tests using a variable for beats and putting it to zero with another thread script, but without success.
Last edited by samaga (2009-04-09 11:04:00)
Offline
You can probably make it work by having the note play for a very long time - and then interrupt it with a Stop All Sounds when the key is released. Similar to this project
http://scratch.mit.edu/projects/Paddle2SeeFixIt/431745
Offline
Thank you Paddle2See,
but that will stop abrupty all sounds you were playing at this moment.
I want to stop only this sound.
(You can be playing some notes and a time and only want to stop one).
Also this an abrupt stop. In fact I want the final of the note to be soft, like a real piano.
Maybe that is not possible...
Last edited by samaga (2009-04-09 10:07:20)
Offline
Hi samaga,
I usually get around the problem you're describing by calling the stack with the unfinished note again. Let me give you an example:
Make one stack play a (variable) note for a long time:
when I receive 'play note'
play note (variable) for 10 beats
Make another stack call the 'play note' stack, even if it is not finished yet:
when I receive 'play song'
set 'index' to 0
repeat (length of 'song')
change 'index' by 1
set 'variable' to (item 'index' of 'song')
broadcast 'play note'
rest (item 'index' of 'durations')
end
Offline
Topic closed
Pages: 1