Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I make a sprite react to music???
- Cherrii-Bloss
-
Scratcher
4 posts
How do I make a sprite react to music???
I'm trying to make a circle pulsate in time to music, anyone know any script?
- A48c
-
Scratcher
100+ posts
How do I make a sprite react to music???
I'm trying to make a circle pulsate in time to music, anyone know any script?what do you mean by react? (like dance to it?)
- AEMpizza15
-
Scratcher
42 posts
How do I make a sprite react to music???
I'm trying to make a circle pulsate in time to music, anyone know any script?Could you share the project and give me the link? Then I could look at the script and the music in general.
- hirsh001
-
Scratcher
100+ posts
How do I make a sprite react to music???
you could use the loudness block
(loudness)as the loudness increases, increase the size as the circle, or as it decreases, decrease the size of the circle.
Last edited by hirsh001 (Dec. 23, 2018 21:59:06)
- Vicream_Creator
-
Scratcher
100+ posts
How do I make a sprite react to music???
you could use the loudness blockMight just break the program completely. A sneeze? The character dances. And you need to have sound on..(loudness)as the loudness increases, increase the size as the circle, or as it decreases, decrease the size of the circle.
I'm trying to make a circle pulsate in time to music, anyone know any script?I suggest you sync the characters. Basically, “fake” the reaction. Find the beats of the music (every pop music and all follow a specific pattern, just synchronize the beats with it). And the actions between each pulse might just be random
- BereketY
-
Scratcher
500+ posts
How do I make a sprite react to music???
I had to do the same for an intro creation and I made two scripts, one that records the sprite sizes after altering it with the loudness block and another one to play the recording. For this to work, You might want to be in a very quiet room and have the song at a loud volume. I however already had an audio setting on my computer which allowed system audio to be heard without any mic input. If you want the scripts, here they are.
To play the size recording, use this script.
This is the first Script for recordingThe script above altered the size using the original size before the altering and then alters the size using the loudness.set [Original Size] to (size)
delete [all] of [size]
repeat until <(Music Over) = [1]>
add (size) to [size]
set size to ((Original Size) + (loudness)) %
end
To play the size recording, use this script.
This is the script for playing the recordingAs you might have noticed, there is a variable in the first script called “Music Over”. For that, all you need is this script.set [i] to [1]
repeat (length of [size] :: list)
set size to (item (i) of [size] :: list) %
change [i] by (1)
end
This is the script for the Music Over VariableThis should help, but make sure you are in a place where only the music can be heard. Also, note that the first script should only be used once, and the list “size” should never be cleared. Once you've finished recording, then switch to the second script. If you want, I can make a project explaining it.when I receive [Play Song]
set [Music Over] to [0]
play sound [Music] until done
set [Music Over] to [1]
Last edited by BereketY (Dec. 31, 2018 13:13:04)
- Vicream_Creator
-
Scratcher
100+ posts
How do I make a sprite react to music???
This is actually a smart way to code that! Only thing is thatset size to ((Original size) + (loudness)) %should more be likeset size to ((Smallest size) + (loudness)) %(smallest sound being like original size - 50)
since that script won't ever set size to a number under the original size, resulting in a “sound wheel” always reacting to high volumes (getting bigger) while never getting smaller than the original size (small volumes/music stopped)
- GamingForGold385
-
Scratcher
42 posts
How do I make a sprite react to music???
Yeah, I'm trying to make this circle react to sonic forces fistbump.

