问题
I am doing a project in audio stenography. I need to embed some text in an audio signal(.wav file) . So i converted the audio signal ranging from -1 to 1(double) to -32767 to +32767(int16) so i cold embed the data in the LSB of the coefficients. The problem now is that i don't know how to get the values from int16 to their respective double equivalents.
I have used the following code for normalization:
[y, fs, nBits,opts]=wavread('one.wav');
y2=y-(min(y));
y2=y2/max(y2);
y2=y2* (2^16 - 1) - 2^15;
y2b=int16(y2);
can anyone guide me about the reverse process of this?
回答1:
Looks like you need to save (and store) the ymin = min(y)
and y2max = max(y2)
for the reversal. Then get the double version ofthe int16 and perform the reversal procedure as needed:
y3 = double(y2b);
y3 = (y3 + 2^15) / (2^16 - 1);
y3 = y3 * y2max;
y3 = y3 + ymin;
Then store y3 to the output file as needed.
回答2:
elomage reversed the normalisation, I don't see any reason to do so because the lsb gets lost.
double(x)/intmax(class(x))
来源:https://stackoverflow.com/questions/22894559/normalisation-of-audio-signal-and-reverting-to-original-matlab