manuelzi / desidulate

Tools for analyzing C64 SID music

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

desidulate

Overview

desidulate is a command line python suite of tools for understanding C64/SID music - helping understand how the SID is used, and translating SID music (with limitations, see below) to MIDI format. desidulate works directly on SID register logfiles (as generated by VICE's -sounddev dump option), so it can parse music from any C64 software (game, demo, .sid file, etc) and can leverage all the fine existing and ongoing work within VICE dealing with hardware quirks, illegal opcodes in play routines, etc.

desidulate is intended to help new SID composers understand the SID more quickly and completely, find unexplored territory, and build upon the SID legacy. desidulate was also written to assist CHIME RED Tesla coil synthesizer research - how to apply SID style synthesis to high voltage audio generators, and to avoid error-prone audio based transcription (such has that built into Ableton Live). desidulate doesn't require extensive dependencies and is intended for command line use (e.g. to analyze 1000s of SID files efficiently), and is based on Pandas.

Alt text

Installing

$ ./build.sh

Transcribing to a MIDI file

  1. Generate VICE register dump (by default, generates vicesnd.sid in current directory).
$ x64sc -sounddev dump /path/to/game.d64
$ mv vicesnd.sid mytune.dump

or

$ vsid -sounddev dump /path/to/tune.sid
$ mv vicesnd.sid mytune.dump
  1. Generate ssf and log files.
$ ./reg2ssf.py mytune.dump

This intermediate step, identifies all SSFs (see below) and writes them to mytune.ssf.xz, and also writes a log file mytune.log.xz, which logs when SSFs are played (in CPU clock cycles).

  1. Generate SMF MIDI file.
$ ./ssf2midi.py mytune.log.xz

This re-renders the ssf and log files into a SMF mid file, mytune.mid

desidulate can generate a multitrack SMF (one track for each voice, and an additional track for each voice for percussion). The intent is not perfect MIDI reproduction (not possible due to missing features in MIDI like standardized support for filter sweeps, etc) but to allow analysis of SID programming techniques (e.g. how a particular kick sound is made), and to allow a composer to have MIDI based devices accompany a C64 composition without complex hardware integration.

A SID register dump is parsed into partitions called SSFs - SID Sound Fragments, which are divided on SID voice gate off to on events. The test bit is accounted for as well, to partition on "hard restart" type events. Then each partition is analyzed for the closest MIDI notes based on frequency, and what waveforms are used while a voice is gated on. More than one note can be generated if the pitch channges sufficiently while the gate is on. Notes then are either classed as "regular" (no use of noise waveform) or "percussion" (use of noise waveform). Percussion events are then partitioned further - events that use the noise waveform only are transcribed to hihat, etc, based on noise length. Snares are detected by use of the noise waveform repeatedly used before and after another waveform. Kick drums are detected by use of a pitch drop.

Transcibing an SSF to a WAV file

$ ./ssf2wav.py mytune.ssf.xz <hashid>

Where <hashid> is the key of the SSF to render (view mytune.ssf.xz for the complete list of SSF's detected, sorted by most often used SSF first).

Transcribing to a WAV file

$ ./reg2wav.py mytune.dump

The result will be rendered into mytune.wav.

desidulate can generate a WAV file from a ReSID based SID simulation directly from a VICE register dump. This allows the composer to write SID music by directly inputting SID registers (either manually or perhaps from a progressive algorithm) without having to deal with a C64 emulator or an intervening MIDI translation layer (like a SIDStation) that is convenient but also limits expression.

Ongoing work

  • Pitchbending for following small pitch changes (Magenta does not use pitchbends as of March 2021)
  • Export to defMON

References

About

Tools for analyzing C64 SID music

License:MIT License


Languages

Language:Python 99.3%Language:Shell 0.7%