Making bat recordings audible

I have some full spectrum bat recordings - 384kHz sample rate and the calls are around 30kHz. I’m interested in learning how to use Audacity to make them audible in the manner of bat detectors. These generally use “time expansion”, frequency division or heterodyne mixing (see Note: I have other software that can do these conversions for me - this is a learning exercise.

Time expansion is easy - I just have to reduce the speed or the sample rate.

I believe frequency division bat detectors work by discarding 9 out of 10 zero crossing points to reduce the frequency by a factor of 10. I can get an audible result by using the Change Pitch effect with a Percent Change of -90, but it doesn’t sound right. Does anyone know how this differs from what frequency division bat detectors do?

Heterodyne detectors mix a high frequency signal with the bat call, and one hears the difference in the frequencies. I tried mixing it with a 30kHz tone, but the result isn’t audible. Can anyone tell me what I’ve done wrong with this one?

Try the Change Pitch effect in Audacity 2.1.3 and enable the “Use high quality” option. Avoid changing the pitch by more than an octave in one pass. If you need more than an octave shift, apply the effect twice.

I had 2.1.2. I installed 2.1.3 and gave it a try, but with the high quality option, nearly all the signal is gone. Have I done something wrong, or is that effect not compatible with the 384kHz sample rate?

I think most frequency division bat detectors produce a square wave output, but it’s the heterodyne conversion I’m really interested in. I haven’t worked out how to get anything at all from that.

Perhaps you could post a short sample for us to try.

Thanks, here’s a 1 second sample.

Try this code in Audacity’s Nyquist prompt

(lowpass8 (mult s (hzosc 27000)) 10000)

For that code to work you’ll need to tick the box in Nyquist prompt …
code pasted into in Audacity's Nyquist prompt.png

It would appear that it’s not.
It does work at 192 kHz though, so a simple workaround it to change the sample rate in the track drop-down menu to 192000, then apply the effect, then change the track sample rate back to 384000 to restore the original tempo.

I tested this with a single pitch shift of -36 semitones (3 octaves) and the result seems pretty good to me.

And here it is, ‘cleaned up’ with a bit of Noise Reduction (settings, -12, 6, 3). I resampled to 44100 Hz (Tracks menu) before applying Noise Reduction (on long recordings, this is likely to take a lot less processing time than working with 384000 Hz sample rate).

That is using “legacy syntax”.
The recommended (current version) way to write that would be:

(lowpass8 (mult *track* (hzosc 27000)) 10000)

The Nyquist Prompt has a checkbox to set legacy syntax support. When using legacy (old) code, the checkbox must be ticked (checked). For current version code, it must be clear (not ticked).

Note for Trebor:
To ensure that the Nyquist Prompt runs code as the correct version, you can explicitly add a “version” line to the top of the code. This overrides the checkbox:

Legacy version:

;version 3
(lowpass8 (mult s (hzosc 27000)) 10000)

Current version:

;version 4
(lowpass8 (mult *track* (hzosc 27000)) 10000)

Interestingly. Trebor’s version sounds more like what I’ve heard on TV / Radio, presumably because of the common practice of using heterodyne conversion, but looking at the spectrum (Plot Spectrum) for the original and each type of conversion, the “Change Pitch” method looks a lot more like the original, so could be argued, more like what a bat hears.

That’s perfect! I actually tried (mult s (hzosc 30000)) last night, after I googled around and found I should be multiplying instead of normal Audacity mixing (which adds?), and found the code somewhere on the Audacity site. But I didn’t know to tick the box, so it just added in a 30kHz signal.

If I don’t do the 10kHz lowpass filter after, I see another signal at about 60kHz, just like it’s supposed to.

The example was in, near the bottom. Should that page be altered to mention the Legacy tick box?

Thanks. So track is the exact equivalent of s?

That’s excellent, thanks for that. Can you tell me what the High Quality option actually does differently?

I hadn’t thought to look at the spectrum, I’ve been looking at the spectrogram.

I really prefer the heterodyne sound, but I think the change pitch method is more practical, as the heterodyne requires you to choose a mixing frequency close to the bat call frequency, and it will sound very different at different frequencies. Changing pitch is pretty much a set and forget method, although it can be a problem for people with high frequency hearing loss if you don’t lower it enough.

Thanks, everyone. I didn’t expect to get this worked out so quickly. Now I suppose I should package the two methods into a proper effect.

That’s quite an old page. It should be updated to use track. There’s a lot of old examples floating around, which is the main reason that the “legacy” checkbox is provided.

Yes, but “track” also has additional properties (

“S” was a bit of a mistake really. Apart from the fact that using single character variable names is usually considered poor coding style (except for variables within a very limited lexical scope), it also clashes with “Adagio” notation which is supported by Nyquist, and in which “S” is defined as a sixteenth note (1/4 beat).

It uses a different time stretch algorithm; Subband Sinusoidal Modeling Synthesis rather than Synchronous-OverLap-Add.

The sound that it produces is more like how we imagine bat calls to sound, isn’t it. It retains the “chirp” quality better, as can be seen in the spectrum, and interestingly, one of the chirps appears to have two distinct tones within it (which is not evident in the “Change Pitch” version).

Yes. Multiplying two frequencies together will produce the sum and difference of the frequencies. For example, multiplying a 30 kHz sine wave and a 27 kHz sine wave will produce a 3 kHz sine wave and a 57 kHz sine wave. Of course the sample rate needs to be high enough to be able to see the higher frequency (the sample rate needs to be more than double the highest frequency that you want to see).

If you want to test this for yourself:

(mult 0.4 (hzosc 30000) (hzosc 27000))

What tricked me was that the code using s didn’t crash, so I had no clue there was anything wrong. I think it just replaced the sound on the track with the 27kHz tone.

I think the page should either have a warning about using the legacy option, or be updated to use track. How do I submit a request for that?

Would it be possible for the Nyquist Prompt effect to display a warning when it encounters s and the Legacy box isn’t ticked?


I’m interresting with bat sounds, and I’m looking for a way to hear bats in live in heterodyn with Audacity : is this possible ?

Audacity does not do real time processing, so no that’s not possible.