Creating the discrete-time graph of a recorded audio signal

8 vues (au cours des 30 derniers jours)
Bill
Bill le 24 Mai 2023
Commenté : Mathieu NOE le 26 Mai 2023
Hello!
I am a second year engineering major. I have not yet studied anything that remotely resembles MATLAB but as an exercise i have been given the task of displaying a given audio signal in a discrete-time graph and after that finding its fourier transform. The problem is that all that should be done in MATLAB. I have the audio signal as a recording. The exercise requires that i display the first 80 samples with the sampling rate being up to me.
From what i could gather i created this, but unfortunately it doesn't work and to be honest I don't really understand what I am doing. Can someone offer a little help?
Thanks in advance!
Fs = 4000; Channels = 1; bits = 16;
[data, fs] = audioread("/MATLAB Drive/recordingX.wav");
X = getaudiodata(data);
n = 0:1/Fs:(length(X)-1)/Fs;
plot(n,X);

Réponse acceptée

Mathieu NOE
Mathieu NOE le 25 Mai 2023
hello
no panic !
if you have records in wav format , you only need audioread to get your data
getaudiodata is not needed here (read the doc if you have time though)
as a wav file can have one or multiple channes , also look at the end how you can either plot one channel or all channels on the same graph
hope it helps !
Fs = 4000; Channels = 1; bits = 16;
[data, fs] = audioread("/MATLAB Drive/recordingX.wav");
[samples,channels] = size(data);
% plot the k first samples
k = 80;
n = 1:k;
% plot(n,data(n,:)); % will plot all channels
plot(n,data(n,1)); % will plot first channel
  2 commentaires
Bill
Bill le 25 Mai 2023
Thanks a lot for your time and effort! Please keep helping other people
Mathieu NOE
Mathieu NOE le 26 Mai 2023
My pleasure !

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Audio I/O and Waveform Generation dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by