5
\$\begingroup\$

My problem is as following:

I'm trying to use my sound card to produce a custom repeating wave pattern which I will use in some laboratory test setup. My curve is based on a combination of a couple of sin/cos functions which I got from a Fourrier Analysis. I created an .WAV audiofile of this repeating pattern and try to play it from my sound card.

However when I record the audioprofile which my laptop is outputting it looks different.

Does anyone know why this is happening? and how to solve this problem?

Original audioprofile: correct wave pathern

Output from sound card: output from sound card

\$\endgroup\$
  • 6
    \$\begingroup\$ looks high pass filtered. \$\endgroup\$ – nidhin Feb 27 '15 at 12:04
  • 1
    \$\begingroup\$ What frequency are you generating? \$\endgroup\$ – Andy aka Feb 27 '15 at 12:05
  • \$\begingroup\$ Roughly 1.8 Hz. Is there something I can do about this? \$\endgroup\$ – JH6 Feb 27 '15 at 12:09
  • 4
    \$\begingroup\$ Average Soundcards are notourously bad at accurately reproducing waveforms, they are designed to create something that sounds as good as the original, so in less audible ranges they are terrible, and really no one cares. I remember a long time ago I wrote a program that took a scope output from the soundcard, a reference output, and applied some evolutionary algorithms to produce something I could send to the soundcard that would produce the desired waveform. It only ever worked for a specific soundcard, not even for the same model elsewhere. \$\endgroup\$ – PlasmaHH Feb 27 '15 at 12:40
7
\$\begingroup\$

A soundcard has a low frequency limit - this is created by a high pass filter of around 10Hz to 20Hz. This is what is disrupting your signal. For signals below 20Hz the output from the sound card is going to become progressively smaller and smaller.

Humans can't really hear below 20Hz so that is a technical reason for sound cards "not bothering" to reproduce frequencies of a few hertz. Another reason is that a big sub-bass signal could likely destroy cheap computer speakers without this sort of filtering being implemented.

Here is a frequency response for a typical soundcard: -

enter image description here

This was taken from this site. Note how the vertical axis is nominally centred around 0 - I take this to mean 0dB - note that at 30Hz, the response is down by 2 dB and at much lower frequencies there is going to be severe attenuation.

At 1.8 Hz I don' think you will adequately recover anything that useful but, you could try creating a low pass filter to "counter" the effects of the in-built high pass filter. Alternatively buy a professional card that can reproduce DC.

What I'd do as an experiment: -

Get a free version of a simulator such as LTSpice. Create a custom waveform to match your designed waveshape (in that software) and input it to a high pass filter (like in your sound card). Tweak until you are happy it looks like the actual sound card output. Then I'd try and design a "counteracting" low pass filter based around maybe a couple of op-amps and see if the original waveform could be reasonably restored.

If happy with the restoration I'd build the op-amp circuit and fingers crossed it should be OK.

Alternatively I'd over-egg the original waveform to try and boost the lower frequencies much more (pre-emphasis) to see how that would look after the sound card mangles it.

\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer. This looks like it is indead the problem. When increasing the frequentcy to 100Hz it is correct. Looks like I will have to find an other solution. Maybe use an Arduino with analog out. \$\endgroup\$ – JH6 Feb 27 '15 at 12:21
  • \$\begingroup\$ The arduino idea sounds reasonable but also consider my adds to my answer. \$\endgroup\$ – Andy aka Feb 27 '15 at 12:31
  • \$\begingroup\$ I will definitely consider your additions to you answer. Thanks a lot for your fast respons. \$\endgroup\$ – JH6 Feb 27 '15 at 12:33
  • \$\begingroup\$ You'll also need to check the frequency response of the large bass speaker you intend to output this through, and any amplifiers in the chain. (If you put it through normal headphones it will also be hugely attenuated at 1.8Hz) \$\endgroup\$ – pjc50 Feb 27 '15 at 12:39

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.