views:

107

answers:

4

From the OpenAL documentation it looks like if an Sample is one single floating point value like lets say 1.94422

Is that correct? Or is a sample an array of a lot of values? What are audio programming dudes talking about when they say "Sample"? Is it the smallest possible snippet of an audio file?

I imagine an uncompressed audio file to look like a giant array with millions of floating point values, where every value is a point in a graph that forms the sound wave. So every little point is a sample?

+1  A: 

According to the Wikipedia article on signal processing:

A sample refers to a value or set of values at a point in time and/or space.

So yes, it could just be a single floating point value. Although as Johannes pointed out, if there are multiple channels of audio (EG: right/left), you would expect one value for each channel.

Justin Ethier
Usually when you have > 1 value at a given sample time it's referred to as a `frame`, e.g. for stereo audio you have 2 samples per frame.
Paul R
+1 to Paul's comment. I have been beaten by this confusing terminology (in other contexts -windowing- a `frame` is a set of several consecutive samples)
leonbloy
+2  A: 

I imagine an uncompressed audio file to look like a giant array with millions of floating point values, where every value is a point in a graph that forms the sound wave. So every little point is a sample?

Yes, that is right. A sample is the value calculated by your A/D converter for that particular point in time. There's a sample for each channel (e.g. left and right in stereo mode. Both samples form a frame.

Johannes Rudolph
+4  A: 

Exactly. A sample is a value.

When you convert and analog signal to its digital representation, you convert a continuous function to a discrete and quantized one.

It means that you have a grid of vertical and horizontal lines and all the possible values lie on the intersection of the lines. The gap between vertical lines represents the distance between two consecutive samples, the gap between horizontal one is the minimum differences you may represent.

In every vertical line you have a sample, which (in linear encoding) is equal to n-times k where k is the quantum, minimum differences references above.

Enrico Carlesso
1+ for pointing out the term discrete. Could have been one of my next questions. Now I get it what discrete means. Thanks man.
dontWatchMyProfile
+1, although did you mean to say a "continuous function"?
Justin Ethier
I'll print this out and hang on my wall. Perfect.
dontWatchMyProfile
@mystify => You're welcome. @Justin => I mean that an analog signal may be compared to a continuos function, like sin(x), that is is to say that both x-values an y-values lies in Reals numbers, opposite to discrete and quantized digital rapresentation which both values are Rational (or better, k-times a real value, with k in Natural - in linear encoding of course). To be more clear, values should lies in rational domain due binary representation, but I can fix my quantum to pi and store the nautral multiplier.
Enrico Carlesso
@mystify: I'm glad to see that may years of engineering give some fruits :D
Enrico Carlesso
+1  A: 

In audio programming, the term "sample" does indeed refer to a single measurement value. Among audio engineers and producers, however, the term "sample" normally refers to an entire snippet of sound taken (or sampled) from a famous song or movie or some other original audio source.

MusiGenesis
+1 for pointing out th edifferent meanings
sleske
Also, in music shops there are *samplers* , yet something different...
sleske