賈維斯的智慧工坊

  • Home
  • About
  • Note
  • Project
  • Experience
  • Service
  • Sitemap


MY | NOTES

[MATLAB] Plot wave in Time/Frequency domain

畫出音訊的時域或頻域圖
Jul, 2017


MATLAB function
便於畫出音訊圖於時域或頻域,也可以選擇要濾掉的頻率能量閥值

1. Plot signal wave in time or frequency domain
2. Choose x-axis as time or samples
3. Remove spectral energy under a value when show the spectrogram

下載

Plot Audio Wave in Time and Frequency domain
- File Exchange - MATLAB Central - MathWorks
Download

Online Version

Online Analysis For Audio Time & Frequency Domain

1、參數介紹

Required Input Parameters

  newFig      Create in a new figure window ( 0:No, 1:Yes )
  signal        Speech data
  fs                Sampling frequency (Hz)
  type           'time' or 'freq'

Optional Input Parameters

  x_axis              0: samples, 1: time
  name              Figure title
  removeFreq  Threshold for  spectral energy
  frame              Frame size for spectrogram (ms)

2、使用範例

% plotWave_YW(newFig, signal, fs, type, x_axis, name, removeFreq, frame)
% 先讀取音檔至clean以及其取樣率fs
% [ clean, fs ] = audioread( 'sp10.wav' );

Example 1

plotWave_YW(1, clean, fs, 'time', 0, 'clean speech');

1開新figure視窗
clean輸入音檔資料
fs輸入取樣率
'time'選擇時域
0X軸為取樣點index
'clean speech'圖的title

Example 2

plotWave_YW(1, clean, fs, 'time', 1, 'clean speech');

1開新figure視窗
clean輸入音檔資料
fs輸入取樣率
'time'選擇時域
1X軸為時間
'clean speech'圖的title

Example 3

plotWave_YW(1, clean, fs, 'freq', 1, 'clean speech');

1開新figure視窗
clean輸入音檔資料
fs輸入取樣率
'freq'選擇頻域
1無影響
'clean speech'圖的title

Example 4

plotWave_YW(1, clean, fs, 'freq', 1, 'clean speech',0);

1開新figure視窗
clean輸入音檔資料
fs輸入取樣率
'freq'選擇頻域
1無影響
'clean speech'圖的title
0不顯示頻譜能量小於0的部份

Example 5

figure;
subplot(2,1,1);
plotWave_YW(0, clean, fs, 'time', 1, 'clean speech');
subplot(2,1,2);
plotWave_YW(0, clean, fs, 'freq', 1, 'clean speech');

0不開新視窗,用於subplot


← Back to note