Squeak

 

Recording sound

Page history last edited by aikidave 3 yrs ago

I would love to add some more sounds to the e-toy tools.

(dog barking and dice being thrown)

Please could a kind soul direct me some doco about how to do this

 

It's pretty easy. In the Widgets flap, there is a

recording tool. Record your sound using that. (You can use Trim

from here to remove silence at start/end.) When you choose the

button "Tile," you'll be queried for a name. You can now use that

name (and even that tile!) wherever you need that sound.


There are two ways you can do this. First, you can use the Squeak sound

recorder (create a "RecordingControlsMorph" from the object palette or

the alphabetical "new morph..." menu). Plug in a microphone or use the one

built into your computer--many laptops have built-in mics. Click on the

"Record" button, make a sound, click the "Stop" button, then click "Play"

to see if you got what you wanted. You might need to adjust the record

level slider. You can use the "Trim" button to get rid of leading or trailing

silence. Finally, click the "Tile" button. You will be prompted for a name

for the sound. The sound will be added to the sound library with this name.

You can then delete the tile that was created and the sound will remain

in the library. To make it persist, you'll need to save the image using

the "save" command in the world menu. (The sound library lives in

the Squeak image file; if you quit the image without saving it, any sounds

you've added in that session disappear.)

 

Second, if you're comfortable typing some Squeak code and if you've

got the sounds you want in an AIFF file, you can execute the following:

 

SampledSound

addLibrarySoundNamed: 'bark'

fromAIFFfileNamed: 'bark.aif'.

 

If your sound is in a WAV file, you can execute:

 

snd := SampledSound fromWaveFileNamed: 'bark.wav'.

SampledSound

addLibrarySoundNamed: 'bark'

samples: snd samples

samplingRate: snd originalSamplingRate.

 

To use the above, open a "workspace" window, paste the code into it,

and edit it to use you file name and sound name. Then select all the lines

of code and select "do it (d)" from the workspace menu. The "(d)" means

you can also use "alt-D" (Win) or "cmd-D" (Mac) as a keyboard shortcut.

 

Again, you must save your image to make these additions persist. You should

keep a backup copy of the original image just in case you need to go back to it.

Comments (0)

You don't have permission to comment on this page.