Sound Blocks

Musical Notes

{"func":"blockSoundPlayDrum"}

Play Drum

"Play Drum" plays the specified kind of drum for the specified number of beats.

Parameters:

Drum type: this parameter is the type of drum you want to play. There are many options to choose from.

NumBeats: this parameter is the number of beats you want the drum to play for.

Related Blocks:
{"func":"blockSoundRest"} ,     {"func":"blockSoundPlayNote"} ,     {"func":"blockSoundSetInstrument"}

Sample Code:
{"func":"registerSpriteTrigger","next":{"func":"blockSoundSetVolume","values":[{"type":"number","value":"100"}],"next":{"func":"blockSoundSetTempo","values":[{"type":"number","value":"60"}],"next":{"func":"blockSoundPlayDrum","values":[{"type":"choice","value":"35 Acoustic Bass Drum"},{"type":"number","value":"0.2"}]}}}} Add to my Backpack


{"func":"blockSoundRest"}

Rest For Beats

"Rest For Beats" stops playing for the specified number of beats.

Parameters:

NumBeats: this parameter is the number of beats you want the drum to rest for.

Related Blocks:
{"func":"blockSoundPlayDrum"} ,     {"func":"blockSoundPlayNote"} ,     {"func":"blockSoundSetInstrument"}

Sample Code:
{"func":"blockSoundChangeTempo","values":[{"type":"number","value":"20"}],"next":{"func":"blockSoundRest","values":[{"type":"number","value":"0.2"}],"next":{"func":"blockSoundSetInstrument","values":[{"type":"choice","value":"1 Acoustic Grand Piano"}],"next":{"func":"blockSoundPlayNote","values":[{"type":"number","value":"60"},{"type":"number","value":"10"}]}}}} Add to my Backpack


{"func":"blockSoundPlayNote"}

Play Note

"Play Note" plays the specified note for the specified number of beats.

Parameters:

Note: this parameter is a note, indicated by a number. The higher the number, the higher the note.

NumBeats: this parameter is the number of beats you want to note to play.

Related Blocks:
{"func":"blockSoundPlayDrum"} ,     {"func":"blockSoundRest"} ,     {"func":"blockSoundSetInstrument"}

Sample Code:
{"func":"blockSoundChangeTempo","values":[{"type":"number","value":"20"}],"next":{"func":"blockSoundRest","values":[{"type":"number","value":"0.2"}],"next":{"func":"blockSoundSetInstrument","values":[{"type":"choice","value":"1 Acoustic Grand Piano"}],"next":{"func":"blockSoundPlayNote","values":[{"type":"number","value":"60"},{"type":"number","value":"10"}]}}}} Add to my Backpack


{"func":"blockSoundSetInstrument"}

Set Instrument

"Set Instrument" sets the current instrument to the instrument specified by the parameter.

Parameters:

Instrument: you have many instrument options to choose from for this parameter, including "Acoustic Grand Piano," "Xylophone," "Percussive Organ," and more.

Related Blocks:
{"func":"blockSoundPlayDrum"} ,     {"func":"blockSoundRest"} ,     {"func":"blockSoundPlayNote"}

Sample Code:
{"func":"blockSoundChangeTempo","values":[{"type":"number","value":"20"}],"next":{"func":"blockSoundRest","values":[{"type":"number","value":"0.2"}],"next":{"func":"blockSoundSetInstrument","values":[{"type":"choice","value":"1 Acoustic Grand Piano"}],"next":{"func":"blockSoundPlayNote","values":[{"type":"number","value":"60"},{"type":"number","value":"10"}]}}}} Add to my Backpack


{"func":"blockSoundChangeTempo"}

Change Tempo

"Change Tempo" changes the project’s tempo to the specified number of beats per minute.

Parameters:

Tempo Change: the tempo will increase by this number. Use a negative number to make the tempo slower.

Related Blocks:
{"func":"blockSoundSetTempo"} ,     {"func":"valueSoundTempo"}

Sample Code:
{"func":"blockSoundChangeTempo","values":[{"type":"number","value":"20"}],"next":{"func":"blockSoundRest","values":[{"type":"number","value":"0.2"}],"next":{"func":"blockSoundSetInstrument","values":[{"type":"choice","value":"1 Acoustic Grand Piano"}],"next":{"func":"blockSoundPlayNote","values":[{"type":"number","value":"60"},{"type":"number","value":"10"}]}}}} Add to my Backpack


{"func":"blockSoundSetTempo"}

Set Tempo

"Set Tempo" sets the project’s tempo to the specified number of beats per minute.

Parameters:

