normalisation of audio signal and reverting to original matlab

谁都会走 提交于 2020-01-06 14:17:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!