Cannot understand the attenuation in signal from PC to microcontroller(NI theRIO)

adcaudiodsp

I am working on Active Noise Cancellation Project. I came across a problem, where the signal is getting attenuated as the audio bit depth changes from PC data to Microcontroller and I cannot understand it!
My circutit :I connected Audio Output(Head phones) of PC[which is supposed to be analog signal] to Audio IN of NI myRIO 1900 device using AUX cable (two way 3.5mm jack cable). I have a pre-recorded signal(.wav) of sinusoidal waveform with Amplitude 1, Frequency 2kHz, 40000 Sample Rate, 80 Number of Samples, Bit depth( bits per sample) = 16.
Now, I just played .wav file using windows media player and tried to record the waveform on NI myRIO module. Surprisingly, I am getting an attenuation of the signal corresponding to the volume reduction in PC(not linear!!). Only I can see the waveform in microcontroller close to amplitude 1, when I increased the volume of the system to 100%. Please explain this !!

The ADC of NI myRIO has its Resolution as 12 bits but the audio Output(.wav file) is 16 bit data. I am expecting it does not have to matter except in quantization errors, as at the PC Audio Out, the audio data should be converted to analog and and again at the 'NI myRIO Audio In', this analog signal will be sampled! (please correct me if I am wrong !)
Another question is, I have tried the same with sinusoidal sound of Amplitude 2.5, now the audio signal is clipped off at 1V above and below -1V.
enter image description here
ADC(NI myRIO) nominal range is 2.499V to -2.5V! Is it bacause of the bit depth conversion?
Please explain these things !TQ
EDIT: I am not converting either 16 bit digital data to 12 bit digital data neither 12 to 16 !! I happen to have a 16 bit audio data, when I played this through windows media player will get converted to analog signal at head phones terminal, and I am feeding this ANALOG Signal to an ADC of NI myRIO, which has 12 bit resolution.

Best Answer

After you've added more info to your question, it would seem that the cause is less to do with the sampling (bit) depth and more to do with the analog connection between two systems.

It looks like you are reaching the limits of the PC's audio output. PCs use line level output, which ranges from +1V to -1Volt. That lines up with the level you are seeing on the myRUI 1900 - you've got a chart there showing the signal in ranging from 1V to -1V which is to be expected.

The signal is clipped because your signal is being clipped by the PC. If you try to send a signal out of the PC with an amplitude that is too high, it will be clipped.

It might be clipping in software before it hits the hardware, or it might be clipping in the hardware. Some parts of the volume controls are in the hardware, some parts are in the software.

The parts of the volume controlling in software can amplify a signal to the point that it can't be represented in 16Bits anymore and gets clipped.

The parts of the volume control in hardware can amplify the signal to the point that the output amplifier itself clips.


In summary:

  1. You cannot generate a signal with a PC that will cause a full scale input on the myRUI 1900. The PC simply cannot generate a signal with the needed voltage range.
  2. Cranking up the volume on the PC to try to force a higher level will only cause clipping, which results in the signal you have captured with the myRUI 1900.