Mercurial > hg > simscene-py
comparison simScene.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 | ce14979b84f8 |
comparison
equal
deleted
inserted
replaced
16:92f73423eb37 | 17:fc99c676c280 |
---|---|
63 % The considered bg for this is the mix of all specified bgs. | 63 % The considered bg for this is the mix of all specified bgs. |
64 % | 64 % |
65 % This version of simscene allows a lot of options to be controlled, as | 65 % This version of simscene allows a lot of options to be controlled, as |
66 % optional 'name', value pairs from the 4th argument. Here is a brief | 66 % optional 'name', value pairs from the 4th argument. Here is a brief |
67 % description of the optional parameters: | 67 % description of the optional parameters: |
68 % | 68 % save pictures without displaying them |
69 % - timeMode: control a time spacing between events. | 69 % - timeMode: control a time spacing between events. |
70 % 'generate' (default): values must be set for each track using the | 70 % 'generate' (default): values must be set for each track using the |
71 % score control structure | 71 % score control structure |
72 % 'abstract': values are computed from an abstract representation of | 72 % 'abstract': values are computed from an abstract representation of |
73 % an existing acoustic scene given as parameter | 73 % an existing acoustic scene given as parameter |
98 % | 98 % |
99 % - instanceAudioFile: if timeMode and / or ebrMode are set to 'abstract' | 99 % - instanceAudioFile: if timeMode and / or ebrMode are set to 'abstract' |
100 % or 'replicate', this parameter is the path to the wav | 100 % or 'replicate', this parameter is the path to the wav |
101 % file of the reference scene sampled at 44100 Hz. | 101 % file of the reference scene sampled at 44100 Hz. |
102 % | 102 % |
103 % - figuresOption: (default 1) save and show pictures (piano roll, time domain stacked visualization, overlaid spectrogram) | 103 % - figure: (default 0) save and show pictures (piano roll, time domain stacked visualization, overlaid spectrogram) |
104 % 0: don't save or display pictures | 104 % 0: don't save or display pictures |
105 % 1: save pictures without displaying them | 105 % 1: save pictures without displaying them |
106 % 2: save and display pictures | 106 % 2: save and display pictures |
107 % | |
108 % - channel: (default 0) number of audio channels contained in the file | |
109 % 0: 1 channel (mono) | |
110 % 1: As many channel as sound classes (events+textures) | |
111 % 2: As many channel as sound classes (events+textures). Each | |
112 % channel is saved in a separated wav file. | |
107 % | 113 % |
108 % - outputFileName: name of generated files with no extension | 114 % - outputFileName: name of generated files with no extension |
109 % | 115 % |
110 % - sampleChoice: method for choosing sample to schedule within a track | 116 % - sampleChoice: method for choosing sample to schedule within a track |
111 % 'random': unconstrained sampling | 117 % 'random': unconstrained sampling |
153 % | 159 % |
154 % Uses Mark Paskin's process_options.m from KPMtools | 160 % Uses Mark Paskin's process_options.m from KPMtools |
155 | 161 |
156 addpath(genpath('nonExposed')); | 162 addpath(genpath('nonExposed')); |
157 | 163 |
158 [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); | 164 [timeMode,ebrMode,instanceAnnotFile,instanceAudioFile,figuresOption,sampleChoice,outputFileName,minSpace,endCut,eventInfoPath,norm,channelsOption]=process_options(varargin,'timeMode','generate','ebrMode','generate','instanceAnnotFile','none','instanceAudioFile','none','figure',0,'sampleChoice','random','outputFileName','simulatedScene','minSpace',-1,'endCut',0,'eventInfoPath','','norm',0,'channel',0); |
159 | 165 |
160 sr=44100; | 166 sr=44100; |
161 | 167 |
162 check_options(timeMode,ebrMode,score) | 168 check_options(timeMode,ebrMode,score) |
163 | 169 |
202 end | 208 end |
203 if (~exist([outputPath,'annotation'], 'dir')) | 209 if (~exist([outputPath,'annotation'], 'dir')) |
204 mkdir([outputPath,'annotation']) | 210 mkdir([outputPath,'annotation']) |
205 end | 211 end |
206 | 212 |
207 [simsSceneWav,sceneSchedule] = generateScene(sceneSchedule,sceneObjects,score,inputPath,outputPath,outputFileName,figuresOption,timeMode,endCut,norm,sr); | 213 [sceneSchedule] = generateScene(sceneSchedule,sceneObjects,score,inputPath,outputPath,outputFileName,figuresOption,timeMode,endCut,norm,sr,channelsOption); |
208 | 214 |
209 %% Check simulated scene | 215 %% Check simulated scene |
210 | 216 |
211 checkClassPresence(sceneSchedule,sceneObjects); | 217 checkClassPresence(sceneSchedule,sceneObjects); |
212 | 218 |
213 if minSpace>=0 | 219 if minSpace>=0 |
214 checkOverlapping(sceneSchedule,score.sceneDuration) | 220 checkOverlapping(sceneSchedule,score.sceneDuration) |
215 end | 221 end |
216 | 222 |
217 %% Generate Sound | 223 end |
218 audiowrite([outputPath,'sound/',outputFileName,'.wav'],simsSceneWav,sr); | |
219 end |