# Generating inaudible sound waves using MATLAB

I want to generate inaudible sound waves (above 18kHz) with 48kHz sampling rate using MATLAB.

Generating a sound wave with 18kHz frequency makes it inaudible.

I've inserted the data in the 18kHz band in the frequency domain, converted it into time domain signal. Then I've duplicated the signal, concatenated it, and played it.
As expected, the played sound was inaudible.

The problem is, I want to play the inaudible sound with an interval.
(playing sound wave for 1.75ms and having a silence period for 4.17ms repetitively)

Because of the inserted silence period, the concatenated signal is no longer inaudible because new frequency components are added.

How I can transmit inaudible sound with time interval?

• Generate the 18KHz sine wave in time domain and then append it to required silence. – arpit jain Aug 2 '17 at 11:36
• Thanks for the reply! But the wave is still audible even when I play the 18KHz sound and play the silence period repetitively. – danielle Aug 2 '17 at 11:48
• Even if you are generating sine wave in time domain ? possible reason for audibility will be aliasing. you are using 18KHz wave with sampling rate of 48KHz, though it passes nyquist criteria but it is suggested to use sampling rate to be more than four times the maximum input frequency. – arpit jain Aug 2 '17 at 11:57
• I've used the code below to create the signal in the time domain: fs = 48000; T = 84/fs; t = 0:(1/fs):T; f = 19000; a = 1; y = asin(2*pif*t); while 1 sound(y,fs); end In this case, the signal makes a sound even without the silence period. But thank you for your comment! – danielle Aug 2 '17 at 12:42

Eventhough the exact cause of those wide-spread line spectra is not very clear to me from the supplied information, it's most probably due to the on-off switching implied by the silence period you have added in between your message signals.

The on-off waveform is an implicit operation you multiply to your signal. Which has a value of $1$ during the sound interval and a value of $0$ during the silence interval. The fundamental period of that waveform is roughly 200 Hertz.

More technically, the on-off switching with a given duty-cycle will shift the message spectrum by the amount of k-th harmonic frequency for each significant harmonic present in the continuous Fourier series of the on-off waveform.

In fact this is a method of realizing an analog modulation algorithm. Multiplication with a rectengular wave creates a multitude of harmonic centered up-mixed spectrums, of which only one is selected by a suitable bandpass filter.

Therefore as a solution offer, you could try the following:

1- Generate the 18kHz (already bandpass) message signal in time domain.

2- Insert the silence periods accordingly.

3- Apply a BPF (bandpass filter) centered around 18Khz.

When implemented carefully this should yield a solution to your problem I guess. Distortions in the message signal can happen however.

• A narrow BPF will remove (blur) most of the modulating signal waveform. Thus making extracting the time information (especially in added noise) more difficult. – hotpaw2 Aug 2 '17 at 14:50
• @hotpaw2 You're right. The passband of the BPF should allow for the message bandwidth to pass undistorted for practically perfect recovery. But there's even a more serious problem here, as the on-off modulation has a period of 200 Hz, the shifted spectrum will overlap unless the message bandwidth is narrow enough. So the user should be aware of this. – Fat32 Aug 2 '17 at 15:25
• My reply was late because I was trying things if they were working. I erased the frequencies outside the message bandwidth as you have suggested, and the sound is now inaudible! The data is also recovered (although not perfectly). Thank you so much!!! – danielle Aug 9 '17 at 4:54

You might want to try windowing your high frequency tone burst with a signal that is also inaudible, say non-rectangular window envelopes with a spectrum mostly below 20 Hz, with a randomized (pseudo-random if needed to carry information) distance between them to remove periodicity.