-
Notifications
You must be signed in to change notification settings - Fork 29
/
main_extract_sp_f0.m
30 lines (27 loc) · 975 Bytes
/
main_extract_sp_f0.m
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
27
28
29
clear all;
%%%%%%%%%%%%%%%%%%%%%%%%%
%author: zhaoshuaijiang
%date: 20141223
%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%Settings%%%%%%%%%%%%
opts.F0frameUpdateInterval = 5; %frame shift(ms)
opts.spectralUpdateInterval = 5; %frame shift(ms)
opts.F0searchLowerBound = 50; %F0 lower bound
opts.F0searchUpperBound = 600; %F0 upper bound
fs = 16000;
RAW_PATH = './raw/';
%WAV_PATH = './wav-10/';
SP_PATH = './sp/'; mkdir(SP_PATH);
F0_PATH = './f0/'; mkdir(F0_PATH);
%%%%%%%%%%%%Settings%%%%%%%%%%%%
fns_all = Utils_getFilenames(RAW_PATH, '.raw');
for i = 1:length(fns_all)
fprintf('Extract the %d th file\n',i);
x = Utils_readFeature([RAW_PATH fns_all{i} '.raw'],'int16',1); %int16 not short
%[x,fs] = wavread([WAV_PATH fns_all{i} '.wav'],'int16');
[f0,ap]=exstraightsource(x,fs,opts);
sp = exstraightspec(x,f0,fs,opts);
sp = sp';
save([F0_PATH fns_all{i} '.f0'],'f0','-ascii');
save([SP_PATH fns_all{i} '.sp'],'sp','-ascii');
end