Jacob Vosmaer's blog

ADS sample lengths

2025-02-11

I have figured out where the sample end point is stored in Dynacord ADS audio files.

Previously

Snippet from a 1989 Dynacord brochure Source: deep!sonic

The Dynacord ADS was a sampler from 1989. I've come across a collection of floppy disk images for this machine that contain audio recordings and I've been reverse-engineering the filesystem and file format to extract the audio. This is made more challenging by the fact that I don't have access to the original machine. The tools I have been writing for this are on GitHub.

How long are the audio files?

The floppies use a sector size of 512 bytes. As I wrote in my first post, each file stored in the mystery filesystem of the ADS has a length that is a multiple of 512 bytes. I couldn't quite tell where the audio ended in each file so I truncated it just before the last sector.

This never felt right to me. Samplers typically set the sample length as a number of samples. This machine uses 16 bit samples so 512 bytes contain 32 samples, so if my initial solution was right each audio recording had a length that was a multiple of 32 samples. That seems unlikely.

Eventually I started noticing that a lot of the audio files that my tool was extracting did not end on a zero crossing. Combined with the knowledge that each audio file has a parameter which indicates the length expressed in samples I started looking again at the header data. This length has to be stored somewhere.

After staring at hexdumps for a while again, I figured out that the length in samples is stored as a 24-bit number in the audio file header. The 0-indexed offsets of the 3 bytes that make up the 24 bits are 20 (MSB), 18 and 19 (LSB). The code below calculates the length in 16-bit samples and then multiplies the result by 2 to get the size in bytes.


      s->len = 2 * (((int)chunkstart[20] << 16) + ((int)chunkstart[18] << 8) +
                    ((int)chunkstart[19] << 0));

This means that my original audio extractor was indeed truncating each file.

Waveform visualization of raw data from audio file You can see that the audio data in this file ends abruptly after 40909 samples (marked by the yellow dotted line). The first version of my audio extractor would have truncated the audio at 40704 samples (the closest multiple of 512 bytes).

Here is the header of that audio file.


00065600  d3 4c 41 50 45 44 20 47  20 20 3f 3f 1f bf b0 03  |.LAPED G  ??....|
00065610  a1 a9 9f cd 00 03 a1 a9  41 75                    |........Au|
0006561a

The length bytes are on the second line: 9f cd 00. This should be interpreted as 0x009fcd which is (... drumroll ...) 40909. Just like we saw in the audio editor!

You can see the code change that added the end point handling here.

What's next

I know that these audio files also contain loop points but I haven't been able to figure out yet where they are stored. Going by the manual of the related ADD-two sampler, there are three sample offsets stored in the audio file: "start", "loop" and "end". I have just found "end" but where are the other two?

To be continued, I hope.

Tags: music dynacord-ads

IndexContact