Wiki » History » Version 3
Emmanouil Theofanis Chourdakis, 2017-10-04 08:06 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 | 2 | 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 this repository in a directory (requires mercurial): |
20 | 1 | Emmanouil Theofanis Chourdakis | |
21 | 2 | Emmanouil Theofanis Chourdakis | @hg clone https://code.soundsoftware.ac.uk/hg/simscene-py@ |
22 | 2 | Emmanouil Theofanis Chourdakis | |
23 | 2 | Emmanouil Theofanis Chourdakis | Then install the necessary libraries |
24 | 2 | Emmanouil Theofanis Chourdakis | |
25 | 2 | Emmanouil Theofanis Chourdakis | @pip install -r requirements.txt@ |
26 | 2 | Emmanouil Theofanis Chourdakis | |
27 | 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. |
28 | 2 | Emmanouil Theofanis Chourdakis | |
29 | 2 | Emmanouil Theofanis Chourdakis | Here is a preview of the _forest_backgrounds.xls_ in Calc: |
30 | 2 | Emmanouil Theofanis Chourdakis | !forest_backgrounds.png! |
31 | 2 | Emmanouil Theofanis Chourdakis | |
32 | 2 | Emmanouil Theofanis Chourdakis | An explanation of the fields follows: |
33 | 2 | Emmanouil Theofanis Chourdakis | * *label* - The name of the track |
34 | 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. |
35 | 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. |
36 | 2 | Emmanouil Theofanis Chourdakis | |
37 | 3 | Emmanouil Theofanis Chourdakis | Backgrounds sounds are _looped_ throughout the scene. |
38 | 2 | Emmanouil Theofanis Chourdakis | |
39 | 3 | Emmanouil Theofanis Chourdakis | The events file (_forest_events.xls_) is a bit more complicated: |
40 | 3 | Emmanouil Theofanis Chourdakis | !forest_events.png! |
41 | 1 | Emmanouil Theofanis Chourdakis | |
42 | 3 | Emmanouil Theofanis Chourdakis | * *label* and *sampleid* - same as above. |
43 | 3 | Emmanouil Theofanis Chourdakis | * *ebr* - The desired Energy-to-background ratio relative to the sum of the background tracks. |
44 | 3 | Emmanouil Theofanis Chourdakis | * *ebr_stddev* - How much the desired EBR can deviate (standard deviation). |
45 | 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. |
46 | 3 | Emmanouil Theofanis Chourdakis | * *time_between_events_stddev* - The standard deviation of the starting times of successive events. |
47 | 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). |
48 | 3 | Emmanouil Theofanis Chourdakis | * *end_time* - The ending time of the track (in seconds). |
49 | 3 | Emmanouil Theofanis Chourdakis | * *fade_in_time/fade_out_time* - Fade in and out times of individual sound events in seconds. |
50 | 3 | Emmanouil Theofanis Chourdakis | |
51 | 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: |
52 | 3 | Emmanouil Theofanis Chourdakis | |
53 | 3 | Emmanouil Theofanis Chourdakis | @mkdir output@ |
54 | 3 | Emmanouil Theofanis Chourdakis | |
55 | 3 | Emmanouil Theofanis Chourdakis | Then run simscene.py |
56 | 3 | Emmanouil Theofanis Chourdakis | |
57 | 3 | Emmanouil Theofanis Chourdakis | @./simscene.py example/sound/ output/ 10 -e example/forest_events.xls -b example/forest_backgrounds.xls -vvv@ |
58 | 3 | Emmanouil Theofanis Chourdakis | |
59 | 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: |
60 | 3 | Emmanouil Theofanis Chourdakis | |
61 | 3 | Emmanouil Theofanis Chourdakis | * _example/sound/_ is a directory containing event sounds in _example/sound/event_ and background sounds in _example/sound/background_. |
62 | 3 | Emmanouil Theofanis Chourdakis | * _output/_ is the files where generated plots and audio files reside. |
63 | 3 | Emmanouil Theofanis Chourdakis | * 10 is the duration of the scene in seconds. In our case, 10 seconds. |
64 | 3 | Emmanouil Theofanis Chourdakis | * *-e* is a switch pointing at the event file (see above). |
65 | 3 | Emmanouil Theofanis Chourdakis | * *-b* is a switch pointing at the background file (see above). |
66 | 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. |
67 | 3 | Emmanouil Theofanis Chourdakis | |
68 | 3 | Emmanouil Theofanis Chourdakis | It will generate plots like this one: |
69 | 3 | Emmanouil Theofanis Chourdakis | !scene.png! |
70 | 3 | Emmanouil Theofanis Chourdakis | |
71 | 3 | Emmanouil Theofanis Chourdakis | |
72 | 3 | Emmanouil Theofanis Chourdakis | It can also generate 5 instances of the same scene at once with: |
73 | 3 | Emmanouil Theofanis Chourdakis | |
74 | 3 | Emmanouil Theofanis Chourdakis | @./simscene.py example/sound/ output/ 10 -e example/forest_events.xls -b example/forest_backgrounds.xls -vv -N 5@ |
75 | 3 | Emmanouil Theofanis Chourdakis | |
76 | 3 | Emmanouil Theofanis Chourdakis | Note that you cannot use *-vvv* when using the *-N* switch (it will be ignored). |