Re: [linux-audio-dev] Reverse-engineering files

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] Reverse-engineering files
From: Richard Dobson (rwd_AT_cableinet.co.uk)
Date: Fri Dec 01 2000 - 16:01:45 EET


If this is boring for the list, we can take this off-list.

Some findings so far, just regarding the APPL chunks. I haven't analysed
each file in detail yet, but there do seem to be enough consistencies
for my assertions below.

There is one APPL chunk per channel. The Ident for mono, or for Channel
1, is "SU7M", and for the second channel is "SU7R". I assume you can't
have more channels than two? It is true that the final byte of the size
field is always 0x7a (= 'z'), but I can't see any particular reason for
that (= 128-6?); the number is not related to any obvious factor such as
a sector size. The chunk always ends correctly at the size indicated.

After the Ident there appears to be a DWORD size field, which is always
a little less than the size of the chunk, by some high hundreds of
bytes. For example, in the file s01cl02.ssp the APPL chunk size is
0x0000317a (= 12666 bytes), and the DWORD field has 0x00002F00 ( =
12032 bytes).

Following this is a WORD 'offset' field, which for the first channel
seems always to be 0x0170. This corresponds exactly to the size of the
block of zero bytes before the audio data starts. The second channel can
have a different offset - possibly to ensure the data starts on a
1024-byte boundary, as the first channel does (thanks to a fixed heeader
size to that point). One other use for this empty block might be to
provide space for an interpolation FIR filter, when transposing over a
wide range.

The mystery DWORD is always a ~little~ less than the chunk size,
regardless of the size of the sample. Maybe it signifies the size of the
looping portion minus the attack? Or it is the absolute address of a
sample in the file itself? Since the data for two channels are not
interleaved, the presumption must be that it is mapped directly into
memory, so the mystery field may have something to do with memory
alignment, but the sizes do not support alignment to any sector size. It
does not look like a checksum, and in any case the numbers are identical
for the APPL chunks in a stereo file, suggesting some sort of pointer
identical for both channels. So one useful experiment using a hex editor
is to modify just this field in various ways, and see how the sampler
deals with it. If it plays, but the loop starts or ends in a different
place, the question is answered.

Anyway, it is possible using the hex editor to convert any of the mono
files directly into a 'normal' AIFF file by changing the 'APPL' field to
'SSND', keeping the next four bytes (chunk size), and zeroing the
following fields. This gives a useable soundfile with a short silent
portion at the start. For stereo files there is no way to access the
second channel without a file conversion program.

Richard Dobson

Paul Winkler wrote:
>
> (I'm CC'ing this to Mark Brady, a guy on the SU700 user group on
> Yahoo,
> who offered to take a look as well.)
>
> Thanks Richard and Bill for offering to take a look.
> I'm pleased with the progress I've made but still I can't seem to
> figure out
> those last few bytes...
> I still have a few of Jay's suggestions to try, but I've already spent
> a day on this project this week, and real-world work badly needs
> attention now. :(
>
> I've updated my notes page and made it navigable as well:
> http://www.slinkp.com/linux/su700notes.html
>
> It contains links to 2 zip archives of example sounds -
> a small one and a 1 MB one.
> These are at
> http://www.slinkp.com/linux/small_tests.zip
> and
> http://www.slinkp.com/linux/orig.zip
> respectively.
>
> I'm also posting my hacks to SoX:
> http://www.slinkp.com/linux/sox_ssphack.tgz
>
> BTW, Mark, since you're a linux geek as well as a musician and
> programmer, you should check out the linux-audio-dev mailing list, you
> may have things to contribute and things to learn. home page about the
> list is at http://www.linuxdj.com/audio/lad/
>
> --
> ................. paul winkler ..................
> slinkP arts: music, sound, illustration, design, etc.
> web page: http://www.slinkp.com
> A member of ARMS: http://www.reacharms.com

-- 
Test your DAW with my Soundcard Attrition Page!
http://www.bath.ac.uk/~masrwd (LU: 3rd July 2000)
CDP: http://www.bath.ac.uk/~masjpf/CDP/CDP.htm (LU: 23rd February 2000)


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri Dec 01 2000 - 16:31:35 EET