Sound
Extension Description
Sound blocks are related to playing various sounds, whether they be MIDI notes or saved sounds.
- Available in: Block Coding, Python Coding
- Mode: Stage Mode
- WiFi Required: No
- Compatible Hardware in Block Coding: evive, Quarky, Arduino Uno, Arduino Mega, Arduino Nano, ESP32, T-Watch, Boffin, micro:bit, TECbits, LEGO EV3, LEGO Boost, LEGO WeDo 2.0, Go DFA, None
- Compatible Hardware in Python: evive, Quarky, Arduino Uno, Arduino Mega, Arduino Nano, ESP32, T-Watch, Boffin, micro:bit, TECbits, LEGO EV3, LEGO Boost, LEGO WeDo 2.0, Go DFA, None
- Object Declaration in Python: sprite = Sprite("Sprite-Name")
- Extension Catergory: Default
Introduction
Sound is one of the ten categories of default Scratch blocks. They are color-coded pink/magenta and are used to control sound (and formerly MIDI) functions.
Sounds are used for many things, and many different types are used. Sounds effects may be used in games, and music can be used in the background or as part of an intro or outro.
Read More
PictoBlox Blocks
All articles loaded
No more articles to load
Python Functions
The function will play the specified sound, pausing its script until the sound has finished playing.
Syntax: playuntildone(sound_name = “Grunt”)
The function will play the specified sound, with no pause to its script.
Syntax: play(sound_name = “Grunt”)
The function will stop any sounds currently being played on all sprites and the Stage. Pressing the Stop button will also stop all sounds, but is rarely used as it also stops all the other scripts running in the project.
Syntax: stopallsounds()
The function changes the specified sound effect by the values. The input is for selecting how much the sound will be changed. A positive number will make the sound effect have more effect, while a negative number will make it smaller.
Syntax: changesoundeffect(effect_name = “PITCH”, effect_value = 10)
The function changes the specified sound effect to the value. The input is for selecting how much the sound will be changed. A positive number will make the sound effect have more effect, while a negative number will make it smaller.
Syntax: setsoundeffect(effect_name = “PITCH”, effect_value = 100)
The function clears any sound effects currently in place. However, it does not stop the sound currently being played.
Syntax: clearsoundeffects()
The function changes the volume of a sprite by the specified amount.
Syntax: changevolume(volume = -10)
The function sets its sprite’s volume to the specified amount. It only affects the sprite (or the Stage) that the block is in.
Syntax: setvolumeto(volume = 100)
The function holds a sprite’s or the Stage’s volume. This block can be displayed as a Stage monitor.
Syntax: setvolume()
All articles loaded
No more articles to load
Python Coding Examples
All articles loaded
No more articles to load
Table of Contents