Discuss Scratch

Mandslo_bird
Scratcher
3 posts

I am trying to make a piano where it plays the note until you let go of the key

The “Music” code pack has “play note _ for _ beats” and there is nothing that allows it to play the note until I release the key I am pressing, I have tried many things and can not figure anything out.

The blocks in the “music” pack are very limited and I have no idea if it is even possible to play a note ONLY when the key is held down and ONLY while it is being held down.

Last edited by Mandslo_bird (Dec. 5, 2024 20:42:46)

Mandslo_bird
Scratcher
3 posts

I am trying to make a piano where it plays the note until you let go of the key

Last edited by Mandslo_bird (Dec. 5, 2024 20:41:57)

Paddle2See
Scratch Team
1000+ posts

I am trying to make a piano where it plays the note until you let go of the key

I think I was sort of able to get that to work by playing the note for a very long time - and then using the “Stop all Sounds” block triggered by the key being released. Of course - you can't use that technique for a polyphonic piano.
Mandslo_bird
Scratcher
3 posts

I am trying to make a piano where it plays the note until you let go of the key

Paddle2See wrote:

I think I was sort of able to get that to work by playing the note for a very long time - and then using the “Stop all Sounds” block triggered by the key being released. Of course - you can't use that technique for a polyphonic piano.
Could you show an example? I am doing this for a school assignment and don't have as much experience with scratch as I would like lol

Last edited by Mandslo_bird (Dec. 6, 2024 03:42:59)

BlazedYoutube
Scratcher
3 posts

I am trying to make a piano where it plays the note until you let go of the key

Simply add
stopallsounds
nembence
Scratcher
100+ posts

I am trying to make a piano where it plays the note until you let go of the key

Paddle2See wrote:

I think I was sort of able to get that to work by playing the note for a very long time - and then using the “Stop all Sounds” block triggered by the key being released. Of course - you can't use that technique for a polyphonic piano.
This actually doesn't work:
whenclickedsetinstrumentto(20) Synth Lead Synth Lead doesn't fade so it's easy to hear when it stops playingplaynote60for2beatswhenclickedwait0.2secondsstopallsounds when this script stops the sound still continues

To be able to stop the sound make it using a sounds block:
whenclickedsetpitcheffectto10*-9 C(60) is 9 semitones lower than A(69)playsoundA Pianountildone [start sound ()] block works, toowhenclickedwait0.2secondsstopallsounds
Gladius247
Scratcher
99 posts

I am trying to make a piano where it plays the note until you let go of the key

Mandslo_bird wrote:

The “Music” code pack has “play note _ for _ beats” and there is nothing that allows it to play the note until I release the key I am pressing, I have tried many things and can not figure anything out.

The blocks in the “music” pack are very limited and I have no idea if it is even possible to play a note ONLY when the key is held down and ONLY while it is being held down.
Maybe try
whenclickedforeverifkey...pressed?thenrepeatuntilnotkey...pressed?playnote...for...beatslong
?
Or if you meant a sprite being clicked,
whenthisspriteclickedrepeatuntilnotmousedown?andtouchingmouse pointerplaynote...for...beatslong

Powered by DjangoBB