6

What does a sample of a audio file contain ?

When I run the command "sox file.wav -r 10 file.dat", the output is something like

; Sample Rate 10
; Channels 2
           0    0.00085449219   -0.0007019043
         0.1       0.01348877    -0.011260986
         0.2      0.015930176    -0.013214111
         0.3      0.014923096    -0.012390137
         ...      ...            ...

I know the first column is time the second and third column stand for the 2 channels.

But I would like to know is what does the channel value contain ?

Prakash Raman
  • 13,319
  • 27
  • 82
  • 132
  • Can you change this to proper English? I think you want to say: "I know each value IS a sample. But WHAT does a sample contain?". – AudioDroid Dec 20 '10 at 10:17
  • This is still not a very good expression of your question. I happened to have see you previous question, so I know what your are up to, but anyone else has NO IDEA of what you mean, by what you have written as a question. If you don't change it to a proper text soon, I (or somebody else) will down-vote it!!! – AudioDroid Dec 20 '10 at 10:37
  • Thanks again, I have redone it. – Prakash Raman Dec 20 '10 at 10:48

1 Answers1

6

Have a look here: http://www.hardwaresecrets.com/article/317. In short...if you think of a membrane of a loudspeaker, each sample is a measure of the position of the membrane at a moment in time. E.g. for that reason a sample does not represent the sound level directly. However the level of the audio signal can be calculated with the sample information, e.g. implementing a peak program meter algorithm: http://en.wikipedia.org/wiki/Peak_programme_meter

AudioDroid
  • 2,292
  • 2
  • 20
  • 31
  • I kind of get what you mean, although is there a way I can calculate the amplitude from a 'SoX' sample ? Since I plan to use that to make a waveform for an audio file. – Prakash Raman Dec 20 '10 at 10:47
  • 2
    the 'SoX' sample is the amplitude of your audio signal. 'SoX' sample = amplitude, waveform = sequence of amplitudes ('SoX' sample). When you are looking at the samples your are looking at the waveform. x-axis is the time (1.column), y-axis is the amplitude (2.column LEFT, 3. column RIGHT). – AudioDroid Dec 20 '10 at 11:47
  • Yep. Now it makes sense. Therefore If I need to make an sound waveform (but which represents the volume e.g. http://soundcloud.com/dawnbrian5/photograph-katie-by-brian-clayton). How would I go about doing that ? – Prakash Raman Dec 20 '10 at 11:53
  • 3
    That waveform does not(!) represent the volume. Volume is always > 0.0. The example you gave is an illustration of the actual waveform. By looking at it, you can however see the volume, by interpreting the amplitude in both directions as loudness and not considering the little differences but look more at the rough outline. That is in deed the volume. But what you want is a display of the waveform with lower resolution. Maybe this helps: http://codeidol.com/java/swing/Audio/Build-an-Audio-Waveform-Display/ (Oh and if you want to keep getting help you might consider up-voting helpful answers) – AudioDroid Dec 20 '10 at 13:00