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:

(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

12 Likes

This is amazing!

I’m definitely bookmarking this and testing it tomorrow. I might tweak it if that’s cool with you :wink:

Great job!

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

5 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:)

4 Likes

You’re welcome!

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

2 Likes

Yay cool!

Also you didn’t have to mention me, but thanks

4 Likes

Cool, this should be helpful

2 Likes

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

1 Like

I… did that here? (But with less variables)

2 Likes

Hey, they’re both good :wink:

2 Likes

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

2 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!

3 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.

3 Likes

oops

2 Likes

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

1 Like

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)

2 Likes

oops lol nice catch

2 Likes

It is a little bit different though, I’ll give you that :)

2 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.

5 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

2 Likes

that’s great:))

1 Like