WAV File Post process
Show older comments
Dear community,
My name is Rohith student at University of Freiberg, Germany. I came across in MATLA answers because I have problem to plot WAV files. I tried myself and looked in the documentation but I think I'm doing some mista. Here I attach two WAV files and Plots I got with code I use.ke:
WAV file:
Amplitude vs time
clear y Fs
info = audioinfo ( 'de ** av' )
[y, Fs] = audioread ( 'de *** v' );
t = 0: seconds (1 / Fs): seconds (info.Duration);
ylen = length (y); % signal length
t = (0: length (y) -1) / Fs;
plot (t * 1E + 3, y); % time vector
plot (t, y)
xlabel ( 'Time' )
ylabel ( 'amplitude' )
Frequency vs Magnitude (db)
clear, clc, close all
[x, fs] = audioread ( 'top081236.wav' ); % load an audio file
x = x (:, 1); % get the first channel
% determine the signal parameters
xlen = length (x); % signal length
t = (0: xlen-1) / fs; % time vector
% analysis parameters
wlen = 1024; % window length (recomended to be power of 2)
nfft = 2 * choose; % number of fft points (recomended to be power of 2)
hop = wlen / 2; % hop size
TimeRes = wlen / fs; % time result of the analysis (ie, window duration), s
FreqRes = 2 * fs / wlen; % frequency resolution of the analysis (using Hanning window), Hz
% time-frequency grid parameters
TimeResGrid = hop / fs; % time resolution of the grid, s
FreqResGrid = fs / nfft; % frequency resolution of the grid, Hz
% perform spectral analysis
w2 = hanning (xlen, 'periodic' );
[PS, fX] = periodogram (x, w2, nfft, fs, 'power' );
Xamp = 20 * log10 (sqrt (PS) * sqrt (2));
% plot the spectrum
plot (fX, Xamp)
grid on
xlim ([0 max (fX)])
set (gca, 'FontName' , 'Times New Roman' , 'FontSize' , 12)
xlabel ( 'Frequency, Hz' )
ylabel ( 'Magnitude, dB' )
title ( 'Amplitude spectrum of the signal' )
%% mark the dominant frequencies in the spectrogram
% [~, inds] = max (Samp, [], 1);
% fmax = fS (inds);
% hold on
% plot3 (tS, fmax, zeros (length (tS)), 'r')
And I'm looking for FFT and spectogram 3D.
Answers (1)
Image Analyst
on 12 Jun 2020
0 votes
See my attached demo to plot waveforms for all audio files in a folder.

1 Comment
Venkata Naga Rohith Tinnanuru
on 15 Jun 2020
Categories
Find more on Introduction to Installation and Licensing 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!