Change () Effect by ()
change [pitch v] effect by ()
Category Sound
Type Stack
Introduced in 3.0
This article is about the Sound block. For the Looks block, see Change () Effect by () (Looks block).

The Change () Effect by () block is a Sound block and a stack block that was released in Scratch 3.0. It changes the Sound Effect chosen by the amount specified. This will be changed for all sounds played in the sprite.

Drop-Down Menu

The Change () Effect by () block has a drop-down menu. The options for the Change () Effect by () block's drop-down menu are pan left/right and pitch. The input is for selecting how much the sound will be changed.

Pitch

When pitch is selected, it will change the pitch of the sound played. If negative, this block will lower the pitch of sounds played, if positive, it will raise the pitch.

Pan Left/Right

This shifts sound to the left or right side of the speaker. It is best heard with headphones. When pan left/right is selected, it will change the side the sound is being played from. If negative, it will play the sound more in the left speaker, if positive, it will play the sound more in the right speaker. This is called a stereo effect, sometimes called a "3D sound".

Uses

These are some common uses for this block:

  • Changing the pitch of sounds
change [pitch v] effect by (30):: sound
play sound (Boing v) until done
change [pitch v] effect by (-60):: sound
play sound (Boing v) until done
  • Playing sounds in different ears
change [pan left/right v] effect by (-100):: sound
play sound (Boing v) until done
change [pan left/right v] effect by (200):: sound
play sound (Meow v) until done
  • Playing a sound and change the ear where it plays as the sound continues
start sound (Cool Jazz BGM v)
change [pan left/right v] effect by (-100):: sound
wait (1) secs
change [pan left/right v] effect by (200):: sound
// one can repeat this as many times as they like or put the code in a loop until the music ends

Workaround

This block can be worked around by using variables to save the value of the Sound Effect wanted:

define set pitch to (number1)
set [pitch v] to (number1)
if <(pitch) < [-360]> then
set [pitch v] to [-360]
end
if <(pitch) > [360]> then
set [pitch v] to [360]
end
set [pitch v] effect to (pitch)
define change pitch by (number1)
set pitch to ((pitch) + (number1))

This can also be done for the pan left/right effect, just with different bounds.

See Also