Create an LTI system from .wav file
1 view (last 30 days)
Show older comments
I'm using Matlab for the first time and would like to know how to use the data from a .wav file to create an LTI system and play that as a sound. So far I have some basic functionality with the program, the DFT, magnitue and phase of the DFT if that makes any difference.
I've attempted something along these lines, but i'm certain it's not the right way to go about it
n = info.BitsPerSample;
y(n) = x(n) + 0.5*x(n-1) + 0.7*x(n-2);
sound(y(n), FS);
For the audio itself I have the following
[data,Fs] = audioread('sound.wav');
info = audioinfo('sound.wav');
sound(data, Fs);
6 Comments
Star Strider
on 29 Apr 2022
@Bernardo Rodriguez Jr — That’s all there is to it. The LTI system estimate simply will do its best to model the transfer function as depicted in the Fourier transform of the sound.
I’m curious as to what your professor wanted to demonstrate with that assignment or lab exercise.
Mathieu NOE
on 29 Apr 2022
well
that wav file is the output of a system , if we can call the system = the guitar ; and your fingers are your inputs
so yes maybe we could build a model of the guitar , but having only the output is not sufficient to know / modelize the guitar ; you can look at matlab function tfestimate to see how input and output data together can help you create a transfer function of a process , that can be transformed to a LTI model .
Also there are techniques to build models directly from time domain data (but always input and output data is needed)
% Reference:
% Subspace Identification for Linear Systems
% Theory - Implementation - Applications
% Peter Van Overschee / Bart De Moor
% Kluwer Academic Publishers, 1996
% Stochastic algorithm: Figure 3.13 page 90 (positive)
% Combined algorithm: Figure 4.8 page 131 (robust)
Answers (1)
Chandra
on 6 May 2022
Hi,
To pass a signal through a LTI system is done through convolution of transfer function and input signal
[data,Fs] = audioread('sound.wav');
%y(n) = x(n) + 0.5*x(n-1) + 0.7*x(n-2);
b = [1 0.5 0.7]; %numerator coefficients
a = 1; %denominator coefficients
y = filter(b,a,data);
sound(y, Fs);
%OR%
b = [1 0.5 0.7];
w(:,1) = conv(data(:,1),b);
w(:,2) = conv(data(:,2),b);
y = w;
sound(y, Fs);
In above both cases the y has same value, here the filter function process is same as convolution it can be done in either way
See Also
Categories
Find more on Audio Processing Algorithm Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!