how can i convert the recorded voice into noise using any algorithm in matlab?

1 view (last 30 days)
i'm trying to make my own algorithm which is capable of converting the reocrded voice into noise, and when i apply the reverse process on the converted voice; i.e. noise, i should get the original recorded voice. well, i'm doing this, so that if someone plays that voice, it appears to him like a noise.. and when i perform the reverse operation on that converted voice, i.e. noise, i should get the original voice back? here's the code how em making the recorded voice into noise? this code is working but upto certain extent. the recorded voice is converted into noise but one can hear the original voice in the background, and if someone plays that noise into some audio player using slow mode, a man can hear that voice.. can someone do some modifications in that code,so that i should completely become the noise and no one can hear that voice, even if someone plays that voice in some audio player in slow mode.. and when i apply the reverse process, i should get the original voice back.. the code is:
c=wavread('haseeb');
a=(c-min(c))/(max(c)-min(c)); % normalization to bring the voice values in the range [0,1]
for i=1:length(a)
% speading the values into the range[-1,1]
if((a(i,1)>=0)&&(a(i,1)<=0.2))
b(i,1)=a(i,1)-1;
elseif((a(i,1)>0.2)&&(a(i,1)<=0.4))
b(i,1)=a(i,1)+0.6;
elseif((a(i,1)>0.4)&&(a(i,1)<=0.6))
b(i,1)=a(i,1)-0.5;
elseif((a(i,1)>0.6)&&(a(i,1)<=0.8))
b(i,1)=a(i,1)-1.2;
elseif((a(i,1)>0.8)&&(a(i,1)<=1))
b(i,1)=a(i,1)-0.4;
else
end
end
  1 Comment
haseeb
haseeb on 7 Jul 2014
i don't want to add any linear noise, e.g. awgn or salt&pepper.. i've to do some programming to make the recorded voice a noise, and then apply the reverse process on converted voice, i.e. noise to get back the original recorded voice. hope someone will help me :)

Sign in to comment.

Answers (2)

Image Analyst
Image Analyst on 22 Jul 2014
Just scramble:
clc;
m= 11:19 % Sample data
% Get random locations where to send elements to.
randomLocations = randperm(numel(m))
% Get a new array, pulling elements from those locations.
% It will be m, but scrambled.
scrambled_m = m(randomLocations)
% Restore signal:
% Find out where things need to come from.
[~, sortOrder] = sort(randomLocations)
% Rearrange elements to original order.
restored_m = scrambled_m(sortOrder)
In the command window:
m =
11 12 13 14 15 16 17 18 19
randomLocations =
3 9 5 4 6 7 8 1 2
scrambled_m =
13 19 15 14 16 17 18 11 12
sortOrder =
8 9 1 4 3 5 6 7 2
restored_m =
11 12 13 14 15 16 17 18 19

John D'Errico
John D'Errico on 22 Jul 2014
Edited: John D'Errico on 22 Jul 2014
Image has the right solution, almost. In fact, I like it, but it is imperfect since you need to know the sort order, and since that order was random, you would need to store that order with the signal. (You could store the random seed of course, but you would still need to store some information.)
Instead, a simple deterministic scramble should work nicely, and all you need to know is the length of the signal. For example, suppose your signal has length 20. I'll call it n. We need to choose an integer that is relatively prime to the signal length. I'll choose a sufficiently large prime number that would be unlikely to cause a problem. 94906297 should suffice, chosen as the smallest prime number that exceeds sqrt(2^53).
The number 94906297 is always relatively prime to n as long as n is smaller than 94906297. It will yield a perfectly viable (apparently semi-random) scramble of the numbers 1:n. For
n = 30;
mod((1:n)*94906297,n) + 1
ans =
Columns 1 through 22
8 15 22 29 6 13 20 27 4 11 18 25 2 9 16 23 30 7 14 21 28 5
Columns 23 through 30
12 19 26 3 10 17 24 1
As well, since 94906297 large enough, but not too large, you have no fears of overflowing a double on any signal of reasonable length.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!