Expanding Our Knowledge In Coding Music (with Hopscotch)

What’s up Hopscotchers it’s me, your local troll I mean music meme lord GweTV.

You may have seen my previous topic GweTV's Guide To Coding Music which goes through the basic progress of coding music in Hopscotch. This topic here is meant to go even further in the quest for an amazing music mashup, while answering some of your questions along the way.

First, let’s run through some possible scenarios you might face while coding:

Scenario 1

You want to code a song but you can’t find the right sheet music!!!

In this case, I would use any sheet music that is given. Guitar is the closest thing to piano that I have seen offered, so use that. You Tube might help, as some You Tubers link sheet music in the descriptions of their videos. You can also follow along in the video, and pause when you need to code. It might be harder, and it might require more experience, but you can do it!*

(*The easiest way to code music on Hopscotch is using piano sheet music, so I’m assuming you use that)

Scenario 2

I made a mistake while coding, but I don’t know where I messed up!

Play your project through and listen for the note that is off. If your editor is organized well, you should be able to spot the wrong note and correct it. Sometimes counting out loud the beats will help. Double check that you put in the correct note in the editor by cross-referencing it with the sheet music. It’s easy to gloss over the note and think it’s an E, for example, when it’s actually a C (trust me, I have made this mistake lol)

Scenario 3

My project is lagging and I don’t know what to do

This is the most common problem when coding music. It takes roughly 17 milliseconds (correct me if I’m wrong) for a block to run its command, so that might be a factor. Another factor might be too many notes (such as chords) running at the same time. Chords often lag out the project and can crash the app, but there are some fixes.

An easy fix could be adjusting the wait time between notes. You can estimate the reduction, 5 milliseconds, 10, etc. It does not have to be perfect or precise, just something to make it smoother. Remember, it takes practice, so don’t worry if it doesn’t end up 100% like you imagined it.

Relating to the chords, for right now I would limit the amount of chords you use. Unfortunately, there is no permanent fix I have to offer, other than possibly using secret blocks, but I would only use them at key points in the song.

Scenario 4

The music starts playing immediately after I play the project

Simple fix. Add a wait block before the start to reduce the lag and the sudden “jump” of the notes. Give it half a second (0.5) or even a second if it’s really bad. You shouldn’t need anything past a second, though depending on the age of the device it might require it.

Some other things to go over/questions I’ve been asked:

What about drums?

I’ve been experimenting with using drums and notes. I’ve tried using separate objects and that works better than using only one. It’s hard to coordinate them, and it takes hours to get it to sound somewhat close to the original song. If you want to include drums, use a separate object. I wouldn’t do anything fancy, just a simple beat. It also brings up the limitations of drums in Hopscotch. You have a snare, a kick, but no real hi-hat. Substitute the hi-hat sound with any other sound you want. Be creative! :smiley:

What about guitar?
There is no real guitar option in Hopscotch at this current moment. You have one sound that plays a chord, but that’s really it. Maybe we can ask THT to add guitar and possibly bass, along with expanding the sound library and drums.

What genre is the easiest to code music with?

Great question! Rock, alternative rock, metal (and the genres within it) and punk are hard to code for their complex riffs and melodies. I haven’t messed with pop and jazz much, but from what I’ve heard and tested it’s a bit easier. Again, it all comes down to the age of your device, and possibly the version of Hopscotch.

What can we do with music? Music is an art form, a way to express yourself, a way to show creativity. There are endless possibilities, and I look forward to any music you all code in the near future.

What inspires you to code music?

Usually I hear a song I really like, and want to replicate it in Hopscotch. To create my mashups, I get a few songs from a specific category (ex. rock, punk, metal, or even from a single band) and figure out all the other logistical stuff. I have a list in my profile of artists who have influenced me if you want to check them out for inspiration!

Was this topic helpful?

  • Yes
  • No

0 voters

Tag me here if you have any music questions. Anything, and I mean anything lol. I’ll also post some updates to this topic when necessary. Anyhow, happy Hopscotchin’ and stay cool bros :metal:

@omtl

17 Likes

Stealing first post

