Discuss Scratch

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???

Cherrii-Bloss wrote:

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???

Cherrii-Bloss wrote:

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)

hirsh001
Scratcher
100+ posts

How do I make a sprite react to music???

Vicream_Creator
Scratcher
100+ posts

How do I make a sprite react to music???

hirsh001 wrote:

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.
Might just break the program completely. A sneeze? The character dances. And you need to have sound on..

Cherrii-Bloss wrote:

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.

This is the first Script for recording
setOriginal SizetosizedeleteallofsizerepeatuntilMusicOver=1addsizetosizesetsizetoOriginalSize+loudness%
The script above altered the size using the original size before the altering and then alters the size using the loudness.

To play the size recording, use this script.
This is the script for playing the recording
setito1repeatlengthofsizesetsizetoitemiofsize%changeiby1
As you might have noticed, there is a variable in the first script called “Music Over”. For that, all you need is this script.

This is the script for the Music Over Variable
whenIreceivePlay SongsetMusic Overto0playsoundMusicuntildonesetMusic Overto1
This 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.

Last edited by BereketY (Dec. 31, 2018 13:13:04)

Vicream_Creator
Scratcher
100+ posts

How do I make a sprite react to music???

BereketY...[/quote wrote:

This is actually a smart way to code that! Only thing is that
setsizetoOriginalsize+loudness%
should more be like
setsizetoSmallestsize+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
whenIreceivebeginresettimerplaysoundMusic

Sprite
whenIreceivebeginsettimeto0.97repeatuntilgameover?=1waituntiltimer>timereact
Vicream_Creator
Scratcher
100+ posts

How do I make a sprite react to music???

D-ScratchNinja wrote:

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
whenIreceivebeginresettimerplaysoundMusic

Sprite
whenIreceivebeginsettimeto0.97repeatuntilgameover?=1waituntiltimer>timereact
.. the question was about the “react” block actually.


GamingForGold385 wrote:

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???

D-ScratchNinja wrote:

.. the question was about the “react” block actually.
By “react”, I mean whatever the sprite does to the beat.
Well yeah the OP wants to know how you can make it beat
cs2452561
Scratcher
11 posts

How do I make a sprite react to music???

BereketY wrote:

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 recording
setOriginal SizetosizedeleteallofsizerepeatuntilMusicOver=1addsizetosizesetsizetoOriginalSize+loudness%
The script above altered the size using the original size before the altering and then alters the size using the loudness.

To play the size recording, use this script.
This is the script for playing the recording
setito1repeatlengthofsizesetsizetoitemiofsize%changeiby1
As you might have noticed, there is a variable in the first script called “Music Over”. For that, all you need is this script.

This is the script for the Music Over Variable
whenIreceivePlay SongsetMusic Overto0playsoundMusicuntildonesetMusic Overto1
This 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.

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???

cs2452561 wrote:

-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???

BereketY wrote:

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 recording
setOriginal SizetosizedeleteallofsizerepeatuntilMusicOver=1addsizetosizesetsizetoOriginalSize+loudness%
The script above altered the size using the original size before the altering and then alters the size using the loudness.

To play the size recording, use this script.
This is the script for playing the recording
setito1repeatlengthofsizesetsizetoitemiofsize%changeiby1
As you might have noticed, there is a variable in the first script called “Music Over”. For that, all you need is this script.

This is the script for the Music Over Variable
whenIreceivePlay SongsetMusic Overto0playsoundMusicuntildonesetMusic Overto1
This 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.
so, what are those funny dark orange blocks
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???

Cherrii-Bloss wrote:

BereketY wrote:

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 recording
setOriginal SizetosizedeleteallofsizerepeatuntilMusicOver=1addsizetosizesetsizetoOriginalSize+loudness%
The script above altered the size using the original size before the altering and then alters the size using the loudness.

To play the size recording, use this script.
This is the script for playing the recording
setito1repeatlengthofsizesetsizetoitemiofsize%changeiby1
As you might have noticed, there is a variable in the first script called “Music Over”. For that, all you need is this script.

This is the script for the Music Over Variable
whenIreceivePlay SongsetMusic Overto0playsoundMusicuntildonesetMusic Overto1
This 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.
so, what are those funny dark orange blocks
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 list

Powered by DjangoBB