# Reverse engineer Makecode arcade song hex buffers

**URL:** <https://forum.makecode.com/t/reverse-engineer-makecode-arcade-song-hex-buffers/37535>\
**Category:** Collaboration\
**Tags:** music\
**Created:** [June 25, 2025, 10:06pm UTC](https://forum.makecode.com/t/reverse-engineer-makecode-arcade-song-hex-buffers/37535 "2025-06-25T22:06:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxitolplayer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/maxitolplayer/32/23039_2.png) [@maxitolplayer](https://forum.makecode.com/u/maxitolplayer)\
**Post date:** [June 25, 2025, 10:06pm UTC](https://forum.makecode.com/t/reverse-engineer-makecode-arcade-song-hex-buffers/37535/1 "2025-06-25T22:06:56Z")

</div>

So I told ChatGPT to generate a Makecode song hex buffer. It didn’t work, so I asked one more time and it generated two (almost) correct tunes that worked. It worked so good that I asked ChatGPT again to make Python code and it worked but the actual song didn’t and it just sucked. I know you’re just going to ask me to use @UnsignedArduino’s Midi song converter for Makecode. But it sounds like crap and I’m not going to use something that only supports a midi file that is like one instrument. Anyone at microsoft or something should know how the Makecode song buffers work (because they’re the ones that coded it) so I want to know how to covert midi files or rttl ringtones to be converted to the Makecode song hex buffer. Thanks!

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [June 25, 2025, 10:13pm UTC](https://forum.makecode.com/t/reverse-engineer-makecode-arcade-song-hex-buffers/37535/2 "2025-06-25T22:13:16Z")

</div>

@maxitolplayer the format is documented here:

> <https://github.com/microsoft/pxt/blob/master/pxtlib/music.ts#L23>

if you’re not used to working with binary encoded files then it can be a little tricky to wrap you’re head around. let me know if you have any questions!

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [June 25, 2025, 10:16pm UTC](https://forum.makecode.com/t/reverse-engineer-makecode-arcade-song-hex-buffers/37535/3 "2025-06-25T22:16:03Z")

</div>

> [@New Song format](https://forum.makecode.com/t/new-song-format/17763):
>
> I just remembered that I promised @UnsignedArduino that I would make a post linking to the new song format! Well, better late than never. The format of the song buffer is documented here: That file also contains all of the code for encoding/decoding the songs from buffers (in this case, uint8Arrays). The default instruments are all defined in the getEmptySong function. This code is mirrored in the arcade game engine here: If I were, hypothetically, making a webapp that converted midi file…

Might also help

> [@maxitolplayer](#):
>
> But it sounds like crap and I’m not going to use something that only supports a midi file that is like one instrument.

Do you have an example where it sounds very bad?

---

<div class="post-metadata">

**Author:** ![maxitolplayer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/maxitolplayer/32/23039_2.png) [@maxitolplayer](https://forum.makecode.com/u/maxitolplayer)\
**Post date:** [June 27, 2025, 4:49pm UTC](https://forum.makecode.com/t/reverse-engineer-makecode-arcade-song-hex-buffers/37535/4 "2025-06-27T16:49:20Z")

</div>

It’s due to lag and it sometimes has really high notes and sometimes lags out and plays a bunch of notes at the same time and i’m saying that it only supports a midi file with one track or channel and it lags due to excessive polyphony on different instruments.

---

<div class="post-metadata">

**Author:** ![releca52](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@releca52](https://forum.makecode.com/u/releca52)\
**Post date:** [April 15, 2026, 8:41pm UTC](https://forum.makecode.com/t/reverse-engineer-makecode-arcade-song-hex-buffers/37535/5 "2026-04-15T20:41:41Z")

</div>

Hello I saw this post but I still can’t figure out which parts of the hex mean what and how to generate a hex based off that. I saw the documentation in instrument.ts but I don’t fully know what it means. Is there some sort of in depth documentation or guide that I could use to attempt to reverse engineer this?

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [April 15, 2026, 9:25pm UTC](https://forum.makecode.com/t/reverse-engineer-makecode-arcade-song-hex-buffers/37535/6 "2026-04-15T21:25:27Z")

</div>

@releca52 nope, that big comment is the only documentation on the format. if you let me know what you’re stuck on, i can try and point you in the right direction

also, the code for the actual encoding/decoding of songs is in that file i linked above. if the comment is confusing, that code might make it a little easier to understand (or you could always just take it to use for yourself)

---

<div class="post-metadata">

**Author:** ![releca52](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@releca52](https://forum.makecode.com/u/releca52)\
**Post date:** [April 16, 2026, 10:37pm UTC](https://forum.makecode.com/t/reverse-engineer-makecode-arcade-song-hex-buffers/37535/7 "2026-04-16T22:37:55Z")

</div>

Thanks thought that it was same as music.ts in explorer. Mb

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [April 17, 2026, 1:08am UTC](https://forum.makecode.com/t/reverse-engineer-makecode-arcade-song-hex-buffers/37535/8 "2026-04-17T01:08:33Z")

</div>

> [@maxitolplayer](#):
>
> I want to know how to covert … rttl ringtones to be converted to the Makecode song hex buffer

For RTTTL, you could use this.

> [@RTTTL tunes extension](https://forum.makecode.com/t/rtttl-tunes-extension/4193):
>
> Ring Tone Transfer Language… is a popular format for tunes. With this library, you can play existing RTTL tunes in Arcade. RTTL [https://en.wikipedia.org/wiki/Ring\_Tone\_Transfer\_Language](https://en.wikipedia.org/wiki/Ring_Tone_Transfer_Language)
