# How can I insert message bits into the frequency spectrum of an audio signal using Matlab?

I have been trying to use the DSSS spread spectrum technique for audio steganography in MATLAB. I multiplied the PN sequence with the message bits. Now I want to insert this spread message into a cover audio signal. In the time domain, I split the cover audio into blocks and just added the message. But I want to do it in the frequency domain, by taking the FFT of cover audio. How can I do that? Which is the better way?

• wow, these past two weeks, there's a lot of people that suddenly want to hide bits using Spread-Spectrum in audio. Are you guys all in the same lab group? – Marcus Müller Mar 3 '17 at 8:21
• @MarcusMüller you probably remember about me trying to learn basics of audio steganography, and it feels nice to see there are new people interested in similar topics. – kdrtkl Mar 3 '17 at 8:49
• @kdrtkl indeed I do :) ! it's really just surprising that this happens as a "wave". I mean, it's really an interesting topic, but the research wave on audio steganography (watermarking) really was a couple of years ago, so I'm honestly curious where that sudden rise of interest comes from! – Marcus Müller Mar 3 '17 at 9:04
• @ANJU what exatly do you want to do with FFT? Taking FFT of an audio signal will give you a conjugate symmetric sequence of complex numbers where you can obtain magnitude and phase values using abs()  and angle()  funtions in MATLAB, and it is no different doing it in time-domain unless you dont work on phase values or so. Consider conjugate symmetry property of DFT, if you attempt to edit anything directly after taking FFT of an audio signal. – kdrtkl Mar 3 '17 at 9:14
• @MarcusMüller There is always an interest in this field I guess. It is just google returns Stack Exchange posts in first pages when you try to go with "audio steganography" tag, the more questions posted here the more it is shown in google searches, so people come in with a "hope" just as I did before :) – kdrtkl Mar 3 '17 at 9:32

The FFT is just an implementation of the DFT. There's, mathematically, no difference.

The DFT is a linear operation. So it makes absolutely zero difference whether you add up two signals in time or frequency domain.

• In time domain,I am adding message values to the cover audio sample values.In frequency domain,I am adding message values to the fft coefficients of the cover audio.Do they make any difference? – ANJU Mar 7 '17 at 8:47

the way i would add message bits to audio is to add a very low-level Maximum-Length Sequence ("MLS" or "GF(2)" sequence or "PN sequence" or "LFSR sequence", i think these all mean the same thing). now you have to think of your audio as "noise" and the MLS noise as "the signal". so the signal-to-noise ratio is gonna be very, very bad and you'll have to use the Shannon Channel Capacity formula

$$C = B \log_2 \left(1 + \tfrac{S}{N}\right)$$

if the $S/N$ ratio is constant or

$$C = \int\limits_0^B \log_2 \left(1 + \tfrac{S(f)}{N(f)}\right) \ df$$

if the $S/N$ ratio is not constant with frequency.

you need to use that (but reverse the roles of signal and noise, your digital signal is the analog noise and vice versa) to get an idea of now long of an MLS to do one bit of information.

then you use cross-correlation with the raw MLS to sense the +1 or -1 amplitudes on the MLS.