Wednesday 7 February 2018

Bat Call Logger: Wolfson audio card frequency response

Having got my Wolfson Audio card working happily with a Raspberry Pi 2, I decided to try and check the frequency response.


As this card is described as a 'audio card' and the only figures I've seen relate to the audible range, I didn't have high expectations regarding its use in my Bat Call Logger.


Anyway, to find the answer, it was just a question of setting up some test gear and running a few checks.

Ideally, in this application the Wolfson card should have a fairly flat frequency response up to (say) 100kHz. I thought this unlikely, as the analogue circuitry was probably limited to the range 20Hz-20kHz, figures which were mentioned in the user documentation.

My initial tests seemed to confirm this, but then I noticed I hadn't changed the sample rate on Audacity.

test configuration


To test the response I ran the system without the Bat Detector, and used my FG-100 as a signal source connected to the Wolfson 'left' channel line-in.

Wolfson audio card frequency response at 192000Hz


The scope was used to ensure I had a 1.2V pk-pk input to the sound card at each test frequency. With Audacity sampling rate set to 192kHz, I pressed the 'pause' and 'record' buttons to activate the VU meters.

Audacity alsamixer Wolfson audio card


I then used alsamixer to adjust the Line-in input level. Each channel has both an analogue and a digital gain. I adjusted the analogue gain to about 30-35 to avoid clipping the sine wave, and brought the digital gain up to about 20 so that the Audacity VU meter indicated -6dB with a 10kHz input frequency.

frequency response


Increasing the frequency up to 40kHz resulted in a small reduction in output. It is difficult to be precise, but I'd say the reduction was no more than 1 or 2dB.
  • up to 40kHz, output change < 2dB
  • up to 65kHz, output dropped by 6dB
  • up to 80kHz, output dropped by 12dB
  • up to 95kHz, output dropped by 18dB
So from about 65kHz, the output drops by 6dB/15kHz.

According to happy Harry Nyquist, the sampling rate must be greater than twice the highest frequency of interest. Therefore 95kHz is about as high as we can go (i.e. 2 x 95kHz = 190kHz, and sampling rate is 192kHz).

I did a similar frequency response check with the Audacity sample rate set to 44100kHz and found the response was flat all the way up to 22kHz. So I suspect this poor response at a sampling rate of 192kHz is due to basic circuit design.

Just to put these frequency response figures in perspective, if we had a 30kHz bat shouting as loud as a 95kHz bat, the 30kHz bat would be recorded as being 8 times louder!

No wait! Its much worse than that. Taking the frequency response figures for my bat detector amplifier from an earlier post, I see that at 95kHz the output was 9dB below the 30kHz level. That makes the 30kHz bat over 22 times louder than the 95kHz bat!

...and if I could measure the response of my microphone, I'd probably be even more horrified.

Incidentally, there are a few very expensive ultrasonic microphone modules available from Pettersson Elektronik which would probably out perform my crude lashup. They quote a frequency response of 10kHz to 210kHz, but these figures are meaningless because they are not qualified by an amplitude range (e.g. within x dB from y kHz to z kHz).

waveform 'shape'


I carried out a check at 75kHz on the captured waveform. First, this is what the input to the Wolfson looked like;

Hantek Wolfson audio card

I captured the output using Audacity with the sample rate set to 192kHz;

Audacity Wolfson audio card frequency response


I then did a second capture with Audacity set to 384kHz;

Audacity Wolfson audio card frequency response


So what the hell is going on here? The Wolfson only supports sample rates up to 192kHz. So how is Audacity able to produce an apparently better capture with an invalid sample rate of 384kHz?

I may have to ask this question on the Audacity forum.

sample format


With the Wolfson, the other variable/option available is the sample format: either 16 bit, 24 bit or 32 bit.

Given the ugly look of the waveform at 75kHz, I can't see much point in using anything higher than the minimum setting: 16 bit. The higher the bit value, the better the amplitude resolution, but the larger the file size.

However, I expect I'll try a few bat call captures with a higher rate at some point.







No comments:

Post a Comment