Is it possible to save audio sample values from alteration while using wavwrite function of matlab?
显示 更早的评论
Hello, I am manipulating values of audio samples for audio steganography.When i have my manipulated audio sample object, i want to write it as a new audio file using wavwrite. But when i create object of this newly created audio file, i find sample values different from the previous values of samples which i had manipulated.
Is there any method to control wavwrite function in order to keep my sample values as same as these were before wavwrite?
回答(1 个)
Image Analyst
2015-4-21
0 个投票
You're either writing out the same, original audio data, not the altered data like you thought, or you're reading in the same original audio data, not the altered file.
6 个评论
manisha sharma
2015-4-22
Image Analyst
2015-4-22
This works just fine for me:
y=wavread('guitartune.wav');
y(1000:1007)
% Make y_enc
y_enc = y;
y_enc(1000:1007) = 0.5;
y_enc(1000:1007)
% Write it out.
wavwrite(y_enc,44100,'s.wav');
% Now make another object from this "s.wav" file:
d=wavread('s.wav');
d(1000:1007)
delete('s.wav');
ans =
-0.010437
-0.010132
-0.0099792
-0.010193
-0.010223
-0.009552
-0.0086365
-0.007843
ans =
0.5
0.5
0.5
0.5
0.5
0.5
0.5
0.5
ans =
0.5
0.5
0.5
0.5
0.5
0.5
0.5
0.5
What did you do differently?
manisha sharma
2015-4-22
Image Analyst
2015-4-22
I don't know that much about it. I wouldn't think doubles would have much of a problem out in the 5th decimal place but maybe it does. Or maybe it has something to do with encoding it at 44100. Can you try other rates?
manisha sharma
2015-4-22
manisha sharma
2015-4-23
类别
在 帮助中心 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!