3 Likes

Ooooh this is great!

Can I add a small tip? Just something I’ve done before that I find helps and I don’t know if you put it.

One thing I’ll do is set a variable to the “tempo” and then have other variables that are like the half notes (tempo * 2), quarter notes (tempo), eighth nots (tempo / 2), etc.

I find that’s helpful for simpler songs where you want to adjust the tempo of the entire thing easily. Certainly no one has to listen to this but I thought it could be helpful

Also great tutorial Gwe!

7 Likes

Ah, great idea!

I’ve never really used variables in music, but this sounds like it works really well! I might try this out in the future.


Thank you!

5 Likes

You’re welcome

Yeah I just got fed up with typing it all out over and over again

5 Likes

@GweTV GREAT topic!

Use my KeepSync chords strategy or that but all in one variable. Using this, I can use powers of 10 ihn variables to run sounds in E-Pad while having no sound lag and very little frame dropping.

I am planning to replace “improved sounds” in the Web Explorer with a 3rd parameter in set sound called “instrument,” where 0 = piano (the current “improved”), -1 = original, 1 = guitar, 2 = sustained note??, etc.

Read your sheet music while playing the music. That helps so much.

Important note: Many times, you will have to mess with octaves, since HS only has 2. Given this, you should always make sure that the melody is heard as well as only the important harmony notes

I’d say whatever works. Just experiment.

6 Likes

Thank you!!!

Nice :ok_hand:

Oooh interesting. It would be interesting to add guitar. It would spice up the sound for sure.

Agreed, especially if you don’t really know how to read music. It also helps even if you do.

Agreed.

Yee, I’ve been experimenting for a few months on my extras account

6 Likes

Depends on the song. If you know 250% or more that you won’t change the tempo, no need. But any change in tempo means you should probably have a variable to control it.

I go quarter note base = 500ms / 0.5sec for 120bpm – I think doing it this way works best (quarter base, so that you can think: x amount of notes per second)

Yup.

5 Likes

:ok_hand:

Is there a formula for BPM?

7 Likes

BPM to seconds? Of course.

Using the fact that 60BPM = 1 quarter / sec = 1 sec — and 120BPM = 2 quarters / sec = 0.5 sec,

Wait seconds = 60 / BPM, simple as that.

7 Likes

Ah right right right. Bookmarked for further use. I knew there had to be a formula, but sadly the internet isn’t reliable anymore lol

5 Likes

rubs hands in excitement because new test method has a decently easy way to change tempo

I seriously need to steel myself and code the accompaniment though - the only reason I haven’t is that I haven’t listened to the song enough to discern it from ear

10 Likes

Ooooh new project?

7 Likes

it’s like three weeks old because I coded the melody and left it alone for too long, but basically it uses a new method that doesn’t involve wait time.

sort of discovered by E if I recall correctly, but I tweaked some things that maybe I can take credit for??

8 Likes

Nice :ok_hand:

Yeah I probably could code my Weezer mashup by memory since I basically know all their songs to heart lol :sweat_smile:

7 Likes

Mine uses variables to control sound, yours subtracts execution time, right?

It’s just different. Mine was completely made by me, yours was completely made by you. Just two different approaches.

6 Likes

welp, I was trying to be brief without giving away too many spoilers :face_with_hand_over_mouth:, but I guess I can clarify.

mine does use variables, but unlike yours, which iirc has an object setting the variable to 1, 2, 3, etc., mine has an object that continually increases a “master” variable - kind of like the cursor thing if you were to use a video or audio editor. the other objects then play sound when the variable hits a certain value, like measure numbers in sheet music. long story short: lots of rules, but way better synchronization

10 Likes

All of a sudden when you look up Black Flag you get these weird punk recommendations from the 1980s and ngl they really do slap

6 Likes

Ah, that’s cool!

I wouldn’t bother with rules because E-Pad is large enough on its own. Even the first song took too much checking for Wi-Fi and play status. (off = loop back to start – that was hard). Thankfully, I can use destroy object to reset the song for future songs.

6 Likes

Super helpful gwe, thank you!

6 Likes