Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SID file format parsing

I want to write a parser for .sid files (music for C64 chiptunes) to extract some patterns into notes. I search for format and found this: http://cpansearch.perl.org/src/LALA/Audio-SID-3.11/SID_file_format.txt

I can read the header as in that document, but I don't understand how to extract individual notes and output them.

I search for ready converters and found these:

  • http://www.vgmpf.com/Wiki/index.php?title=SID_to_MIDI_(Windows) and - very old, doesn't work
  • ... - very very old, output empty file
  • ... - just a forum discussion

That is I found some more but StackOverflow says that I can't post more than 2 links.

Please help. Sorry for my bad English. Thank for your consideration!

like image 753
Bahgu Kiitar Avatar asked Mar 12 '23 23:03

Bahgu Kiitar


2 Answers

Apart from the header containing various meta data, the rest of a .sid file consists of code (the player routine) and data (the instruments and note data.)

The format of the note data is dependent on the player code, and a myriad of different players exists, any of which may have several versions with variations in code and data formats. There are even many tunes out there that have code and data formats developed specifically for that one tune only.

This means that the only way for you to determine the format of the note data is to study the player code (in a machine code monitor or a separate disassembler tool) to see what it does and how the data is organised, which can be quite an undertaking even if you are already familiar with 6510 machine code and the SID chip.

like image 89
Lars Haugseth Avatar answered Mar 25 '23 04:03

Lars Haugseth


If I'm reading this right, if you are only interested in the notes (i.e. pitch), you should be able to get by by just looking at what gets written to $d400/$d401 for channel 1 and so on.

like image 40
Cactus Avatar answered Mar 25 '23 04:03

Cactus