- D-ScratchNinja
-
Scratcher
1000+ posts
How do I make a sprite react to music???
If you're talking about in-game playing music, this way is easiest with 120 or 60 bpm, but you could use a timer block and this script:
Stage
Sprite
Stage
when I receive [begin v]
reset timer
play sound [Music v]
Sprite
when I receive [begin v]
set [time v] to [0.97]
repeat until <(game over?) = [1]>
wait until <(timer) > (time)>
react
end
- Vicream_Creator
-
Scratcher
100+ posts
How do I make a sprite react to music???
If you're talking about in-game playing music, this way is easiest with 120 or 60 bpm, but you could use a timer block and this script:.. the question was about the “react” block actually.
Stagewhen I receive [begin v]
reset timer
play sound [Music v]
Spritewhen I receive [begin v]
set [time v] to [0.97]
repeat until <(game over?) = [1]>
wait until <(timer) > (time)>
react
end
Yeah, I'm trying to make this circle react to sonic forces fistbump.Avoid bumping “old” posts and make your own post. Or, you could follow the solutions given above, from BereketY (super smart way to program that)
- D-ScratchNinja
-
Scratcher
1000+ posts
How do I make a sprite react to music???
.. the question was about the “react” block actually.By “react”, I mean whatever the sprite does to the beat.
- Vicream_Creator
-
Scratcher
100+ posts
How do I make a sprite react to music???
Well yeah the OP wants to know how you can make it beat.. the question was about the “react” block actually.By “react”, I mean whatever the sprite does to the beat.
- cs2452561
-
Scratcher
11 posts
How do I make a sprite react to music???
I had to do the same for an intro creation and I made two scripts, one that records the sprite sizes after altering it with the loudness block and another one to play the recording. For this to work, You might want to be in a very quiet room and have the song at a loud volume. I however already had an audio setting on my computer which allowed system audio to be heard without any mic input. If you want the scripts, here they are.This is the first Script for recordingThe script above altered the size using the original size before the altering and then alters the size using the loudness.set [Original Size] to (size)
delete [all] of [size]
repeat until <(Music Over) = [1]>
add (size) to [size]
set size to ((Original Size) + (loudness)) %
end
To play the size recording, use this script.This is the script for playing the recordingAs you might have noticed, there is a variable in the first script called “Music Over”. For that, all you need is this script.set [i] to [1]
repeat (length of [size] :: list)
set size to (item (i) of [size] :: list) %
change [i] by (1)
endThis is the script for the Music Over VariableThis should help, but make sure you are in a place where only the music can be heard. Also, note that the first script should only be used once, and the list “size” should never be cleared. Once you've finished recording, then switch to the second script. If you want, I can make a project explaining it.when I receive [Play Song]
set [Music Over] to [0]
play sound [Music] until done
set [Music Over] to [1]
so what variables and stuff do I have to make to start?
Last edited by cs2452561 (June 14, 2019 17:07:39)
- codeman1044
-
Scratcher
1000+ posts
How do I make a sprite react to music???
-snip-Please don't necropost. If you have a question that you want to be answered, please make your own topic.
- Cherrii-Bloss
-
Scratcher
4 posts
How do I make a sprite react to music???
I had to do the same for an intro creation and I made two scripts, one that records the sprite sizes after altering it with the loudness block and another one to play the recording. For this to work, You might want to be in a very quiet room and have the song at a loud volume. I however already had an audio setting on my computer which allowed system audio to be heard without any mic input. If you want the scripts, here they are.so, what are those funny dark orange blocksThis is the first Script for recordingThe script above altered the size using the original size before the altering and then alters the size using the loudness.set [Original Size] to (size)
delete [all] of [size]
repeat until <(Music Over) = [1]>
add (size) to [size]
set size to ((Original Size) + (loudness)) %
end
To play the size recording, use this script.This is the script for playing the recordingAs you might have noticed, there is a variable in the first script called “Music Over”. For that, all you need is this script.set [i] to [1]
repeat (length of [size] :: list)
set size to (item (i) of [size] :: list) %
change [i] by (1)
endThis is the script for the Music Over VariableThis should help, but make sure you are in a place where only the music can be heard. Also, note that the first script should only be used once, and the list “size” should never be cleared. Once you've finished recording, then switch to the second script. If you want, I can make a project explaining it.when I receive [Play Song]
set [Music Over] to [0]
play sound [Music] until done
set [Music Over] to [1]
- codeman1044
-
Scratcher
1000+ posts
How do I make a sprite react to music???
Those blocks are list blocks. Lists are accessed by going to the variables section in the scripts window and creating a new list.
- magakid00
-
Scratcher
3 posts
How do I make a sprite react to music???
Hello. I have the exact same problem as you. Try to find some music projects and see what's inside them. I've done that too, and those blocks are not so small!
- Is-it-friday_yet
-
New Scratcher
1 post
How do I make a sprite react to music???
Thanks for the tips. It really helped me with some of my code
.
.- CodingBaguette
-
Scratcher
500+ posts
How do I make a sprite react to music???
Those blocks are lists, they are similar to variables. You can make them by going to the variable section, then scrolling down and you can make a listI had to do the same for an intro creation and I made two scripts, one that records the sprite sizes after altering it with the loudness block and another one to play the recording. For this to work, You might want to be in a very quiet room and have the song at a loud volume. I however already had an audio setting on my computer which allowed system audio to be heard without any mic input. If you want the scripts, here they are.so, what are those funny dark orange blocksThis is the first Script for recordingThe script above altered the size using the original size before the altering and then alters the size using the loudness.set [Original Size] to (size)
delete [all] of [size]
repeat until <(Music Over) = [1]>
add (size) to [size]
set size to ((Original Size) + (loudness)) %
end
To play the size recording, use this script.This is the script for playing the recordingAs you might have noticed, there is a variable in the first script called “Music Over”. For that, all you need is this script.set [i] to [1]
repeat (length of [size] :: list)
set size to (item (i) of [size] :: list) %
change [i] by (1)
endThis is the script for the Music Over VariableThis should help, but make sure you are in a place where only the music can be heard. Also, note that the first script should only be used once, and the list “size” should never be cleared. Once you've finished recording, then switch to the second script. If you want, I can make a project explaining it.when I receive [Play Song]
set [Music Over] to [0]
play sound [Music] until done
set [Music Over] to [1]
- Discussion Forums
- » Help with Scripts
-
» How do I make a sprite react to music???