gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Audio > Sound Analysis

#26323 - keldon - Sun Sep 12, 2004 10:36 pm

http://www.dkauk.com/klogic/temp/SoundAnalysis.zip

This file analyses an audio file to show you a distribution of sound pressure, which is basically the difference between one sample and the next.

What you'll find is that you can represent sound in a format based on Pressure instead of Sound Waves using less bits.

I understand compression but am not comfortable with it enough to pursue my findings.

This program works only with 16-bit UNCOMPRESSED data
---
This file was created because I have believed for years that you can better represent sound using relative data instead of linear. This has confirmed my beliefs (although it's nothing new, 1-bit sampling is based on this philosiphy).

As for my representation of a wave, I believe that a simple set of vectors that closely follow the waves will draw a simple picture of the wave. Low-bit data will then correct that, for example:

Code:

+--------------------------------
|
|               +
|             +   +
|
|            .     .
|
|         +           +
|      .                  .
| +                             +
+--------------------------------

The diagram's plus signs represents a basic Vector. The periods are simply so that it LOOKS like a wave. Low Bit data will then fill in the important variations instead of a FAT 16-bit value.

#26324 - tepples - Sun Sep 12, 2004 11:49 pm

keldon wrote:
I have believed for years that you can better represent sound using relative data instead of linear. This has confirmed my beliefs

True, audio tends to have sample-to-sample correlation. Taking the differential between samples removes this correlation, resulting in smaller numbers to feed to the quantizer and coder.

Quote:
(although it's nothing new, 1-bit sampling is based on this philosiphy).

I've worked with 1-bit sampling on the NES, and it was horrid. Because it used a fixed step size, waveforms would either distort ("slope overload") or have horrible hissing as the reconstructed waveform goes up and down over the original ("granular noise"). Here's a picture of what I'm talking about. Various ADPCM (adaptive delta pulse code modulation) schemes improve on this by using automatic gain control on the differences; to learn how, download the 8ad codec and read the source code.

And this "simple set of vectors that closely follow the waves" is in effect a downsampled version of the original waveform. Storing the downsampled version along with the differences between this downsampled version and the original waveform is called "sub-band coding" or "wavelet coding"; MP2 audio uses a form of this.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#26329 - keldon - Mon Sep 13, 2004 1:05 am

Nowadays 1-bit coding is sampled at 5Mhz, so instead of a hiss there is sonic noise. But I would treat 0101 and 1010 as either 0101, or 0000 by letting the next bit decide. For example if the next bit was 0 then 0101 is 0000, and if it was 1 then 0101 is 0101.

Well as for the sound analysis, I've tested it on various wave forms and am pretty shocked with the results. e.g. I expected noise to have a near equal distribution but instead it had a slight weight on either side of low and high differences.