Electronscape

Project updates, development logs, and news

Live status: Status: idle

The SIDBOX Gets Its Own Audio Format!

Introducing SBA - SidBox Audio. Who could have guessed?

SBA is a lossless, block-based audio format designed specifically for the SIDBOX.

Introducing SBA - SidBox Audio. Who could have guessed?

SBA is a lossless, block-based audio format designed specifically for the SIDBOX. It works a little like FLAC in principle, but is considerably simpler and extremely inexpensive to decode. This allows the SIDBOX to stream audio at a ridiculous rate while using very little CPU time.

The encoder accepts most common WAV files and converts them into the SIDBOX’s native playback format:

16-bit signed PCM
Stereo
44.1 kHz
Lossless compression
Block-based streaming

It supports mono, stereo and multichannel WAV files, different sample rates, integer PCM from 8 to 32 bits, and 32-bit or 64-bit floating-point audio.

Why the restrictive output format?

At its heart, the SIDBOX is still an embedded microcontroller. Its audio system uses a stereo 12-bit DAC running at 44.1 kHz, so supporting numerous audio formats during playback would waste valuable CPU time.

Every differing input format would otherwise need some combination of real-time resampling, channel mixing, sample conversion and buffering. By converting everything beforehand, SBA gives the SIDBOX one predictable format that it can stream and decode efficiently.

Audio is stored in independent blocks. Each block is either compressed using delta-coded samples or stored as raw PCM when compression would not reduce its size. This keeps decoding simple, lossless and fast while avoiding the need to load the entire file into memory.

The SIDBOX still converts each 16-bit sample to its 12-bit DAC output, but that operation is tiny compared with resampling or decoding a more complicated general-purpose audio format.

The result is a format created specifically around the SIDBOX hardware: predictable, lossless, lightweight and stupidly fast to decode.
2 Channel Scope Test
2 Channel Scope Test

ROM:Programs gets a 2 channel scope

This demonstrates the SIDBOX GUI operating system and its cooperative multitasking system by running a live, two-channel audio oscilloscope inside a standard desktop window.

The oscilloscope reads the left and right channels directly from the DAC’s DMA audio buffers. Every 50 milliseconds, a cooperative timer callback samples the current audio data and redraws both waveforms into a 432 × 216 indexed-colour bitmap held in memory.

That bitmap is assigned to a standard GUI BitmapView gadget. After each frame is drawn, the application tells the gadget that its contents have changed. The GUI then handles repainting the affected gadget and any other parts of the window that require updating.

The music continues playing independently through DMA while the scope, desktop, windows and other applications continue operating through the cooperative multitasking system.

Using a bitmap containing more than 93,000 individually addressable pixels is not how an ordinary SIDBOX application would normally use a GUI gadget. It is deliberately excessive and primarily serves as a stress test—and, admittedly, a rather fun gimmick.

Even so, it demonstrates that the GUI can display continuously changing graphics derived from live audio data without interrupting playback or taking control away from the rest of the operating system.
VU meters, 2 channels!!
VU meters, 2 channels!!
Real time play back and visual updates

The OS

The GUI runs through a timer-driven cooperative multitasking scheduler. It may not be especially elegant, but it was designed as a dependable workhorse: every active task gets its turn without taking control away from the rest of the system.

Task priorities are not currently supported. Audio playback, however, is handled independently by DMA and remains effectively paramount, allowing the music to continue uninterrupted while the GUI and applications update around it.
0 likes

Comments 0

Comments are reviewed before they appear publicly.

No approved comments yet. Be the first to leave one.

Leave a Comment

Plain text only · maximum 3,000 characters