Skip to content
Snippets Groups Projects
Commit dd7ceac2 authored by Loïc Lehnhoff's avatar Loïc Lehnhoff
Browse files

readability improvements

parent 688f4109
No related branches found
No related tags found
No related merge requests found
...@@ -9,22 +9,26 @@ ...@@ -9,22 +9,26 @@
## Features ## Features
- [x] Same tools as matplotlib.pyplot plots. - [x] Same tools as matplotlib plots.
- [x] Spectrogram contour annotations.
- [x] Spectrogram automatically computed from waveform. - [x] Spectrogram automatically computed from waveform.
- [x] Choose custom spectrogram resolutions (fft, hop length, clipping of lowest dB values and PCEN). - [x] Direct modification of spectrogram included
- [x] Exportation of contours to local `.json`. - Choose FFT size
- Choose Hop length
- Clip lowest dBFS values
- Switch between PCEN/spectrogram
- [x] Spectrogram contour/bounding box annotations.
- [x] Exportation of contours to local `.json` (custom format).
- [x] Possibility to move points that are already placed. - [x] Possibility to move points that are already placed.
- [x] Modification of previous annotation files. Save & return later! - [x] Modification of previously annotated files.
## Known issues ## Known issues
- laggy when high number of contours/points per contour - Optimisation necessary when many annotations
## Requirements ## Requirements
- Ubuntu / Windows / macOS (tested only on Ubuntu but it *should* work on any OS).
- Python 3.9.7 - Python 3.9.7
- Packages in `requirements.txt` - Packages in `requirements.txt`
- Linux / Windows / macOS (only tested with Ubuntu & Windows10 but it *should* work on any OS).
Install packages in your python environment with `$ pip install -r requirements.txt`. Install packages in your python environment with `$ pip install -r requirements.txt`.
...@@ -32,14 +36,20 @@ Install packages in your python environment with `$ pip install -r requirements. ...@@ -32,14 +36,20 @@ Install packages in your python environment with `$ pip install -r requirements.
## Usage ## Usage
### Execution ### Execution
For classic usage, download PyAVA folder, then open a terminal in the folder and run `$ python PyAVA.py -dir myWavefileFolder -out myOutputFolder` in terminal. For classic usage:
- Download PyAVA folder
- Open a terminal in the folder
- Run `$ python PyAVA.py` in terminal.
- Select audio file to annotate.
- Make annotations (see User actions)
- Save and quit
Run `$python PyAVA.py --help` for details. Run `$python PyAVA.py --help` for details and additional options.
The annotations are saved as [JSON](http://www.json.org/) files. Each file contains a dictionnary with the categories annotated. For each category there is a list of points, each point is defined by a list of two elements : [time (in sec), frequency (in Hz)]. The annotations are saved as [JSON](http://www.json.org/) files. Each file contains a dictionnary with keys corresponding to each annotation. For each contour there is a list of points, each point is defined by a list of two elements : [time (in sec), frequency (in Hz)].
### User actions ### User actions
- Use the toolbar to interact with the plot (same as with matplotlib.pyplot) - Use the toolbar to interact with the plot (same as with matplotlib)
- Shortcuts "p" and "w" to activate panning, "z" to activate zoom. - Shortcuts "p" and "w" to activate panning, "z" to activate zoom.
- Draw lines : - Draw lines :
- User must not have any toolbar item selected in order to annotate the spectrogram. - User must not have any toolbar item selected in order to annotate the spectrogram.
...@@ -54,9 +64,18 @@ The annotations are saved as [JSON](http://www.json.org/) files. Each file conta ...@@ -54,9 +64,18 @@ The annotations are saved as [JSON](http://www.json.org/) files. Each file conta
- Click on `Switch to PCEN` to switch between PCEN and spectrogram image. - Click on `Switch to PCEN` to switch between PCEN and spectrogram image.
### Re-use data ### Re-use data
To load and display the saved annotations, use the "Results" object. It contains several infos: coordinates of the annotations, spectrogram, waveform and more. #### Modification
To modify previous annotations using PyAVA interface:
Open a terminal window in PyAVA folder and run the following lines with Python to see an exemple of use: - Open a terminal window in PyAVA folder
- Run the following command:
`$python PyAVA.py --modify annotation_file audio_file`
#### Display
To display previous annotations, use the `Results` object.
It contains several infos: coordinates of the annotations, spectrogram, waveform and more.
- Open a terminal window in PyAVA folder
- Open python terminal
- Run the following lines (an exemple of use):
```python ```python
import os import os
import json import json
...@@ -77,9 +96,6 @@ print(json.dumps(annot_data.coords, indent=4)) # show file content ...@@ -77,9 +96,6 @@ print(json.dumps(annot_data.coords, indent=4)) # show file content
annot_data.display_contours() # or annot_data.display_contours(img="pcen") annot_data.display_contours() # or annot_data.display_contours(img="pcen")
``` ```
To modify previous annotations, run the following line (using annotations on file SCW6070_20220717_174215.wav as an example):
`$python PyAVA.py --modify SCW6070_20220717_174215-contours.json SCW6070_20220717_174215.wav`
## Support ## Support
Please contact [me](mailto:loic.lehnhoff@gmail.com) for any question and/or idea. Please contact [me](mailto:loic.lehnhoff@gmail.com) for any question and/or idea.
...@@ -288,7 +288,7 @@ class App(object): ...@@ -288,7 +288,7 @@ class App(object):
self.NEW_SR = parameter_dict["SR"] self.NEW_SR = parameter_dict["SR"]
self._default_pcen = parameter_dict["PCEN"] self._default_pcen = parameter_dict["PCEN"]
if self._default_pcen: if not self._default_pcen:
self.initial_text_pcen = "Switch to PCEN" self.initial_text_pcen = "Switch to PCEN"
else: else:
self.initial_text_pcen = "Switch to Spectrogram" self.initial_text_pcen = "Switch to Spectrogram"
......
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
"SR": 96000, "SR": 96000,
"NFFT": 2048, "NFFT": 2048,
"HOP_LENGTH": 512, "HOP_LENGTH": 512,
"CLIPPING": -80 "CLIPPING": -60
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment