Work in Progress

MP3 player (attempt)

10

SP4CEBAR 2023-03-01 13:53 (Edited)

An MP3 file stores audio like a spectrograph
My plan is to get the frequencies and intensities of the four highest peaks and play those on NX's four voices as triangle waves (closest to sine wave we have)

However MP3 files are quite complicated and a lot of the information on the internet doesn't cover everything, most of them only cover the frame header
And the official standard (PDF) from ISO costs like $150, but I did find this PDF

This is what I found so far:

MP3 FILE

ID3 METADATA

FRAME

HEADER

SIDE INFORMATION MONO MODE

SIDE INFO GRANULE 0/1 MONO MODE

SIDE INFORMATION TWO CHANNEL MODE (same as mono mode, but with different sizes)

SIDE INFO GRANULE 0/1 TWO CHANNEL MODE (same as mono mode except sizes are 2x as much)

DATA

Each channel

The data encoded in the Huffman code bits

Sources:

Also MP3 data is loaded into the program using this HEX converter

MP3 PLAYER.nx | Open in app
2023-03-01 13:53

Timo 2023-03-01 14:01

😮


McPepic 2023-03-01 16:25

Wait. Does this mean you could get advanced audio like voice working in LowRes?
I also know that MP3 takes up a lot of space. Wouldn't it be a smarter idea to use the infinite memory trick (putting the hex in a string instead of ROM) to allow more data?


TheSailor 2023-03-01 16:32

And I'm over here being ecstatic about getting my head around arrays.... Damn it 😅


SP4CEBAR 2023-03-01 16:33 (Edited)

@mcpepic I hope voice will work
I used a 1-second audio file so that it would fit in ROM, I find using NX's memory simpler, but the memory trick will work
however, you could also use a heavily compressed file, NX only has 4 voices so you probably won't even notice


SP4CEBAR 2023-03-01 16:43

@theSailor it's more complicated than it seems, it's just like a box in a box in a box, once you found enough information to find where the next chunk of data starts you can move a layer deeper into the file


412lop 2023-03-01 17:54

Whoa you made a lot of different types of media in LowRes NX, Are you gonna make video files next?


SP4CEBAR 2023-03-01 18:08 (Edited)

@412lop I was thinking about it, the only problem is that video files take up a lot of memory, but I think if I use low-resolution videos it may fit in ROM, otherwise I should just use the infinite memory trick
If MP3 is very similar to MP4 then I can reuse a lot of this code


McPepic 2023-03-01 18:09 (Edited)

@SP4CEBAR
I have a question. I was curious, so I took the hex data from the program and ran it through a hex to ascii converter. I then stored this in a separate file and saved it as mp3. When I tried playing it, though, it didn't work. Do you know the reason for this?


SP4CEBAR 2023-03-01 18:21 (Edited)

It isn't ASCII-based: you need a HEX to FILE converter


McPepic 2023-03-01 19:07

@SP4CEBAR
Ah, got you. That makes sense.


SP4CEBAR 2023-04-10 18:49

You can search "mpeg audio" on youtube for some great resources


Log in to reply.