user3120554
user3120554

Reputation: 681

Advice on converting ultrasonic rat call signal into human audible range with matlab

I'm doing a project studying rats who squeak in the ultrasonic range (20kHz to 100kHz) using Matlab software and sound files.

I have (or will be getting) a couple .wav audio signals of these rats speaking, and among general analysis of these wave forms, I also want to convert these ultrasonic signals (outside of our hearing), into the human audible range (20hz to 20khz).

Could I get some advice on how to do this conversion (via Matlab programming and not by using equipment)

Looking into this, I've found names such as: -frequency division -heterodyning -envelope detection -time expansion

but looking into these it seems either they are explained in terms of what the equipment (bat detectors) does, or they sound incredibly similar to each other. e.g. frequency division and time expansion both involve dividing the incoming signal by 10

since I am looking into what seems to be unfamiliar turf, it would be great to find multiple ways to convert the signal (to my knowledge the names above have their own associated positive and negative traits)

Upvotes: 2

Views: 2240

Answers (1)

chipaudette
chipaudette

Reputation: 1675

Your question is a signal processing question more than a Matlab question, which isn't really what Stack Overflow is about, so you might get some negative votes.

There are indeed a number of methods of changing the frequency of audio (or any signals):

1) Slow it Down: The least disruptive to the signal is simply to slow down the audio. If you are looking to have rat signals up to 100 kHz, you'll need to sample the audio at 200 kHz or greater. Once you have your recording, simply re-save the wav file telling it that the sample rate is 44.1 kHz (or whatever). This will play it more slowly, but all the frequencies will now be audible (unlike the single side band demodulation discussed below). This is definitely the place you should start...it's the easiest and will sound the best.

fs = 200e3;                    %your original sample rate
myAudio = load('myFile.mat');  %your original audio
fs = 44.1e3;     %simply declare that you want a lower sample rate
wavwrite(myAudio,fs,16,'myFile_44kHz.wav');  %save it out at the new rate

2) Single-Side Band: Use the demod command to "demodulate" the signal to lower its frequency. There are a number of demodulation methods available with this command. I'd use "single side band (suppressed carrier)" because that is how the rat itself (and humans) create sound. To do the demodulation, you'll have to assume a "carrier frequency", as if it were a radio signal. If the lowest frequency of a rat squeek is 20 kHz, you can assume a carrier of 20 kHz. This operation will shift all of your audio down by 20 kHz. As a result the squeek that was originall 20-100 kHz, will now be 0-80 kHz. So, you won't hear the whole thing, but you'll hear part of it.

fs = 200e3;                    %your original sample rate
myAudio = load('myFile.mat');  %your original audio
[b,a]=butter(2,20e3/(fs/2),'high');        %define highpass filter
myAudio = filtfilt(b,a,myAudio);           %remove the low frequencies
myAudio = demod(myAudio,20e3,fs,'amssb');  %shift it down 20 kHz
wavwrite(myAudio,fs,16,'myWave_shifted.wav'); %save it out

3) Phase Vocoder (or other Pitch Shifting): To hear the whole 20-100 kHz range (which is 80 kHz bandwidth, which is 4x bigger than the 20 kHz bandwidth of human hearing), you've got to go to more extreme methods. These methods will make the audio sound bizarre, but you can give it a try. There are several algorithms. Look up "phase vocoder". Or, use one of audio processing software packages like Audacity, Raven, etc.

Upvotes: 2

Related Questions