Brussels / 1 & 2 February 2020

schedule

Retro music - Open Cubic Player


This presentation includes multiple topics mixed together * Porting a DOS multimedia program into Linux/BSD * How music was composed/stored in old type of games from the 8bit era, up into the amiga (and partly the DOS world) * How does audio/music hardware work. C64 SID, ZX-Spectrum and alike, Amiga, Adlib FM-synth OPL2/3 and General Midi

As a child, I was exposed to Cubic Player. This program was a text-based music player. All the color full texts mesmerized me and it gave a direct visual feedback of how the music was generated.

During teenage years I learned programming and got introduced to Linux. All the sourcecode for everything was available. The kernel, multimedia libraries, tools, all kind of APIs. If there are anything you wonder how works, you can inspect it. If you are unable resolve a specific detail in your own project, try to find another project that has done something similar! But for playback of these Amiga style modules, there was no programs that had the same charm as Cubic Player. Programs like mikmod, XMMS, Audacious only displayed playlist, maybe instrument-names and maybe an spectrum analyzer.

When I discovered that Cubic Player had been released as Open Cubic Player. I grabbed the source code and started to study it. All of it was based on direct hardware access, as it was written for DOS. Direct access to video-memory/hardware, raw keyboard scan codes, hardware interrupts for timers allowing background rendering of audio if needed etc. A natural candidate for a novice programmer to port?

Slowly I went through one and one single file of the original source code. * Lots of logic could be kept * Some could be thrown away like direct audio hardware drivers * Some needed heavy rewrites like video output * Assembler needed to be rewritten into C inlines * The timer interrupt porting caused a zero-day kernel bug to be discovered https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0554

When text appears on the screen, and audio (highly distorted in the beginning) appeared, was a magical feeling. Progress was faster when the goal felt to be well within the reach.

When you the make your code public, people start to use it... and you start to get feedback like: * Program is unable to compile on other platforms * Program crash on other platforms * Specific crashes that only happens for some few people - compiler bugs (these were more common back in the days)


How did old systems playback music? Using specific hardware circuits. How is music composed / stored / playback?

We will take a deep dive into these two questions on these platforms:

ZX-Spectrum 128 .AY files - Using code chopped out from "aylet"

Atari ST .YM files - Using ST Sound Library

C64 .SID files - libsidplay

OPL2/OPL3 style - libadplug

Amiga style modules

General MIDI - TiMidity++

Open Source makes it possible to combine the work and effort from multiple volunteers. Not everything is a always an easy walk in the park, but it sure makes it easier than writing everything from scratch when there are known working code that can be either be used as a template or wrapped around.

Speakers

Photo of Stian Sebastian Skjelstad Stian Sebastian Skjelstad

Links