Ältere Kommentare anzeigen
Hello everybody
Please,I want to do the convolution on my speech signal using conv() How can I do that??
This is my signal
f=8000;
b=8;
[s1,f,b]=wavread('C:\Users\N\Desktop\sara.wav');
5 Kommentare
Naz
am 19 Dez. 2011
What do you want to convolve your signal with?
sara s
am 19 Dez. 2011
Naz
am 19 Dez. 2011
With a sinusoid of 8kHz? Something like modulation? Theoretically, if your voice contains frequencies over 4kHz you will have aliasing. Also, you need to choose how to truncate your sinusoidal signal (the length in time)
Naz
am 19 Dez. 2011
Convolution with itself? Then just do conv(s1,s1)
sara s
am 19 Dez. 2011
Akzeptierte Antwort
Weitere Antworten (2)
Walter Roberson
am 19 Dez. 2011
[conv(s1(:,1),s(:,1), 'same'), conv(s1(:,2), s1(:,2), 'same')]
That is for convolving each channel with itself. If for some reason you wanted to convolve left with right, then it would be
conv(s1(:,1), s1(:,2), 'same')
5 Kommentare
Naz
am 19 Dez. 2011
Good point
sara s
am 19 Dez. 2011
sara s
am 19 Dez. 2011
Walter Roberson
am 19 Dez. 2011
Please show the traceback of the error -- which line of code it occurred in, which routine, where it was called from, and so on.
Timothy Dixon
am 18 Mai 2012
@ sara correct the type error from walter conv(s1(:,1),s(:,1)
correction
conv(s1(:,1),s1(:,1),
s1 was missing. if it does not work, then try to upgrade the version of Matlab that support the recording card system
Image Analyst
am 19 Dez. 2011
How about:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 24;
fullFileName = 'C:\Users\N\Desktop\sara.wav';
if exist(fullFileName, 'file')
[s1,f,b]=wavread(fullFileName);
subplot(2,1,1);
plot(s1);
grid on;
title('Original Signal', 'FontSize', fontSize);
windowSize = 201; % or whatever.
s1_filtered = conv(s1, ones(1, windowSize ) / windowSize );
subplot(2,1,2);
plot(s1_filtered);
grid on;
title('Filtered Signal', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]); % Maximize figure.
set(gcf,'name','Demo by ImageAnalyst','numbertitle','off')
else
message = sprintf('File not found:\n%s', fullFileName);
uiwait(warndlg(message));
end
17 Kommentare
Walter Roberson
am 19 Dez. 2011
I suspect Sara's wave file is two channel.
Naz
am 19 Dez. 2011
I suspect Sara gave up...
sara s
am 19 Dez. 2011
Naz
am 19 Dez. 2011
Maybe his concern is in wording of convolution OF two signal with convolution BETWEEN two signals, but in the case of recorded voice, I would say it is very possible to perform convolution (with itself or any other real signal).
sara s
am 19 Dez. 2011
Walter Roberson
am 19 Dez. 2011
That code looks like it should do convolution of the two channels against themselves. I have no idea what the mathematical result of that is expected to be, or what it would sound like.
Usually you would convolve against a much smaller vector to achieve a filter, such as convolving against [-1/2 1 -1/2] to get a variety of moving average.
There is probably a nice fourier analysis for what convolving a signal against itself would do, but I do not know what that analysis would be. Squaring all the frequency components, maybe ??
Naz
am 19 Dez. 2011
I just updated my answer
Naz
am 19 Dez. 2011
@Walter. Squaring of frequency spectrum
sara s
am 19 Dez. 2011
sara s
am 19 Dez. 2011
Walter Roberson
am 19 Dez. 2011
Wouldn't you need to square (the number of samples divided by 2) in order to square the frequency spectrum, if by that you mean that if you had 2*N+1 frequency bins in the fft before, that the new fft would have 2*(N^2)+1 bins and the new maximum frequency would be in bin N^2+1 ?
Bjorn Gustavsson
am 19 Dez. 2011
@Walter, convolving a signal with itself should give something close to the autocorrelation function - and that would be the Fourier transform of the power spectra.
Image Analyst
am 19 Dez. 2011
sara: Naz suggested that you'd want to convolve the signal with itself. I suggested just a box filter (local averaging) as an illustration. But YOU haven't yet said what is to be convolved with your signal. You also haven't said anything about needing frequencies, spectrum, Fourier analysis, or anything like that. Do you need anything like that or is any old signal convolved with your s1 good enough to complete your assignment?
sara s
am 19 Dez. 2011
sara s
am 19 Dez. 2011
Walter Roberson
am 19 Dez. 2011
There are a number of different filters shown at http://web.mit.edu/1.130/WebDocs/1.130/Software/Examples/example1.m
In that code, you want the vectors that are directly underneath each comment. For example the line under '%Downsampling' is
x = [-1 0 9 16 9 0 -1] / 16;
and that x would be suitable to convolve against.
sara s
am 20 Dez. 2011
Kategorien
Mehr zu Digital Filtering finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!