Azzera filtri
Azzera filtri

Convolution of .wav files. Direct recorded guitar and Impulse response of guitar amplifier.

17 visualizzazioni (ultimi 30 giorni)
I am trying to convolve a short clip of guitar recorded directly into my computer through an audio interface, with an impulse response of the amplifier I usually play it through. I took this impulse response in MATLAB using the audio toolbox. When I put the Impulse response in an 'IR Loader' in my DAW (Digital Audio Workstation ie recording software), and apply it to the unaffected guitar signal It sounds right, however I am trying to do the operation in MATLAB. I tried convolving in time domain and it results in a delay/echo sound which is not what I am trying to achieve. I am trying to basically affect the EQ of the direct recorded guitar sound to make it sound as if it was going through the amplifier. Here is my code:
[DirectGuitar,Fs] = audioread("DirectGuitar.wav"); %Recording of Direct Guitar
[AmpIR] = audioread("DrZIR.wav"); %Impulse Response of 'Dr Z' Amplifier
Ampsound = conv(DirectGuitar,DrZIR); %convolution of the two
audiowrite('Ampsound.wav',Ampsound,Fs);
[DrZ,Fs] = audioread("Ampsound.wav");
sound(DrZ,Fs); %here I get a delay/echo
I also tried doing Fourier transforms of the two wav files and convolving them in frequency domain then doing an Inverse Fourier transform back and this resulted in a noisy, distorted, possibly bit crushed sound.
FTgtr = fft(DirectGuitar); % FFT of guitar
FTDrZ = fft(DrZIR); %FFT of amp IR
FreqDomainAmp = conv(FTDrZ,FTgtr); % Freq Domain convolution
Ampsound = ifft(FreqDomainAmp); % Inverse Fourier transform back to time domain
Ampsound = real(Ampsound); %to get rid of imaginary parts
audiowrite('Ampsound.wav',Ampsound,Fs);
[DrZ,Fs] = audioread("Ampsound.wav");
sound(DrZ,Fs); %here I get a noisy distorted bit crushed sound
Am I in the wrong ballpark alltogether trying to convolve these two signals?
Thanks for your help.

Risposta accettata

Mathieu NOE
Mathieu NOE il 16 Nov 2020
hello again
your impulse response is too long , if you look in detail there are delyed and attenuated spikes after the main (first) one
so removing that unecessary trailing section will also remove the echoes
hope the zip attached will get to you

Più risposte (1)

Mathieu NOE
Mathieu NOE il 16 Nov 2020
hello
your impulse response is a FIR filter; yes you can do signal processing by using the conv function, as the theory says, but IMHO there are matlab functions like filter and filtfilt that do all the hardwork for you , whatever FIR or IIR filter you want to apply
so I would stick to the time domain approach and simply replace the conv by filter
[DirectGuitar,Fs] = audioread("DirectGuitar.wav"); %Recording of Direct Guitar
[AmpIR] = audioread("DrZIR.wav"); %Impulse Response of 'Dr Z' Amplifier
% Ampsound = conv(DirectGuitar,DrZIR); %convolution of the two
Ampsound = filter(AmpIR,1,DirectGuitar);
audiowrite('Ampsound.wav',Ampsound,Fs);
[DrZ,Fs] = audioread("Ampsound.wav");
sound(DrZ,Fs); %here I get a delay/echo
regards
  3 Commenti

Accedi per commentare.

Categorie

Scopri di più su Audio Processing Algorithm Design in Help Center e File Exchange

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by