Change sound clips from audible to ultrasonic range

4 views (last 30 days)
I have sound clips that are about 3-4 seconds in human audible range. I want to convert them into ultrasonic range so that when I transmit them they are not audible to humans. I read that I need to use amplitude modulation. I used the modulate function of matlab.
[y,Fs] = audioread('TakeASelfie.mp3');
x = modulate(y,30700, 62000, 'am');
soundsc(x,62000)
audiowrite('modulated.wav', x, 62000)
In the above example, I was trying to convert my audio clip to 30.7kHz. However, after I performed modulation, the length of the clip was decreased. How can I change the frequency of my sound clip without changing the length of it? Thank you.

Answers (1)

Mark Schwab
Mark Schwab on 26 Jan 2018
The behavior that you are experiencing is not expected. I tried reproducing this on my machine and the size of the signal remained the same after modulation. You can test this out by running the following code
load handel;
x = modulate(y,1000,Fs,'am');
audiowrite('tmp.wav',x,Fs)
I tried distorting the data of my signal by adding NaNs or infs to y but this still returned a signal of the same length as the original. Can you provide your .mp3 file?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!