how can i get back the original song into the program below?

[y,fs]=wavread('khuddar.wav');
a=zeros(100,2);
j=1;
for i=round(rand(1)*(10000-1)+1):round(rand(1)*(10000-1)+1)
a(j,:)=y(i,:);
j=j+1;
end
mi=min(a);
ma=max(a);
dif=ma(1,:)-mi(1,:);
c=dif(1)/255;
a=mi;
b=a+c;
x=zeros(255,2);
for i=1:255
x(i,:)=a;
a=a+c;
end
s=0;
for i=1:10
s=s+x(i,:);
end
a=s
z=0;
for(i=10:20)
z=z+x(i,:);
end
b=z
A=0;
for(i=20:30)
A=A+x(i,:);
end
c=A
B=0;
for(i=30:40)
B=B+x(i,:);
end
d=B
C=0;
for(i=40:50)
C=C+x(i,:);
end
e=C
D=0;
for(i=50:60)
D=D+x(i,:);
end
m=D
E=0;
for(i=60:70)
E=E+x(i,:);
end
g=E
F=0;
for(i=70:80)
F=F+x(i,:);
end
h=F
G=0;
for(i=80:90)
G=G+x(i,:);
end
n=G
H=0;
for(i=90:100)
H=H+x(i,:);
end
j=H
transfromed=fft(y);
f=abs(transfromed);
plot(f)
x=find(y<=20);
y(x);
y(x(1))=a(1);
y(x(2))=b(1);
y(x(3))=c(1);
y(x(4))=d(1);
y(x(5))=e(1);
y(x(6))=m(1);
y(x(7))=g(1);
y(x(8))=h(1);
y(x(9))=n(1);
y(x(10))=j(1);
y(1:10)
plot(y)

Answers (1)

You cannot. You overwrite the first 10 locations in the first channel of y without having saved the previous contents. They are gone and cannot be recovered except by reading in the file again.
The rest of the song after the 10th entry is still there untouched in y(11:end,:), and any channel beyond the first is untouched.

This question is closed.

Products

Tags

No tags entered yet.

Asked:

on 15 May 2015

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!