[m d] = wavfinfo(filename);
[y,Fs,bits] = wavread(filename);
mp3read which is similar to wavread
mp3write which is similar to wavwrite
No problem any further problems let us know. I also got your PM.Hi Dave....
Thank you very much for your help.....i really appreciate it....
Lama
Sadly I don't have Matlab to hand, but if I recall data from wavread is the sampled data sampled at fs frequnecy - correct? Then the fft function should compute your FFT for the data (both real and complex components).hey guys,
i too am doing a watermarking project for my graduation. however i am having trouble with the spectral analysis of the signal using the FFT function within matlab.
so far i have read in the .wav file like this:
[data,fs,nbits] = wavread("host.wav");
then i go onto FFT function
data_fft = fft(data);
is this correct? because when i plot data_fft it looks nothing like a wave.
Please can you help. thanks in advance
Ron
[data,fs,nbits] = wavread("host.wav"); % Read wav file
data_fft = fft(data); % Perform FFT
P_data_fft = data_fft.* conj(data_fft) / size(data_fft,2); % Deduce Power Spectra
f = 1000*(0:(size(data_fft,2)))/size(data_fft,2); % Define frequency range over which to plot power spectra. This is half the size of the fft since there is merely a reflection around the dc point
plot(f,P_data_fft(1:(size(data_fft,2)+1))) % Plot
arr = zeros(x,y); % Multi-dimensional array of dimensions x-by-y
for i = 1:size(arr,2)
for n = 1:size(arr,1)
arr(n,i) = svd(input);
% Use the svd function to compute your single value, use the for-loop iterations, n and i, to place the computed value in the multidimensional array
end
end
That is correct if you supply the same input for each iteration of the for-loops. Essentially you should provide one input per loop iteration (i.e. one value from your one-dimensional matrix input) to obtain the results, hence:hi dave
first thank you...
i tried what u suggested but i got out an array of the same value(that not what i want).. but i had another idea that is to build a matrix (where each row represent a frame of the signal) then perform the svd...
am still not sure if that'll work, but am working on it.
arr(n,i) = svd(input(n,i));
I will have a look around to see what I can find.actually i need a function to convert the frames to an audio file ...
so if anyone can provide such a tool ... i'll be thankful
Is there any particular type of audio file-format you are particularly looking at?actually i need a function to convert the frames to an audio file ...
so if anyone can provide such a tool ... i'll be thankful
Thankyou very much Dave, this was a great help. i had to adjust some of the code to work correctly with the rest of my code in matlab but it works like a dream.Sadly I don't have Matlab to hand, but if I recall data from wavread is the sampled data sampled at fs frequnecy - correct? Then the fft function should compute your FFT for the data (both real and complex components).
As for what you are trying to achieve with spectral analysis, then that is a different thing. Typically you would need to compute the power:
Try the following code:
That should give you the power density from which you can perform your spectral analysis. You may need to debug the code slightly since I have written it in Octave and not had the chance to test it in Matlab.Rich (BB code):[data,fs,nbits] = wavread("host.wav"); % Read wav file data_fft = fft(data); % Perform FFT P_data_fft = data_fft.* conj(data_fft) / size(data_fft,2); % Deduce Power Spectra f = 1000*(0:(size(data_fft,2)))/size(data_fft,2); % Define frequency range over which to plot power spectra. This is half the size of the fft since there is merely a reflection around the dc point plot(f,P_data_fft(1:(size(data_fft,2)+1))) % Plot
Dave