4

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:

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!

Cactus
  • 27,075
  • 9
  • 69
  • 149
  • 7
    You can't really parse SID file into notes. SID files are basically a program in 6510 assembly, accessing MOS6581 chip directly (sometimes in a very weird manner). Your best bet would be to run it in emulator (like [libsid](http://sidplay2.sourceforge.net/)) and dump whatever's happening with the emulated MOS6581. – GreyCat Mar 12 '16 at 00:47

3 Answers3

5

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.

Lars Haugseth
  • 14,721
  • 2
  • 45
  • 49
  • Couldn't he just run the player in a 6510 VM and record what gets written to SID registers? – Cactus May 13 '16 at 01:31
2

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.

Cactus
  • 27,075
  • 9
  • 69
  • 149
0

Check out https://github.com/M3wP/XSID

You'll find the binaries in the Distribution directory: https://github.com/M3wP/XSID/tree/master/Distribution

This one works, I tried it out. Note information can be found in the output-midi file. Check the code to find out how it works in detail.

You will need Delphi (XE8 is currently used) and Microsoft Visual Studio to compile all of the project binaries for Windows. Visual Studio is only required for the DLLs.

Robert
  • 1