-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.m
More file actions
26 lines (22 loc) · 981 Bytes
/
main.m
File metadata and controls
26 lines (22 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
% Calculation of power spectrogram, Daichi Kitamura 2022-04-01
clear; close all; clc;
% Set parameters
inFileDir = "./inputFile/";
inFileName = "music.wav";
% Read input .wav file
inFilePath = inFileDir + inFileName;
[inSig, sampFreq] = audioread(inFilePath);
% Convert to power spectrogram
[spec, freqAxis, timeAxis, fig] = calcStft(inSig, ...
"winLen", 4096, ...
"shiftLen", 512, ...
"winType", "h", ...
"fs", sampFreq, ...
"isPlot", true, ...
"minColor", -10, ...
"freqRange", [0, 6000]);
% Save figure in vector .pdf format to your desktop directory
if ~isempty(fig)
outFileName = "power_spectrogram";
saveFigDesktop(fig, outFileName);
end