Discuss Scratch

Akira_Roido
Scratcher
18 posts

Music Block Chords

I am currently making a collection of eight songs from various video-games and anime and a lot of the sheet music I am using for the transposition are for piano, and have a lot of chords. But when I try to do the chords, it failed. I tried making to different music scripts and having the chord block string rest until the chord it needed to come in at, but the problem with this is: if you get even the slightest bit of internet lag, the two music strings would fall out of sync with one another, what I mean is that the chords were no longer coming in when they needed to, even though I had all of the beats correct. Do you guys, gals, or non-binary pals (lololol) know how to make chords in scratch without this happening?
MiniCoder11
Scratcher
100+ posts

Music Block Chords

One solution to your problem would be to sync all of your scripts with “wait until blocks”. Here is a example:

whenclickedforeverchangeBeatby1waittemposecs

whenclickedwaituntilBeat=1playnote60for0.25beatswaituntilBeat=2playnote60for0.25beatswaituntilBeat=3playnote60for0.25beatswaituntilBeat=4playnote60for0.25beats

This is an example where each note waits for the beat to be increased to play. Any solution where you use variables to sync the notes should work fine.

Last edited by MiniCoder11 (June 21, 2019 04:07:23)

Akira_Roido
Scratcher
18 posts

Music Block Chords

@MiniCoder11 When I do this, the Beat variable doesn't increase how you want it to. Instead of waiting for 1 beat of the tempo, it is waiting for the tempo EX: My tempo is currently 120, so it is waiting 120 seconds.
GunChleoc
Scratcher
500+ posts

Music Block Chords

You'll need to wait for 1/tempo secs then.

wait1/temposecs

For the second part, it might also be more robust to

waituntilnotBeat<1

in case that part of the script is experiencing lag. Try the solution above first though.
codeman1044
Scratcher
1000+ posts

Music Block Chords

GunChleoc wrote:

You'll need to wait for 1/tempo secs then.
wait1/temposecs
I think you'll actually want to divide 60 by the tempo, not 1. You could add operators to change how many beats it waits. For instance, multiplying the result by 2 would wait 2 beats.
wait60/tempo*numbersecs
If you wanted to make it easier, you could just use the rest block:
restforbeats
Or if you really wanted to use wait blocks, you could make a custom block:
RestforbeatsdefineRestfornumberbeatswait60/tempo*numbersecs
Hope this helps!
Rocket-Flier
Scratcher
100+ posts

Music Block Chords

I recommend using a broadcast loop like this:
whenclickedsetmeasureto0repeatsonglengthchangemeasureby1broadcastmeasureandwait
This helps keep different parts of the song from drifting apart. Here is an example of how to use it:
whenIreceive1playnote60for1beatsplaynote64for1beatsplaynote67for1beatswhenIreceive1playnote48for3beatswhenIreceive2playnote67for1beatsplaynote64for1beatsplaynote60for1beatswhenIreceive2playnote55for3beatswhenIreceive3playnote60for1beatswhenIreceive3playnote64for1beatswhenIreceive3playnote67for1beats
cs4287022
Scratcher
4 posts

Music Block Chords

Would it have to be “run without screen refresh?”
cs4287022
Scratcher
4 posts

Music Block Chords

define1234for5beatsset1to1set2to2set3to3set4to4set5to5broadcast1broadcast2broadcast3broadcast4whenIreceive1playnote1for5beats

Last edited by cs4287022 (Feb. 4, 2021 18:18:41)

Powered by DjangoBB