BPM: the tempo will be set to this parameter, a number that indicates how many beats per minute your instruments should play.

Related Blocks:
{"func":"blockSoundChangeTempo"} ,     {"func":"valueSoundTempo"}

Sample Code:
{"func":"registerSpriteTrigger","next":{"func":"blockSoundSetVolume","values":[{"type":"number","value":"100"}],"next":{"func":"blockSoundSetTempo","values":[{"type":"number","value":"60"}],"next":{"func":"blockSoundPlayDrum","values":[{"type":"choice","value":"35 Acoustic Bass Drum"},{"type":"number","value":"0.2"}]}}}} Add to my Backpack


{"func":"valueSoundTempo"}

Tempo

"Tempo" returns the current project"s tempo.

Parameters:

None.

Related Blocks:
{"func":"blockSoundChangeTempo"} ,     {"func":"blockSoundSetTempo"}

Sample Code:
{"func":"blockControlForever","containers":[{"func":"blockSoundChangeTempo","values":[{"type":"number","value":"20"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueSoundTempo"},{"type":"string","value":"60"}]}],"containers":[{"func":"blockSoundSetTempo","values":[{"type":"number","value":"10"}]}]}}]} Add to my Backpack


Sounds

{"func":"blockSoundPlayUntilDone"}

Play Sound Until Done

"Play Sound Until Done" plays the specified sound and waits until it is finished before continuing the script.

Parameters:

Soundtrack: this parameter should be one of the sounds you have added to the project under the "sounds" tab.

Related Blocks:
{"func":"blockSoundPlay"} ,     {"func":"blockSoundStopAll"}

Sample Code:
{"func":"registerSpriteTrigger","next":{"func":"blockSoundPlayUntilDone","values":[{"type":"string","value":"female laugh"}]}} Add to my Backpack


{"func":"blockSoundPlay"}

Play Sound

"Play Sound" block plays the specified sound while the current script is executing.

Parameters:

Soundtrack: this parameter should be one of the sounds you have added to the project under the "sounds" tab.

Related Blocks:
{"func":"blockSoundPlayUntilDone"} ,     {"func":"blockSoundStopAll"}

Sample Code:
{"func":"registerBackgroundChange","values":[{"type":"string","value":"Game Over"}],"next":{"func":"blockSoundPlay","values":[{"type":"string","value":"gamesound8"}]}} Add to my Backpack


{"func":"blockSoundStopAll"}

Stop All Sounds

"Stop All Sounds" stops playing every sound in the current program.

Parameters:

None.

Related Blocks:
{"func":"blockSoundPlay"} ,     {"func":"blockSoundPlayUntilDone"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"Game Over"}],"next":{"func":"blockSoundStopAll"}} Add to my Backpack


{"func":"blockSoundChangeVolume"}

Change Volume

"Change Volume" increments the volume by the number specified.

Parameters:

Volume Change: "Change Volume" will increment the volume by the number specified by this parameter. Use a negative number to make the volume lower.

Related Blocks:
{"func":"blockSoundSetVolume"} ,     {"func":"valueSoundVolume"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockControlRepeatUntil","values":[{"type":"wrapper","func":"valueOpNot","values":[{"type":"wrapper","func":"valueVar","name":"Playing"}]}],"containers":[{"func":"blockSoundChangeVolume","values":[{"type":"number","value":"1"}]}]}} Add to my Backpack


{"func":"blockSoundSetVolume"}

Set Volume

"Set Volume" sets the volume as the specified percentage.

Parameters:

Percentage: this parameter is the percentage by which the volume will increase. Use a number below 100 to decrease the volume.

Related Blocks:
{"func":"blockSoundChangeVolume"} ,     {"func":"valueSoundVolume"}

Sample Code:
{"func":"registerSpriteTrigger","next":{"func":"blockSoundSetVolume","values":[{"type":"number","value":"100"}],"next":{"func":"blockSoundSetTempo","values":[{"type":"number","value":"60"}],"next":{"func":"blockSoundPlayDrum","values":[{"type":"choice","value":"35 Acoustic Bass Drum"},{"type":"number","value":"0.2"}]}}}} Add to my Backpack


{"func":"valueSoundVolume"}

Volume

"Volume" returns the project’s current volume.

Parameters:

None.

Related Blocks:
{"func":"blockSoundChangeVolume"} ,     {"func":"blockSoundSetVolume"}

Sample Code:
{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueSoundVolume"},{"type":"string","value":"100"}]}],"containers":[{"func":"blockSoundSetVolume","values":[{"type":"number","value":"0"}]}]} Add to my Backpack