?? note2pv0.m
字號:
function [mid, noteStartPos] = note2mid(midi, resampleRate, plotOpt)
% note2mid: Note to mid conversion
% Usage:
% [mid, noteStartPos] = note2mid(midi, resampleRate, plotOpt)
% midi: semitone and duration sequence, where the duration is based on 1/64 second
% resampleRate: usually 4
% mid: Pitch vector where each point represents a pitch of 1/16 second
% noteStartPos: A vector of the same size as mid, with 1 denotes the start position of a note
% Roger Jang, 20030501
if nargin==0, selfdemo; return; end
if nargin<2, resampleRate=4; end
if nargin<3, plotOpt=0; end
[mid, noteStartPos] = note2mid2mex(midi, resampleRate);
if plotOpt
subplot(2,1,1);
plotmidi(midi, 1/64);
subplot(2,1,2);
time=(1:length(mid))/16;
line(time, mid, 'marker', '.', 'linestyle', 'none');
index=find(noteStartPos);
line(time(index), mid(index), 'marker', 'o', 'color', 'r', 'linestyle', 'none');
axis tight; box on; grid on;
xlabel('Time (seconds)');
ylabel('Semitones');
title('Output of note2mid()');
end
% ====== Self demo
function selfdemo
smtn = [-1 -4 -4 -3 -6 -6 -8 -6 -4 -3 -1 -1 -1]+69; % Semitones for
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -