• Advertisement
Sign in to follow this  

SDL format of audio sample

This topic is 3762 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am playing with SDL's audio library, and I looking for documentation on the format of audio samples. For example when configuring the system with 16 bit depth and 2 channels, I have figured out that the first 16 bits relate to the left channel and the following to the right one. Now I'd like to know the format of a sample. My guess is that it should contain information related to both the pitch and the volume. Anybody knows ?

Share this post


Link to post
Share on other sites
Advertisement
ok,
I have played a little more with the thing, and now I understand that I hadn't understood how the thing worked. There is no such thing as the format of a sample, apparently it is a value ranging from -1 to 1 that can be encoded in 8 bit, signed / unsigned 16 bit, ...

Share this post


Link to post
Share on other sites
there is an unfortunate terminology revolving around this stuff

Sometimes "sample" means "sound" or "instrument" or whatever

But idealy "sample" means a single data point of a "sound" or "instrument" at a specific time (T)

In recording you take "samples" of a sound at regular intervals (T=0, T=1, T=2, ... T=n) .. commonly these "samples" are encoded using Pulse Code Modulation (PCM) which is that -1.0..+1.0 business .. in simple terms, each "sample" is taking or encoding a measurment of the amplitude of the sounds vibration at time T

PCM sounds are said to be in the "time domain" and you might use a fourier transform to convert a PCM sound to the "frequency domain"

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement