# Less lag music tutorial

I made a new music method
@sage also had the idea for this a while back, so not totally new but I thought this would be a topic for explaining it.

first, create variables for every note.

then, makes rules for when the variable is set (having the note play when it is set to 1, then setting to 0 after note is played)

then, find the bpm of the music, convert it to milliseconds and divide by 1000. make a variable and set it to the number you get.

after that you can code the music by setting the variables of every note. add wait blocks in between

When the variable â€śmiddleCâ€ť is set to 1, the middle c note plays. then, the wait seconds block delays the next note for the appropriate amount of time (quarter note, half note, etc.)

### most note setting things

Bpm = var you set for waiting (picture is secondsPerCount)
Whole note = bpm x 4
Dotted quarter note = bpm x 3
Hale note = bpm x 2
Dotted quarter = bpm + bpm/4
Quarter note = bpm
Eighth note = bpm/2
16th note = bpm/4
32nd note = bpm/8

after adding them for a little you can get a result such as this:
https://c.gethopscotch.com/p/10yj10kqdn

(note: was a quick project, not very in time but demonstrates the basic example of this method)

if you happen to use this method then Iâ€™d like credit (credit along with sage since they thought of it too) but itâ€™s not necessary

13 Likes

This is amazing!

Iâ€™m definitely bookmarking this and testing it tomorrow. I might tweak it if thatâ€™s cool with you

Great job!

Cool website to help with this (and save time): https://www.keyandpitch.com/tools/bpm-to-ms-calculator/

7 Likes

also:

this method makes it a lot quicker to code musicâ€”as you can scroll through variables a lot easier than notes
and you may want to subtract 0.016 in the bpm, as it takes about that long to run a wait block (I think it takes 16ms to run a frame)

thanks Gwe:)

6 Likes

Youâ€™re welcome!

I should include that calculation in my method. Thanks for reminding me

4 Likes

Yay cool!

Also you didnâ€™t have to mention me, but thanks

5 Likes

Cool, this should be helpful

3 Likes

I tried making something like this but slightly differently but hs doesnâ€™t like me storing large numbers lol

3 Likes

Iâ€¦ did that here? (But with less variables)

3 Likes

Hey, theyâ€™re both good

3 Likes

Yep. Oneâ€™s better for not frying your brain (this one) and one is better for less variables (mine).

4 Likes

it isâ€¦ pretty similar to the common music method, and doesnâ€™t allow for simultaneous chords - but it is indeed a different method, which is pretty cool!

5 Likes

Variables have been instant since player version 1.2.x, or over half a year at least now, so yeah it does allow for simultaneous chords.

5 Likes

oops

3 Likes

in that case can someone edit the op saying that e invented this method and this is a tutorial on explaining it?

2 Likes

Cool! I usually donâ€™t use music because I find it takes a while, but I might try this, it seems much easier.
(Btw I think you spelled half wrong)

3 Likes

oops lol nice catch

3 Likes

It is a little bit different though, Iâ€™ll give you that :)

3 Likes

This is a really nice concept! I donâ€™t code music that often, but I bookmarked this and will definitely look into this method.

6 Likes

@Nobody your new method is working smoothly! It sounds SO much better!

I made a few modifications to your method, but otherwise itâ€™s amazing! :DDD

4 Likes

thatâ€™s great:))

1 Like