Mercurial > hg > simscene-py
diff simScene.m @ 16:92f73423eb37
update figure generation
author | GregoireLafay <gregoire.lafay@irccyn.ec-nantes.fr> |
---|---|
date | Wed, 06 Jan 2016 18:04:24 +0100 |
parents | 69410ac2a50d |
children | fc99c676c280 |
line wrap: on
line diff
--- a/simScene.m Tue Dec 08 10:45:15 2015 +0100 +++ b/simScene.m Wed Jan 06 18:04:24 2016 +0100 @@ -100,13 +100,16 @@ % or 'replicate', this parameter is the path to the wav % file of the reference scene sampled at 44100 Hz. % -% - displayFigures: Boolean (default 0), save pictures (piano roll, time -% domain stacked visualization, overlaid spectrogram) -% +% - figuresOption: (default 1) save and show pictures (piano roll, time domain stacked visualization, overlaid spectrogram) +% 0: don't save or display pictures +% 1: save pictures without displaying them +% 2: save and display pictures +% % - outputFileName: name of generated files with no extension % % - sampleChoice: method for choosing sample to schedule within a track % 'random': unconstrained sampling +% 'random-unique': unconstrained sampling with no sample repetition % 'close': choose among the sampling dataset the sample that % has the closest duration to the reference one. % This mode is available only for the replicate timeMode. @@ -152,7 +155,9 @@ addpath(genpath('nonExposed')); -[timeMode,ebrMode,instanceAnnotFile,instanceAudioFile,displayFigures,sampleChoice,outputFileName,minSpace,endCut]=process_options(varargin,'timeMode','generate','ebrMode','generate','instanceAnnotFile','none','instanceAudioFile','none','displayFigures','1','sampleChoice','random','outputFileName','simulatedScene','minSpace',-1,'endCut',0); +[timeMode,ebrMode,instanceAnnotFile,instanceAudioFile,figuresOption,sampleChoice,outputFileName,minSpace,endCut,eventInfoPath,norm]=process_options(varargin,'timeMode','generate','ebrMode','generate','instanceAnnotFile','none','instanceAudioFile','none','figuresOption',1,'sampleChoice','random','outputFileName','simulatedScene','minSpace',-1,'endCut',0,'eventInfoPath','','norm',0); + +sr=44100; check_options(timeMode,ebrMode,score) @@ -172,8 +177,15 @@ end %% Get sceneSchedule and sceneObjects -[sceneSchedule,sceneObjects]=getBackground(inputPath,score); -[sceneSchedule,sceneObjects]=getEvent(sceneSchedule,sceneObjects,inputPath,score,timeMode,ebrMode,strcmp(sampleChoice,'random')); + +if ~strcmp(eventInfoPath,'') + load(eventInfoPath); +else + eventInfo{1}.query='null'; +end + +[sceneSchedule,sceneObjects]=getBackground(inputPath,score,eventInfo,sr); +[sceneSchedule,sceneObjects]=getEvent(sceneSchedule,sceneObjects,inputPath,score,timeMode,ebrMode,sampleChoice,eventInfo,sr); %% Manage overlapping if minSpace>=0 @@ -192,7 +204,7 @@ mkdir([outputPath,'annotation']) end -[simsSceneWav,sceneSchedule] = generateScene(sceneSchedule,sceneObjects,score,inputPath,outputPath,outputFileName,displayFigures,timeMode,endCut); +[simsSceneWav,sceneSchedule] = generateScene(sceneSchedule,sceneObjects,score,inputPath,outputPath,outputFileName,figuresOption,timeMode,endCut,norm,sr); %% Check simulated scene @@ -203,6 +215,5 @@ end %% Generate Sound -% wavwrite(simsSceneWav,44100,[outputPath,'sound/',outputFileName,'.wav']); -audiowrite([outputPath,'sound/',outputFileName,'.wav'],simsSceneWav,44100); +audiowrite([outputPath,'sound/',outputFileName,'.wav'],simsSceneWav,sr); end