This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-04-10 10:19:13

jakec9
New Scratcher
Registered: 2011-04-07
Posts: 2

tone generator?

I'm working on creating a tone generator. When the user clicks on a sprite, I would like for a sound to play until the user releases the mouse button. Any suggestions would be greatly appreciated... thanks in advance!

Offline

 

#2 2011-04-10 13:45:08

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: tone generator?

Hm, I don't think there's any way to play an indefinite sound in Scratch. You can play a note using the sound blocks, but you need a defined time, and it fades out.  hmm


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#3 2011-04-10 14:41:17

Clank23
Scratcher
Registered: 2011-03-01
Posts: 1000+

Re: tone generator?

when sprite clicked
Reapeat until not mouse down and touching mouse pointer
playsound:
stop all sounds


http://img846.imageshack.us/img846/4333/signaturely.png

Offline

 

#4 2011-04-10 15:25:29

jakec9
New Scratcher
Registered: 2011-04-07
Posts: 2

Re: tone generator?

Thanks for the tips! It's not working out, though. The script looks like

<when[ cat ]clicked>
<repeat until>
<<  <not> <mouse down?> <<  <and>>> <touching[ mouse-pointer? >>
<play sound[ tone
<stop all sounds>

The stop all sounds is after the "repeat until" block.

What am I missing?

Offline

 

#5 2011-04-10 17:09:16

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: tone generator?

jakec9 wrote:

Thanks for the tips! It's not working out, though. The script looks like

<when[ cat ]clicked>
<repeat until>
<<  <not> <mouse down?> <<  <and>>> <touching[ mouse-pointer? >>
<play sound[ tone
<stop all sounds>
[/blocks]
The stop all sounds is after the "repeat until" block.

What am I missing?

Try making "Play sound Tone" into "Play sound Tone until done" (the block directly beneath it).

Last edited by Kileymeister (2011-04-10 17:09:24)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

Board footer