3
\$\begingroup\$

When I record audio from the line-in jack on my laptop, what function of voltage produces recorded amplitude?

followup/example:

Since I've been told "voltage", unqualified: I apply a voltage square wave to a mono cable. (tip-sleeve switches between 0V and +5V every second). Since the voltage as a function of time is a square wave, why is the waveform of the recorded audio not a square wave?

5V .5Hz Square Wave Signal

And here's a recording of the same signal at 40Hz:

5V 40Hz Square Wave Signal

\$\endgroup\$
  • 1
    \$\begingroup\$ Voltage. Units of measurement: [A/D counts]. \$\endgroup\$ – Nick Alexeev Oct 28 '13 at 1:57
1
\$\begingroup\$

You are recording voltage (1V p-p for line level) over time. The line signal is high pass filtered before the voltage sampling by the ac coupling capacitor. Ideally it is also low pass filtered by an anti aliasing filter.

If your square wave had higher frequency (say, 440 Hz) then it would show the voltage sampling better without the high pass filtering getting in the way.

\$\endgroup\$
  • \$\begingroup\$ Even higher-frequency square waves show some deformation when recorded. What techniques do circuit designers use to get around this problem? \$\endgroup\$ – pje Oct 30 '13 at 17:26
  • 1
    \$\begingroup\$ Do the analysis in the frequency domain, rather than the time domain. It turns out that the eye is very sensitive to phase and frequency response differences when plotted in the time domain, whereas ears are not at all as sensitive in the same way. Or add a lot higher capacitance, which will translate to a lower cut-off frequency. Try a 470 uF capacitor instead of whatever is there now. Or use an inverse filter. Measure the impulse response of the filter that's there, and convolve your input signal with the inverse of that to get the "original "signal. \$\endgroup\$ – Jon Watte Oct 31 '13 at 23:43
3
\$\begingroup\$

Between the line-in tip of the socket and the ADC there is a series capacitor which converts the square wave into what you see.

In the One Laptop per Child XO laptop, we added a way to bypass this series capacitor for DC sampling, but on typical computers this is not a design feature. On sheet 13 of the schematic look for C35, and consider the switching element over it. The host can control the mode through software.

\$\endgroup\$
  • \$\begingroup\$ were you a developer on that project?? Love to chat about it for my design class. \$\endgroup\$ – Scott Seidman Oct 28 '13 at 18:48
  • \$\begingroup\$ Yes. But I was not responsible for this part of the design. Contact me at quozl at laptop dot org. \$\endgroup\$ – James Cameron Oct 30 '13 at 5:04
2
\$\begingroup\$

The waveform is not a square, because the input of your audio card has a coupling capacitor. The coupling capacitor will suppress the DC component of your signal, it behaves like a derivative function. The derivative of a constant signal is null.

That's why you wee this kind of spikes instead of the square. It's closed to be the derivative of the square:

Look at this image, showing mic input of a Sound Blaster card enter image description here

If you want to record a square waveform, you must generate a triangle wave.

\$\endgroup\$
  • \$\begingroup\$ So, to summarize: this would mean we're not recording voltage as a function of time, but dv/dt as a function of time. \$\endgroup\$ – pje Oct 28 '13 at 15:43
  • \$\begingroup\$ Yes...and no. No because y-axis is the voltage between the right side of the coupling capacitor and the ground. Yes because the voltage at the right side of the coupling capacitor is roughly equal to the derivative of the left side, dv/dt. It's important to keep that difference in mind because on some hardware you could shunt this coupling capacitor. \$\endgroup\$ – RawBean Oct 28 '13 at 15:45
  • \$\begingroup\$ A triangle wave will not generate a square wave within the frequency range of the input, unless you clip it. \$\endgroup\$ – Jon Watte Oct 28 '13 at 19:23
2
\$\begingroup\$

An audio signal is just a waveform. The Y-axis is voltage or amplitude.

The number of times that the waveform is sampled per second is the analog-to-digital converter (ADC) sampling frequency (for example 22kHz or 44kHz, etc.)

\$\endgroup\$
  • \$\begingroup\$ OK, so, as a followup: a constant voltage between tip (+) and sleeve (ground) should correspond to a constant positive amplitude? \$\endgroup\$ – pje Oct 28 '13 at 3:33
  • \$\begingroup\$ Yes, but a constant (unchanging) voltage is the same, acoustically, as zero. Think of the amplitude of an audio waveform as the position of a speaker diaphragm. If the voice coil holds the speaker fixed at any particular position, no sound is produced. \$\endgroup\$ – JYelton Oct 28 '13 at 4:05
  • \$\begingroup\$ An instantaneous value is the value at a particular time. If you have a 20Hz (50ms period) sine wave which is 10V peak to peak, for example, and you measure it exactly 12.5ms after it starts, you will get a value of +5V because it was at the 5V peak at the time. At 25ms, its value will be 0V again. At 37.5ms it will be -5V, and at 50ms it will have completed one cycle and return to 0V. All of these "slices in time" are just the voltage that was measured at that particular moment. \$\endgroup\$ – JYelton Oct 28 '13 at 4:14
  • \$\begingroup\$ resolution is not the same as sampling frequency. \$\endgroup\$ – markrages Oct 29 '13 at 18:51
  • \$\begingroup\$ @Mark Oops I'll correct that. \$\endgroup\$ – JYelton Oct 29 '13 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.