audioControl Driver

Last updated: · In development
What we tried, why we chose an approach and what we learned. These are dated accounts; see Progress for the current position and recorded outcomes.
How two buffers played a whole tune
A clean three-quarter-second tone left a practical question. Could the Next prepare the next piece of sound before the current piece ran out? Keeping the known Build 54 transfer intact made that question possible to answer one change at a time.
Give each bank one job
On 17 November the first pair of tones was loaded in advance. Hearing 500 Hz and 1 kHz alternate cleanly meant the hardware end-of-block signal was a dependable point to switch. Six rising tones then made a stale, repeated or missing RAM refill easy to hear. On 20 November the apparent movement across the speakers disappeared on headphones with the route held at centre.
Keep the file open
One successful SD read established the timing margin for that read. Eight pitches from one open file tested the repeated handoff. A real tune asked a different question again. Its last read held only 43 bytes. Playing exactly that many, then stopping at end of file, kept the final note intact without padding it to a full bank.
What the headphones established
The source recording was stereo. Converting it to mono gave the streaming experiment one destination and a known data rate. A little hiss was audible, but the tune stayed continuous. Testing two independent channels from RAM is the next way to isolate stereo from the cost of storage reads.
Stage 7: clean PCM and a clear direction
The first clean sample made DAC audio feel achievable. The next experiment made it sound like an angry bee. Stage 7 became a lesson in protecting a known working path while investigating how to extend it.
Extending the sound without disturbing AY
PT3 music and AYFX effects already had an established architecture. I wanted sampled sound to add another choice, so the AY baseline had to remain a reference throughout the DAC experiments. Build 54 would become a DAC checkpoint, not a declaration that every previous baseline had been replaced.
Why looping sent us backwards
Automatic DMA restart looked like a route from one short sample to continuous sound. On the machine it produced severe corruption, closer to an untuned AM radio than the original recording. Moving the persistent source into MMU4 did not recover the clean audio either. These were useful negative results: adding repetition or changing the memory window was not enough to produce dependable playback.
Return to the smallest proven operation
We returned to the proven source arrangement at $C000 and a single-shot DMA transfer. Clean playback came back. The practical lesson was to keep that operation intact and build deliberate buffer switching and refilling around it, rather than alter the successful DMA path again. Automatic restart and the MMU4 persistent-window experiment were rejected for the current design.
Make the test answer one question
A multi-frequency sample then seemed to move from centre to right during playback. Instead of treating that impression as proof of a routing fault, we used a DAC-only, fixed 1 kHz tone. Its left, centre and right positions were strong and distinct. Removing the changing frequencies made the routing easier to judge and pointed to perception or speaker/room acoustics in the earlier test, without identifying one particular acoustic cause.
A milestone with a boundary
The result gives the next stage a reliable starting point: buffer around the clean single-shot path. Continuous audio and streaming remain engineering work. The Progress entry records the precise Build 54 format, transfer settings and acceptance limits; this story explains why those settings became the reference.
A solid foundation for new sounds
Before exploring sampled sound, I wanted a game to be able to choose its music and effects without inheriting the test programme’s fixed assets. That meant proving resource switching and defining how the driver describes its available playback options.
Let the game own its sounds
The game supplies the loaded resources and keeps them available while they are played. Correcting the BASIC tests let us check that relationship on the real machine. It was important to distinguish a problem in the harness from a fault in the playback engine; changing the driver before establishing that distinction would have risked a working path.
Make capability reporting honest
Stage 6B gave playback identity, capability reporting and selection a common framework. At this checkpoint AY was implemented; naming DAC and Pi as possible choices did not make either play sound. An unavailable option needed a clear refusal rather than an optimistic success response.
Keep a reference before the next experiment
Regression checks kept the familiar music, effects and positioning beside the new selection work. Organising the accepted Build 48 package then made the reference easier to find: driver, assets, documentation and tests belonged together. The purpose was to make the next experiment easier to judge, not to change the sound during a repository tidy-up.
DAC research followed this checkpoint. Its later results belong to the Stage 7 entry; Build 48 remains the established AY reference.
Keeping the music intact
A balancing rule that sounded acceptable with one tune took richness away from another. That changed the priority of the work: preserve what the composer’s player is doing before imposing a global volume treatment.
Use more than one test asset
Trying several PT3 tracks exposed a weakness that the original tune had hidden. Bypassing the blanket volume remapping restored the character of the music. Earlier temporary lowering had also introduced crackling, so neither experiment could be called a finished mixing feature.
Give AY a job it does well
The position tests led to a similar boundary. Matched left, centre and right effects with distance levels were useful; forcing extra intermediate AY positions risked modulation and compromised the clean single-source approach. Smooth movement was left for sampled-audio development.
Keep resource ownership visible
Runtime tune and effect-bank switching made the driver more reusable. Letting the game supply its own resources was the next step, but a broken BASIC test delayed acceptance. That was a reason to repair the test and retain the proven builds, rather than promote the candidate on the strength of its intended behaviour. The dated Progress entries separate those candidates from the later accepted results.
Sound for ship combat
shipControl adds useful game actions for audioControl to respond to: firing, taking a hit, running out of ammunition, overheating and changing modules. The game will choose which of those actions should make a sound.
Events connect the services
BASIC can map a reported ship event to an audio request. shipControl will keep its movement and combat responsibilities, whilst audioControl continues to manage sound playback and priorities.
Preserve the existing audio direction
This planned integration does not replace the proven music-and-effects foundation or the later horizontal positional sound, stereo expansion and elevation plans. The ship-event example will follow the first working shipControl reports.
Giving sounds a place
From playback to a sound world
The music-and-effects foundation is now proved, including consistent playback in 50 Hz and 60 Hz modes. That gives me a clear starting point for the next question: how can a sound tell the player where something is happening?
I want a waterfall, an approaching enemy or a moving effect to belong to the game world. Its position should follow the listener and the source, rather than the edge of the screen, so it can remain audible as the view scrolls.
Two different ways to shape the scene
The plan now separates positioning an individual sound from widening the overall stereo soundstage. Optional direction cues could make left and right more convincing, while a Q-Sound/Q-Expander-like effect of our own could give ambience and ghostly voices more space.
That extra width should be a choice. A nearby character’s voice may work better tightly placed, while whispers, narration or cavern ambience could use a broader presentation.
A boundary between V2 and V3
V2 will cover horizontal position, distance, moving sampled sounds and optional stereo expansion. V3 will add above/below perception. Keeping that boundary clear gives each version a manageable purpose, while preparing for voices and effects to share the same audible world later.
The next practical step
These spatial features are still to develop. The immediate work is music-and-effects balance: making ordinary sounds clear, then optionally lowering the music for an important warning, injury or death and restoring it when that sound ends. I will build from the proven checkpoint one stage at a time.
Music, effects and timing
Consistent music speed
I am building the driver in small stages on the actual machine. Moving from the original timing limit to equally paced playback in both video modes is a concrete improvement. More ambitious sound features will follow as separate development steps.
A deliberately silent event
The silent world event in the second-stage test looked like a failure until I checked what it was intended to do. It had no sound assigned. Correcting the wording made the result clear without changing the driver. Good tests need understandable messages.
An approaching enemy
A warning is most useful at the moment an enemy enters range. Reporting that change once gives the controller a clear cue and avoids a stream of identical requests. The game can choose a different warning for a boss, a missile or another threat.
Coordinating game audio
The useful gap was coordination. There are already ways to play music and effects; I wanted one place to decide what should be heard when the game becomes busy, and to keep those sound choices out of the movement and enemy systems.