# Create an LTI system from .wav file

5 views (last 30 days)
Bernardo Rodriguez Jr on 28 Apr 2022
Commented: Star Strider on 6 May 2022
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
info = audioinfo('sound.wav');
sound(data, Fs);
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
% Stochastic algorithm: Figure 3.13 page 90 (positive)
% Combined algorithm: Figure 4.8 page 131 (robust)

Chandra on 6 May 2022
Hi,
To pass a signal through a LTI system is done through convolution of transfer function and input signal
%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
refer to filter and conv functions
Star Strider on 6 May 2022
The filtfilt function is preferred.

### Categories

Find more on Audio Processing Algorithm Design in Help Center and File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by