Music Player

Not the usual “I WANT TO PLAY MP3S ON MY SERVER PLZ TELL”, but how about this:

songs{
  "Mario"{
     "song"="<some string of letters representing pitches>"
     "creator"="Lokio and Nintendo"
     "tempo"=4 
  }
}

And you would split the song like

song.split('');

Then you would simply play the appropriate playSound for each note with a certain amount of delay depending on the tempo specified in the song.

1 Like

That sounds like a pretty cool idea.

That sounds like a midi file. :wink:

1 Like

This seems like a pretty awesome idea! There is a standard notation for this that used to be used for ringtones. You might wanna figure out how to parse that.

What’s the name of that “ringtone format”?

I think midi is too complex for this purpose?!

Yes, i think so. The ringtone notation (i’m thinking of old nokias) might work fine and is by far easier to implement.

This would be more or less just letters and/or numbers and/or symbols to make notes.

MIDI is rather the standard, and there’s plenty of stuff already available in MIDI format. I’d argue it makes sense to use MIDI.

1 Like

i’d go with numbers or letters for the sake of simplicity.
Almost everyone can write a sequence of letters in a textfile :stuck_out_tongue:

1 Like

I would pursue this, but…
You know what I should pursue this.

Sure, but not as music! And how will you define the complexities of music in just letters? MIDI is designed as a super simple representation of this and there’s a javax library just for it :smile_cat:

This is going to, basically, play songs using playSound. It will probably use noteblock sounds, so it’ll be awfully limited but that’s just how it’s gonna be. :smile:

Also note that I’m going to have to implement around 175 sounds. :stuck_out_tongue:

I thought about something like this:

short note: a
long note: a…
longer note: a… or a::
4 short notes: aaaa
pause: -
long pause: –

a sample song would look like this:
a…bbc…t.h–j…

This way it could be played through noteblocks (if theres a noteblock API). MIDI is far more advanced, yes. But somehow i like the simplicity of noteblocks and monophonic melodies.

1 Like

Right now:
Instrument:pitch

While MIDI is a great standardized format for music I don’t know how easy it would be to convert that to playsounds and make it sound nice. Midi is a complex format that can have many layers and idk how well MIDI would work when trying to convert to more simplified playsound music. This is why I recommended the nokia format as it is a fairly standardized format for simple music.

1 Like

What about using BSON or a Base64 encoded binary string in JSON/Hocon?
Of course this makes it more complicated to create songs on a text-file basis, but it would make the files smaller, and you don’t need to think of humans when creating the file format.

Example:

0xABCD - A: Instrument, B: Volume (0-15), CD: Pitch (0-255)
0x00AB - Pause (AB ticks)

Or if you want to do it without binary:

IVVPP (e.g. G25A2): Instrument, Volume, Pitch (e.g. Bass Guitar, Volume = 25/99, A in the 2nd octave)
PTT: Pause (TT ticks)

Then every tick one note would be played, and there could be multiple tracks in a file (e.g. BSON array)

Then you could make a (web?) application which lets you create songs with an easy interface, which would drastically increase the number of songs for your plugin… :wink:

3 Likes

There is a library that can play a midi file as note blocks – sk’s jinglenote: https://github.com/sk89q/CommandBook/blob/master/src/main/java/com/sk89q/jinglenote/bukkit/BukkitJingleNotePlayer.java

There’s something like this in Craftbook. It uses MIDIs on the server side to play. Anyhoo, this sounds fun :slight_smile:

yeah, that’s based on the same code I linked