#7 2011-03-16 15:59:25

YourLocalBlockLib
Scratcher
Registered: 2011-03-10
Posts: 100+

Re: ITopic: Welcome to your local block library!

Sound
/img/tinypic/9j0lcg.jpg

/img/dropbox/BlockLibDiv2.png

/img/weebly/6788609.gif
Shared by PlayWithFire
blockspec:

('import sound' #- #importSound)

no code needed

What this block does:
This block allows you to import a sound.

/img/dropbox/BlockLibDiv2.png

/img/weebly/1370892.gif
Shared by Sparks
blockspec:

('record sound' #- #recordSound)

no code needed

What it does:
Opens the sound recording window and lets you record a sound.

/img/dropbox/BlockLibDiv2.png

/img/weebly/2083497.gif
Shared by Pecola1
blockspec:

('length of %S' #r #lengthOfSound:)

Code:

Code:

lengthOfSound: t1 
    | t2 |
    t2 _ self soundNamed: t1 ifAbsent: [^ 0].
    ^ t2 totalSeconds

What this block does:
Reports the amount of seconds it would take to play the sound in the insert.

/img/dropbox/BlockLibDiv2.png

/img/weebly/5111682.gif
Shared by Pecola1
blockspec:

('play from %n to %n secs of %S' #- #playFrom:to:ofSound:)

Code:

Code:

playFrom: t1 to: t2 ofSound: t3 
    | t4 |
    t4 _ self soundNamed: t3 ifAbsent: [^ self].
    t4 playFrom: t1 to: t2

What this block does:
Plays a sound from the first insert to the second insert. Note: It does not wait for the sound to end for it to change to another block.

/img/dropbox/BlockLibDiv2.png

/img/blocksapi/beep.png
Shared by meew0
blockspec:

('beep' #- #beep)

Code:
no code needed

/img/dropbox/BlockLibDiv2.png

/img/polyeztahpuppies/soundamount.gif Shared by Greenatic
Blockspec:

('number of sounds' #r #SoundAmount)

Code:

SoundAmount
    | t1 |
    t1 _ 0.
    media do: [:t2 | t2 isSound ifTrue: [t1 _ t1 + 1]].
    ^ t1

What it does:
Reports the number of sounds the sprite/stage has (not the total for the whole project).

/img/dropbox/BlockLibDiv2.png

^ Back to Scratch Blocks
^ Back to Contents
 

Last edited by YourLocalBlockLib (2011-12-17 14:58:26)


/img/dropbox/BlockLibraryTitle.png

Offline