NAudio playback sample values much smaller than recorded values

333 Views Asked by At

When I record with nAudio using waveIn the buffer values that I get are large, my chart needs to be scaled to around 20 000 to display the samples correctly. When I replay this audio from the recorded wave file and capture samples from the waveOut using a SampleChannel sample provider the values are tiny.

The file format says the values it is giving me have a blockAlign of 8 with 32 bits per sample (float?) and 2 channels. Does this mean that 2x4 floats should be combined in some way to create each channels value?

I notice the floats in the supplied buffer arrays are discrete, they are multiples of 3.05175781E-05 in float format.

I'm at a bit of a loss as to what to do here. Do I need to process the floats that a waveout sampleProvider creates?

1

There are 1 best solutions below

2
On BEST ANSWER

With waveIn, you're likely recording 16 bit samples, so they are short or Int16 values in the range -32768 to 32767

When you deal with floating point (float or Single) samples, they are normalised into the range -1.0 to 1.0.