Function that fits a wave

6 visualizaciones (últimos 30 días)
Rowan Humphreys
Rowan Humphreys el 17 de Jun. de 2022
Editada: Pooja Kumari el 10 de En. de 2024
I need to create a function that describes an audio wave. I have tried the fit() function with sine and gaussian but they don't have sufficient detail. Can you recomend me some technique that generates a function that more accurately describes this wave?
The following is my code:
clear all;
[y,Fs] = audioread('raindrop.wav');
sound(y,Fs);
x = (1:1:length(y))';
f = fit(x,y,'gauss8');
C = coeffvalues(f);
plot(f,x,y)
%the following shows me just the fit
F = C(01)*exp(-((x-C(02))/C(03)).^2) + C(04)*exp(-((x-C(05))/C(06)).^2) + ...
C(07)*exp(-((x-C(08))/C(09)).^2) + C(10)*exp(-((x-C(11))/C(12)).^2) + ...
C(13)*exp(-((x-C(14))/C(15)).^2) + C(16)*exp(-((x-C(17))/C(18)).^2) + ...
C(19)*exp(-((x-C(20))/C(21)).^2) + C(22)*exp(-((x-C(23))/C(24)).^2);
plot(x,F)
sound(F,Fs)

Respuestas (1)

Pooja Kumari
Pooja Kumari el 27 de Sept. de 2023
Editada: Pooja Kumari el 10 de En. de 2024
Dear Rowan,
It is my understanding that you are facing issue with creating a function to describe an audio wave with more detail than a simple sine or Gaussian function. I am assuming that you want to learn more about how to describe an audio wave. You can consider any of the below approach for describing an audio wave:
You can also examine and comprehend the properties of the audio wave more thoroughly by making an app. You can refer to the below example on how to create an app to play and visualize audio file:
  • Using Fourier analysis of audio signal: Performing a Fourier analysis on an audio signal involves applying a Fourier transform, such as the Fast Fourier Transform (FFT), to move the audio wave from the time domain to the frequency domain. This will give the amplitude and phase information for each frequency component present in the audio wave. You can refer to the documentation below for more information: https://www.mathworks.com/help/matlab/ref/fft.html
Regards,
Pooja Kumari

Categorías

Más información sobre Simulation, Tuning, and Visualization en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by