From: Matt Fig on
> Please help as this is my Major project for final semester and it carries a great lot of important marks for me.....ofcourse its imp 4 my career!!!!.....Thanx a lotzzz to all of the people prior to the help to me....!!!

Also "imp" for your career:

Good problem solving skills.
Non-texting communication skills.
From: Amit Pathak on
"Wayne King" <wmkingty(a)gmail.com> wrote in message <hs3hko$42l$1(a)fred.mathworks.com>...
> "Amit Pathak" <pathak.amit06(a)gmail.com> wrote in message <hs2ri3$dfe$1(a)fred.mathworks.com>...
> > "us " <us(a)neurol.unizh.ch> wrote in message <hs1n1m$7sg$1(a)fred.mathworks.com>...
> > > "Amit Pathak"
> > > > ??? One or more output arguments not assigned during call to 'C:\MATLAB7\toolbox\wavelet\wavelet\wave&#8230; (waverec)'.
> > >
> > > but where in WAVEREC does the error occur(?)...
> > >
> > > i don't know exactly what happened with the code but m really confused and just need this..
>
> Hi Amit, as US correctly points out to you, you have to give us enough information to help you. For example, the following call to wdencmp() is not complete
>
> [xc,cxc,lxc,PERF0,PERFL2] = wdencmp('gbl',C,L,wavelet,level,thr,'h',&#8230;
>
> You should give us information about the size of x (the frame you extracted from the audio as the input to wavedec() ) in the input call to:
>
> [C,L] = wavedec(x,level,'db10');
>
> You should tell us whether wavelet_compression is 'on' or heavy_compression is 'on'
>
> I think then people will be able to help you.
>
> Wayne
From: Amit Pathak on
"Wayne King" <wmkingty(a)gmail.com> wrote in message <hs3hko$42l$1(a)fred.mathworks.com>...
> "Amit Pathak" <pathak.amit06(a)gmail.com> wrote in message <hs2ri3$dfe$1(a)fred.mathworks.com>...
> > "us " <us(a)neurol.unizh.ch> wrote in message <hs1n1m$7sg$1(a)fred.mathworks.com>...
> > > "Amit Pathak"
> > > > ??? One or more output arguments not assigned during call to 'C:\MATLAB7\toolbox\wavelet\wavelet\wave&#8230; (waverec)'.
> > >
> > > but where in WAVEREC does the error occur(?)...
> > >
> > > i don't know exactly what happened with the code but m really confused and just need this..
>
> Hi Amit, as US correctly points out to you, you have to give us enough information to help you. For example, the following call to wdencmp() is not complete
>
> [xc,cxc,lxc,PERF0,PERFL2] = wdencmp('gbl',C,L,wavelet,level,thr,'h',&#8230;
>
> You should give us information about the size of x (the frame you extracted from the audio as the input to wavedec() ) in the input call to:
>
> [C,L] = wavedec(x,level,'db10');
>
> You should tell us whether wavelet_compression is 'on' or heavy_compression is 'on'
>
> I think then people will be able to help you.
>
> Wayne


here is the initialization and as You see the wavelet_compression = 'on' & heavy_compression = 'off'. The input is a wave file with a file size of 1.19MB, 7 seconds time size, and corresponding Bit Rate is 1411 Kbps.


clear;clc;
file='C:\MATLAB7\work\Coltrane.wav';
wavelet='dB10';
level=5;
frame_size=2048;
psychoacoustic='on '; %if it is off it uses 8 bits/frame as default
wavelet_compression = 'on ';
heavy_compression='off';
compander='on ';
quantization ='on ';
From: us on
"Amit Pathak" <pathak.amit06(a)gmail.com> wrote in message <hs6cb3$j2h$1(a)fred.mathworks.com>...
> "Wayne King" <wmkingty(a)gmail.com> wrote in message <hs3hko$42l$1(a)fred.mathworks.com>...
> > "Amit Pathak" <pathak.amit06(a)gmail.com> wrote in message <hs2ri3$dfe$1(a)fred.mathworks.com>...
> > > "us " <us(a)neurol.unizh.ch> wrote in message <hs1n1m$7sg$1(a)fred.mathworks.com>...
> > > > "Amit Pathak"
> > > > > ??? One or more output arguments not assigned during call to 'C:\MATLAB7\toolbox\wavelet\wavelet\wave&#8230; (waverec)'.
> > > >
> > > > but where in WAVEREC does the error occur(?)...
> > > >
> > > > i don't know exactly what happened with the code but m really confused and just need this..
> >
> > Hi Amit, as US correctly points out to you, you have to give us enough information to help you. For example, the following call to wdencmp() is not complete
> >
> > [xc,cxc,lxc,PERF0,PERFL2] = wdencmp('gbl',C,L,wavelet,level,thr,'h',&#8230;
> >
> > You should give us information about the size of x (the frame you extracted from the audio as the input to wavedec() ) in the input call to:
> >
> > [C,L] = wavedec(x,level,'db10');
> >
> > You should tell us whether wavelet_compression is 'on' or heavy_compression is 'on'
> >
> > I think then people will be able to help you.
> >
> > Wayne
>
>
> here is the initialization and as You see the wavelet_compression = 'on' & heavy_compression = 'off'. The input is a wave file with a file size of 1.19MB, 7 seconds time size, and corresponding Bit Rate is 1411 Kbps.
>
>
> clear;clc;
> file='C:\MATLAB7\work\Coltrane.wav';
> wavelet='dB10';
> level=5;
> frame_size=2048;
> psychoacoustic='on '; %if it is off it uses 8 bits/frame as default
> wavelet_compression = 'on ';
> heavy_compression='off';
> compander='on ';
> quantization ='on ';

now what(?)...
you still don't show the full error trail...
don't waste CSSMers time by only providing small fractions of information...

us
From: Amit Pathak on
"us " <us(a)neurol.unizh.ch> wrote in message <hs6ctr$ps7$1(a)fred.mathworks.com>...
> "Amit Pathak" <pathak.amit06(a)gmail.com> wrote in message <hs6cb3$j2h$1(a)fred.mathworks.com>...
> > "Wayne King" <wmkingty(a)gmail.com> wrote in message <hs3hko$42l$1(a)fred.mathworks.com>...
> > > "Amit Pathak" <pathak.amit06(a)gmail.com> wrote in message <hs2ri3$dfe$1(a)fred.mathworks.com>...
> > > > "us " <us(a)neurol.unizh.ch> wrote in message <hs1n1m$7sg$1(a)fred.mathworks.com>...
> > > > > "Amit Pathak"
> > > > > > ??? One or more output arguments not assigned during call to 'C:\MATLAB7\toolbox\wavelet\wavelet\wave&#8230; (waverec)'.
> > > > >
> > > > > but where in WAVEREC does the error occur(?)...
> > > > >
> > > > > i don't know exactly what happened with the code but m really confused and just need this..
> > >
> > > Hi Amit, as US correctly points out to you, you have to give us enough information to help you. For example, the following call to wdencmp() is not complete
> > >
> > > [xc,cxc,lxc,PERF0,PERFL2] = wdencmp('gbl',C,L,wavelet,level,thr,'h',&#8230;
> > >
> > > You should give us information about the size of x (the frame you extracted from the audio as the input to wavedec() ) in the input call to:
> > >
> > > [C,L] = wavedec(x,level,'db10');
> > >
> > > You should tell us whether wavelet_compression is 'on' or heavy_compression is 'on'
> > >
> > > I think then people will be able to help you.
> > >
> > > Wayne
> >
> >
> > here is the initialization and as You see the wavelet_compression = 'on' & heavy_compression = 'off'. The input is a wave file with a file size of 1.19MB, 7 seconds time size, and corresponding Bit Rate is 1411 Kbps.
> >
> >
> > clear;clc;
> > file='C:\MATLAB7\work\Coltrane.wav';
> > wavelet='dB10';
> > level=5;
> > frame_size=2048;
> > psychoacoustic='on '; %if it is off it uses 8 bits/frame as default
> > wavelet_compression = 'on ';
> > heavy_compression='off';
> > compander='on ';
> > quantization ='on ';
>
> now what(?)...
> you still don't show the full error trail...
> don't waste CSSMers time by only providing small fractions of information...
>
> us
Sorry ! if its so I'm wasting time. Here is the entire code


clear;clc;
file='C:\MATLAB7\work\Coltrane.wav';
wavelet='dB10';
level=5;
frame_size=2048;
psychoacoustic='on '; %if it is off it uses 8 bits/frame as default
wavelet_compression = 'on ';
heavy_compression='off ';
compander='on';
quantization ='on';

% ENCODER %
[x,Fs,bits] = wavread(file);
xlen=length(x);
t=0:1/Fs:(length(x)-1)/Fs;
%decomposition using N equal frames
step=frame_size;
N=ceil(xlen/step);
%computational variables
Cchunks=0;
Lchunks=0;
Csize=0;
PERF0mean=0;
PERFL2mean=0;
n_avg=0;
n_max=0;
n_0=0;
n_vector=[];
for i=1:1:N
if (i==N)
frame=x([(step*(i-1)+1):length(x)]);
else
frame=x([(step*(i-1)+1):step*i]);
end
%wavelet decomposition of the frame
[C,L] = wavedec(x,level,'db10');
%wavelet compression scheme
if wavelet_compression=='on '
[thr,sorh,keepapp] = ddencmp('cmp','wv',frame);
if heavy_compression == 'off '
thr=thr*10^6;
end
if nargin ==1
out1 = whatever_it_is;
elseif nargin ==2
% assign 4 outputs corresponding B...F
out1 = xc;
out2 = cxc;
out3 = lxc;
out4 = PERF0;
out5 = PERFL2;

end
[xc,cxc,lxc,PERF0,PERFL2] = wdencmp('gbl',C,L,wavelet,level,thr,sorh,keepapp);
C=cxc;
L=lxc;
PERF0mean=PERF0mean + PERF0;
PERFL2mean=PERFL2mean+PERFL2;
end
%Psychoacoustic model
if psychoacoustic=='on '
P=10.*log10((abs(fft(frame,length(frame)))).^2);
Ptm=zeros(1,length(P));
%Inspect spectrum and find tones maskers
for k=1:1:length(P)
if ((k<=1) | (k>=250))
bool = 0;
elseif ((P(k)<P(k-1)) | (P(k)<P(k+1))),
bool = 0;
elseif ((k>2) & (k<63)),
bool = ((P(k)>(P(k-2)+7)) & (P(k)>(P(k+2)+7)));
elseif ((k>=63) & (k<127)),
bool = ((P(k)>(P(k-2)+7)) & (P(k)>(P(k+2)+7)) & (P(k)>(P(k-3)+7)) & (P(k)>(P(k+3)+7)));
elseif ((k>=127) & (k<=256)),
bool = ((P(k)>(P(k-2)+7)) & (P(k)>(P(k+2)+7)) & (P(k)>(P(k-3)+7)) & (P(k)>(P(k+3)+7)) & (P(k)>(P(k-4)+7)) & (P(k)>(P(k+4)+7)) &(P(k)>(P(k-5)+7)) & (P(k)>(P(k+5)+7)) & (P(k)>(P(k-6)+7)) &(P(k)>(P(k+6)+7)));
else
bool = 0;
end
if bool==1
Ptm(k)=10*log10(10.^(0.1.*(P(k1)))+10.^(0.1.*(P(k)))+10.^(0.1.*P(k+1)));
end
end
sum_energy=0;%sum energy of the tone maskers
for k=1:1:length(Ptm)
sum_energy=10.^(0.1.*(Ptm(k)))+sum_energy;
end
E=10*log10(sum_energy/(length(Ptm)));
SNR=max(P)-E;
n=ceil(SNR/6.02);%number of bits required for quantization
if n<=3%to avoid distortion by error of my psychoacoustic model.
n=4;
n_0=n_0+1;
end
if n>n_max
n_max=n;
end
n_avg=n+n_avg;
n_vector=[n_vector n];
end
%Compander(compressor)
if compander=='on '
Mu=255;
C = compand(C,Mu,max(C),'mu/compressor');
end
%Quantization
if quantization=='on '
if psychoacoustic=='off'
n=8;%default number of bits for each frame - sounds better but
uses more bits
end
partition = [min(C):((max(C)-min(C))/2^n):max(C)];
codebook = [min(C):((max(C)-min(C))/2^n):max(C)];
[index,quant,distor] = quantiz(C,partition,codebook);
%find and correct offset
offset=0;
for j=1:1:N
if C(j)==0
offset=-quant(j);
break;
end
end
quant=quant+offset;
C=quant;
end
%Put together all the chunks
Cchunks=[Cchunks C]; %NOTE: if an error appears in this line just modify the transpose of C
Lchunks=[Lchunks L'];
Csize=[Csize length(C)];
Encoder = round((i/N)*100) %indicator of progess
end
Cchunks=Cchunks(2:length(Cchunks));
Csize=[Csize(2) Csize(N+1)];
Lsize=length(L);
Lchunks=[Lchunks(2:Lsize+1) Lchunks((N-1)*Lsize+1:length(Lchunks))];
PERF0mean=PERF0mean/N %indicator
PERFL2mean=PERFL2mean/N %indicator
n_avg=n_avg/N%indicator
n_max%indicator
end_of_encoder='done'%indicator of progess


% DECODER %

%reconstruction using N equal frames of length step (except the lastone)
xdchunks=0;
for i=1:1:N
if i==N
Cframe=Cchunks([((Csize(1)*(i-1))+1):Csize(2)+(Csize(1)*(i-1))]);
%Compander (expander)
if compander=='on '
if max(Cframe)==0
else
Cframe = compand(Cframe,Mu,max(Cframe),'mu/expander');
end
end
xd = waverec(Cframe,Lchunks(Lsize+2:length(Lchunks)),'db10');
else
Cframe=Cchunks([((Csize(1)*(i-1))+1):Csize(1)*i]);
%Compander (expander)
if compander=='on '
if max(Cframe)==0
else
Cframe = compand(Cframe,Mu,max(Cframe),'mu/expander');
end
end
xd = waverec(Cframe,Lchunks(1:Lsize),'db10');
end
xdchunks=[xdchunks xd];
Decoder = round((i/N)*100) %indicator of progess
end
xdchunks=xdchunks(2:length(xdchunks));
distorsion = sum((xdchunks-x').^2)/length(x)
end_of_decoder='done'
%creating audio files with compressed schemes
wavwrite(xdchunks,Fs,bits,'output.wav') %this does not represnet the real compression achieved. It is only to hear the results
end_of_writing_file='done'%indicator of progess
figure(1);clf;
subplot(2,1,1)
plot(x,varargin{:})
ylim([-1 1]);
title('Original audio signal');
xlabel('Time in [seg]','FontSize',8);
subplot(2,1,2)
plot(t,xdchunks,'r');
ylim([-1 1]);
title('Compressed audio signal');
xlabel('Time in [seg]','FontSize',8);




and here is the error on running the program

??? One or more output arguments not assigned during call to 'C:\MATLAB7\toolbox\wavelet\wavelet\waverec.m (waverec)'.

Error in ==> wdencmp at 125
xc = waverec(cxc,lxc,w);

Error in ==> Wavelet at 55
[xc,cxc,lxc,PERF0,PERFL2] = wdencmp('gbl',C,L,wavelet,level,thr,sorh,keepapp);