11function Generate_mcTrainData_cut(WSJ_dir_name , save_dir )
22%
33% Input variables:
4- % WSJ_dir_name: string name of user's clean wsjcam0 corpus directory
5- % (*Directory structure for wsjcam0 corpushas to be kept as it is after obtaining it from LDC.
4+ % WSJ_dir_name: string name of WAV file directory converted from original wsjcam0 SPHERE files
5+ % (*Directory structure for wsjcam0 corpus to be kept as it is after obtaining it from LDC.
66% Otherwise this script does not work.)
77%
88% This function generates multi-condition traiing data
99% based on the following items:
10- % 1. wsjcam0 corpus (distributed from the LDC )
10+ % 1. wsjcam0 corpus (WAV files )
1111% 2. room impulse responses (ones under ./RIR/)
1212% 3. noise (ones under ./NOISE/).
1313% Generated data has the same directory structure as original wsjcam0 corpus.
@@ -26,8 +26,6 @@ function Generate_mcTrainData_cut(WSJ_dir_name, save_dir)
2626
2727display([' Name of directory for original wsjcam0: ' ,WSJ_dir_name ])
2828display([' Name of directory to save generated multi-condition training data: ' ,save_dir ])
29- unix([' chmod u+x sphere_to_wave.csh' ]);
30- unix([' chmod u+x bin/*' ]);
3129
3230% Parameters related to acoustic conditions
3331SNRdB= 20 ;
@@ -89,7 +87,6 @@ function Generate_mcTrainData_cut(WSJ_dir_name, save_dir)
8987 save_dir_tr= [save_dir ,' /data/mc_train/' ];
9088end
9189mkdir([save_dir_tr ]);
92- % mkdir([save_dir,'/taskfiles/'])
9390
9491mic_idx= [' A' ;' B' ;' C' ;' D' ;' E' ;' F' ;' G' ;' H' ];
9592prev_fname= ' dummy' ;
@@ -114,13 +111,12 @@ function Generate_mcTrainData_cut(WSJ_dir_name, save_dir)
114111 end
115112 prev_fname= fname(1 : idx1(end ));
116113
117- % load (sphere format) speech signal
118- x= read_sphere([WSJ_dir_name ,' /data/' , fname ]);
119- x= x /(2 ^ 15 ); % conversion from short-int to float
114+ % load speech signal
115+ x= audioread([WSJ_dir_name , ' /data/' , fname , ' .wav' ])' ;
120116
121117 % load RIR and noise for "THIS" utterance
122- eval([' RIR=wavread (RIR_sim' ,num2str(rcount ),' );' ]);
123- eval([' NOISE=wavread ([noise_sim' ,num2str(ceil(rcount / 4 )),' ,'' _' ,num2str(ncount ),' .wav'' ]);' ]);
118+ eval([' RIR=audioread (RIR_sim' ,num2str(rcount ),' );' ]);
119+ eval([' NOISE=audioread ([noise_sim' ,num2str(ceil(rcount / 4 )),' ,'' _' ,num2str(ncount ),' .wav'' ]);' ]);
124120
125121 % Generate 8ch noisy reverberant data
126122 y= gen_obs(x ,RIR ,NOISE ,SNRdB );
@@ -138,8 +134,9 @@ function Generate_mcTrainData_cut(WSJ_dir_name, save_dir)
138134 y= y / 4 ; % common normalization to all the data to prevent clipping
139135 % denominator was decided experimentally
140136
141- for ch= 1 : 8
142- eval([' wavwrite(y(:,' ,num2str(ch ),' ),16000,'' ' ,save_dir_tr fname ,' _ch' ,num2str(ch ),' .wav'' );' ]);
137+ for ch= 1 : 8
138+ outfilename = [save_dir_tr , fname , ' _ch' , num2str(ch ), ' .wav' ];
139+ eval([' audiowrite(outfilename, y(:,' ,num2str(ch ),' ), 16000);' ]);
143140 end
144141
145142 display([' sentence ' ,num2str(fcount ),' (out of 7861) finished! (Multi-condition training data)' ])
0 commit comments