Create an LTI system from .wav file

3 ビュー (過去 30 日間)
Bernardo Rodriguez Jr
Bernardo Rodriguez Jr 2022 年 4 月 28 日
コメント済み: Star Strider 2022 年 5 月 6 日
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 件のコメント
Star Strider
Star Strider 2022 年 4 月 29 日
@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
Mathieu NOE 2022 年 4 月 29 日
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)

サインインしてコメントする。

回答 (1 件)

Chandra
Chandra 2022 年 5 月 6 日
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
refer to filter and conv functions
  1 件のコメント
Star Strider
Star Strider 2022 年 5 月 6 日
The filtfilt function is preferred.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAudio Processing Algorithm Design についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by