Wiki » History » Version 6
Emmanouil Theofanis Chourdakis, 2017-10-05 03:07 PM
1 | 2 | Emmanouil Theofanis Chourdakis | h1. SimScene.py - An acoustic pattern generation tool |
---|---|---|---|
2 | 1 | Emmanouil Theofanis Chourdakis | |
3 | 1 | Emmanouil Theofanis Chourdakis | Copyright (c) Emmanouil Theofanis Chourdakis <e.t.chourdakis@qmul.ac.uk> |
4 | 1 | Emmanouil Theofanis Chourdakis | |
5 | 1 | Emmanouil Theofanis Chourdakis | SimScene.py is a collection of tools to synthesize an audio scene from independent sound events. |
6 | 1 | Emmanouil Theofanis Chourdakis | It is inspired by Lagrange et al. simScene (https://bitbucket.org/mlagrange/simscene) but takes |
7 | 1 | Emmanouil Theofanis Chourdakis | a different direction. The goal of simScene.py is to (1) have a python implementation of such a |
8 | 1 | Emmanouil Theofanis Chourdakis | system since python is the platform of choice for developers accustomed with deep learning packages |
9 | 1 | Emmanouil Theofanis Chourdakis | or other python package candy and (2) to allow generating audio scenes from graph-based patterns. |
10 | 1 | Emmanouil Theofanis Chourdakis | |
11 | 2 | Emmanouil Theofanis Chourdakis | *Currently it can only batch-generate acoustic scenes with target EBRs* |
12 | 2 | Emmanouil Theofanis Chourdakis | |
13 | 1 | Emmanouil Theofanis Chourdakis | Please direct any comments, suggestions, etc. to Emmanouil Chourdakis <e.t.chourdakis@qmul.ac.uk> |
14 | 1 | Emmanouil Theofanis Chourdakis | |
15 | 1 | Emmanouil Theofanis Chourdakis | This code is licensed under GPLv3. Please see LICENSE for more info. |
16 | 1 | Emmanouil Theofanis Chourdakis | |
17 | 2 | Emmanouil Theofanis Chourdakis | h2. Usage |
18 | 1 | Emmanouil Theofanis Chourdakis | |
19 | 5 | Emmanouil Theofanis Chourdakis | The best way to show usage of the tool is through an example of generating 10 scenes of bird sounds in the forest. First, clone the simscene repository (requires git): |
20 | 1 | Emmanouil Theofanis Chourdakis | |
21 | 5 | Emmanouil Theofanis Chourdakis | @git clone https://bitbucket.org/mlagrange/simscene.git@ |
22 | 1 | Emmanouil Theofanis Chourdakis | |
23 | 6 | Emmanouil Theofanis Chourdakis | Then switch to the _python_ directory: |
24 | 5 | Emmanouil Theofanis Chourdakis | |
25 | 5 | Emmanouil Theofanis Chourdakis | @cd python@ |
26 | 5 | Emmanouil Theofanis Chourdakis | |
27 | 5 | Emmanouil Theofanis Chourdakis | Install the necessary libraries |
28 | 2 | Emmanouil Theofanis Chourdakis | |
29 | 2 | Emmanouil Theofanis Chourdakis | @pip install -r requirements.txt@ |
30 | 2 | Emmanouil Theofanis Chourdakis | |
31 | 2 | Emmanouil Theofanis Chourdakis | Then open the files _forest_backgrounds.xls_ and _forest_events.xls_ in the _examples_ folder which contain information about the event and background tracks (for now do not change them, just see that you can open them). Note that you can view the same files as _.txt_ files in the same directory. SimScene.py allows both formats. |
32 | 2 | Emmanouil Theofanis Chourdakis | |
33 | 2 | Emmanouil Theofanis Chourdakis | Here is a preview of the _forest_backgrounds.xls_ in Calc: |
34 | 2 | Emmanouil Theofanis Chourdakis | !forest_backgrounds.png! |
35 | 2 | Emmanouil Theofanis Chourdakis | |
36 | 2 | Emmanouil Theofanis Chourdakis | An explanation of the fields follows: |
37 | 2 | Emmanouil Theofanis Chourdakis | * *label* - The name of the track |
38 | 2 | Emmanouil Theofanis Chourdakis | * *sampleid* - Prefix of the filename the track uses. If there are many files with _sampleid_ as their prefix, one as random is picked and used for generation. |
39 | 2 | Emmanouil Theofanis Chourdakis | * *snr* - For the first row, it is just the amplitude of that track. For the second row and below, it is the SNR (not dB) of the track of that row, relative to the sum of the other tracks. |
40 | 2 | Emmanouil Theofanis Chourdakis | |
41 | 3 | Emmanouil Theofanis Chourdakis | Backgrounds sounds are _looped_ throughout the scene. |
42 | 2 | Emmanouil Theofanis Chourdakis | |
43 | 3 | Emmanouil Theofanis Chourdakis | The events file (_forest_events.xls_) is a bit more complicated: |
44 | 3 | Emmanouil Theofanis Chourdakis | !forest_events.png! |
45 | 1 | Emmanouil Theofanis Chourdakis | |
46 | 3 | Emmanouil Theofanis Chourdakis | * *label* and *sampleid* - same as above. |
47 | 3 | Emmanouil Theofanis Chourdakis | * *ebr* - The desired Energy-to-background ratio relative to the sum of the background tracks. |
48 | 3 | Emmanouil Theofanis Chourdakis | * *ebr_stddev* - How much the desired EBR can deviate (standard deviation). |
49 | 3 | Emmanouil Theofanis Chourdakis | * *mean_time_between_events* - The mean time successive events of that type can occur. Note that it is the mean time between successive start_times unless that value is zero. In that case, the next events starts right after the previous events finishes. |
50 | 3 | Emmanouil Theofanis Chourdakis | * *time_between_events_stddev* - The standard deviation of the starting times of successive events. |
51 | 3 | Emmanouil Theofanis Chourdakis | * *start_time* - The starting time of the track. Note that this is different than the starting time of individual event sounds (in seconds). |
52 | 3 | Emmanouil Theofanis Chourdakis | * *end_time* - The ending time of the track (in seconds). |
53 | 3 | Emmanouil Theofanis Chourdakis | * *fade_in_time/fade_out_time* - Fade in and out times of individual sound events in seconds. |
54 | 3 | Emmanouil Theofanis Chourdakis | |
55 | 3 | Emmanouil Theofanis Chourdakis | After viewing those files, we can generate an acoustic scene and generate some plots on the screen. First of all, create a directory to save the resulting files: |
56 | 3 | Emmanouil Theofanis Chourdakis | |
57 | 3 | Emmanouil Theofanis Chourdakis | @mkdir output@ |
58 | 3 | Emmanouil Theofanis Chourdakis | |
59 | 3 | Emmanouil Theofanis Chourdakis | Then run simscene.py |
60 | 3 | Emmanouil Theofanis Chourdakis | |
61 | 4 | Emmanouil Theofanis Chourdakis | @python simscene.py example/sound/ output/ 10 -e example/forest_events.xls -b example/forest_backgrounds.xls -vvv@ |
62 | 3 | Emmanouil Theofanis Chourdakis | |
63 | 3 | Emmanouil Theofanis Chourdakis | And it will show on screen some plots, and also generate some files in the _output_ directory. Go on and listen to it! Some explanations: |
64 | 3 | Emmanouil Theofanis Chourdakis | |
65 | 3 | Emmanouil Theofanis Chourdakis | * _example/sound/_ is a directory containing event sounds in _example/sound/event_ and background sounds in _example/sound/background_. |
66 | 3 | Emmanouil Theofanis Chourdakis | * _output/_ is the files where generated plots and audio files reside. |
67 | 3 | Emmanouil Theofanis Chourdakis | * 10 is the duration of the scene in seconds. In our case, 10 seconds. |
68 | 3 | Emmanouil Theofanis Chourdakis | * *-e* is a switch pointing at the event file (see above). |
69 | 3 | Emmanouil Theofanis Chourdakis | * *-b* is a switch pointing at the background file (see above). |
70 | 3 | Emmanouil Theofanis Chourdakis | * *-vvv* Is the maximum verbosity level which will show piano roll, will shade over individual events and also plot them on screen. |
71 | 3 | Emmanouil Theofanis Chourdakis | |
72 | 3 | Emmanouil Theofanis Chourdakis | It will generate plots like this one: |
73 | 3 | Emmanouil Theofanis Chourdakis | !scene.png! |
74 | 3 | Emmanouil Theofanis Chourdakis | |
75 | 3 | Emmanouil Theofanis Chourdakis | |
76 | 3 | Emmanouil Theofanis Chourdakis | It can also generate 5 instances of the same scene at once with: |
77 | 3 | Emmanouil Theofanis Chourdakis | |
78 | 4 | Emmanouil Theofanis Chourdakis | @python simscene.py example/sound/ output/ 10 -e example/forest_events.xls -b example/forest_backgrounds.xls -vv -N 5@ |
79 | 1 | Emmanouil Theofanis Chourdakis | |
80 | 4 | Emmanouil Theofanis Chourdakis | Note that you cannot use *-vvv* when using the *-N* switch (it will be ignored). To see more on the available switches, run it with: |
81 | 4 | Emmanouil Theofanis Chourdakis | |
82 | 4 | Emmanouil Theofanis Chourdakis | @python simscene.py -h@ |