pv2notestrict.m

来自「自动语音识别源码对非特定人的孤立词语音识别算法 进行研究。考虑到语音识别技术在」· M 代码 · 共 28 行

M
28
字号
function note = pv2noteStrict(pv, timeStep)
% pv2noteStrict: PV to note transformation
%	Usage: note = pv2noteStrict(pv, timeStep)
%		pv = [semitone1, semitone2, ...] at time unit of timeStep
%			(Default value of timeStep is 1/16 second.)
%		note = [semitone1, time1, semitone2, time2, ...] with time
%			unit of 1 second

%	Roger Jang, 20001209, 20070531

if nargin<2
	timeStep = 1/16;
end
prev = pv(1);
time = 1;
note = [];
for i=2:length(pv),
	if pv(i)==prev,
		time = time+1;
	else
		note = [note, prev, time];
		prev = pv(i);
		time = 1;
	end
end

note = [note, prev, time];
note(2:2:end) = note(2:2:end)*timeStep;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?