comparison nonExposed/generateScene.m @ 17:fc99c676c280

add channel option; add figure hide option
author gregoire lafay <gregoirelafay@sfr.fr>
date Wed, 06 Jan 2016 19:29:35 +0100
parents 92f73423eb37
children 8d33767e070a
comparison
equal deleted inserted replaced
16:92f73423eb37 17:fc99c676c280
1 function [w,sceneSchedule] = generateScene (sceneSchedule,sceneObjects,score,inputPath,outputPath,outputFileName,figuresOption,timeMode,endCut,norm,sr) 1 function [sceneSchedule] = generateScene (sceneSchedule,sceneObjects,score,inputPath,outputPath,outputFileName,figuresOption,timeMode,endCut,norm,sr,channelOption)
2 % function [w,sceneSchedule] = generateScene (sceneSchedule,sceneObjects,score,inputPath,outputPath,outputFileName,displayFigures,timeMode,endCut) 2 % function [w,sceneSchedule] = generateScene (sceneSchedule,sceneObjects,score,inputPath,outputPath,outputFileName,displayFigures,timeMode,endCut)
3 % This function does the actual job of loading, scaling, positioning and 3 % This function does the actual job of loading, scaling, positioning and
4 % mixing the various samples to generate a scene, based on the 4 % mixing the various samples to generate a scene, based on the
5 % specifications given by its parameters. 5 % specifications given by its parameters.
6 6
134 % checkClassPresence(sceneSchedule,sceneObjects); 134 % checkClassPresence(sceneSchedule,sceneObjects);
135 135
136 save ([outputPath 'annotation/' outputFileName '.mat'],'score', 'sceneObjects', 'sceneSchedule','dominantTrack', 'dominantObject','simulatedEBR'); 136 save ([outputPath 'annotation/' outputFileName '.mat'],'score', 'sceneObjects', 'sceneSchedule','dominantTrack', 'dominantObject','simulatedEBR');
137 saveAnnotationTxt(sceneSchedule,outputPath,outputFileName); 137 saveAnnotationTxt(sceneSchedule,outputPath,outputFileName);
138 138
139 w = sum(tracks,1); 139 switch channelOption
140 140 case 0
141 if norm 141 w = sum(tracks,1);
142 w = w/(max(abs(w)))*norm; %Normalize to [-norm,norm] 142 if norm %Normalize to [-norm,norm]
143 w = w/(max(abs(w)))*norm;
144 end
145 audiowrite([outputPath 'sound/' outputFileName '.wav'],w,sr);
146 case 1
147 if norm % each track will be normalized to [-norm,norm]
148 tracks = bsxfun(@times,tracks',norm./max(a,abs(tracks),2))';
149 end
150 audiowrite([outputPath 'sound/' outputFileName '.wav'],tracks',sr);
151 case 2
152 if norm % each track will be normalized to [-norm,norm]
153 tracks = bsxfun(@times,tracks',norm./max(a,abs(tracks),2))';
154 end
155 for jj=1:size(tracks,1)
156 audiowrite([outputPath 'sound/' outputFileName '_channel_' num2str(jj) '.wav'],tracks(jj,:),sr);
157 end
143 end 158 end
159
144 160
145 if figuresOption 161 if figuresOption
146 settingFigure.cmap = generateColormap(sceneObjects); 162 settingFigure.cmap = generateColormap(sceneObjects);
147 settingFigure.width=29.7; % cm 163 settingFigure.width=29.7; % cm
148 settingFigure.height=21; % cm 164 settingFigure.height=21; % cm