comparison doc/command_line_usage.rst @ 450:ea94b19d13cb

Merge branch 'master' of https://github.com/amsehili/auditok
author www-data <www-data@c4dm-xenserv-virt2.eecs.qmul.ac.uk>
date Fri, 01 Nov 2024 09:18:00 +0000
parents f91576bf2a29
children
comparison
equal deleted inserted replaced
448:3911ff1d719d 450:ea94b19d13cb
5 about available parameters and descriptions, type: 5 about available parameters and descriptions, type:
6 6
7 .. code:: bash 7 .. code:: bash
8 8
9 auditok -h 9 auditok -h
10
11
12 .. code::
13
14 usage: auditok [-h] [--version] [-I INT] [-F INT] [-f STRING] [-M FLOAT] [-L] [-O FILE] [-o STRING] [-j FLOAT] [-T STRING] [-u INT/STRING]
15 [-a FLOAT] [-n FLOAT] [-m FLOAT] [-s FLOAT] [-d] [-R] [-e FLOAT] [-r INT] [-c INT] [-w INT] [-C STRING] [-E] [-B] [-p]
16 [--save-image FILE] [--printf STRING] [--time-format STRING] [--timestamp-format TIMESTAMP_FORMAT] [-q] [-D] [--debug-file FILE]
17 [input]
18
19 auditok, an audio tokenization tool.
20
21 options:
22 -h, --help show this help message and exit
23 --version, -v show program's version number and exit
24 -q, --quiet Quiet mode: Do not display any information on the screen.
25 -D, --debug Debug mode: output processing operations to STDOUT.
26 --debug-file FILE Save processing operations to the specified file.
27
28 Input-Output options::
29 input Input audio or video file. Use '-' for stdin [Default: read from a microphone using PyAudio].
30 -I INT, --input-device-index INT
31 Audio device index [Default: None]. Optional and only effective when using PyAudio.
32 -F INT, --audio-frame-per-buffer INT
33 Audio frame per buffer [Default: 1024]. Optional and only effective when using PyAudio.
34 -f STRING, --input-format STRING
35 Specify the input audio file format. If not provided, the format is inferred from the file extension. If the output file
36 name lacks an extension, the format is guessed from the file header (requires pydub). If neither condition is met, an
37 error is raised.
38 -M FLOAT, --max-read FLOAT
39 Maximum data (in seconds) to read from a microphone or a file [Default: read until the end of the file or stream].
40 -L, --large-file Whether the input file should be treated as a large file. If True, data will be read from file on demand, otherwise all
41 audio data is loaded into memory before tokenization.
42 -O FILE, --save-stream FILE
43 Save read audio data (from a file or a microphone) to a file. If omitted, no audio data will be saved.
44 -o STRING, --save-detections-as STRING
45 Specify the file name format to save detected events. You can use the following placeholders to construct the output
46 file name: {id} (sequential, starting from 1), {start}, {end}, and {duration}. Time placeholders are in seconds.
47 Example: 'Event_{id}{start}-{end}{duration:.3f}.wav'
48 -j FLOAT, --join-detections FLOAT
49 Join (glue) detected audio events with a specified duration of silence between them. To be used in combination with the
50 --save-stream / -O option.
51 -T STRING, --output-format STRING
52 Specify the audio format for saving detections and/or the main stream. If not provided, the format will be (1) inferred
53 from the file extension or (2) default to raw format.
54 -u INT/STRING, --use-channel INT/STRING
55 Specify the audio channel to use for tokenization when the input stream is multi-channel (0 refers to the first
56 channel). By default, this is set to None, meaning all channels are used, capturing any valid audio event from any
57 channel. Alternatively, set this to 'mix' (or 'avg'/'average') to combine all channels into a single averaged channel
58 for tokenization. Regardless of theoption chosen, saved audio events will have the same number of channels as the input
59 stream. [Default: None, use all channels].
60
61 Tokenization options::
62 Set audio events' duration and set the threshold for detection.
63
64 -a FLOAT, --analysis-window FLOAT
65 Specify the size of the analysis window in seconds. [Default: 0.01 (10ms)].
66 -n FLOAT, --min-duration FLOAT
67 Minimum duration of a valid audio event in seconds. [Default: 0.2].
68 -m FLOAT, --max-duration FLOAT
69 Maximum duration of a valid audio event in seconds. [Default: 5].
70 -s FLOAT, --max-silence FLOAT
71 Maximum duration of consecutive silence allowed within a valid audio event in seconds. [Default: 0.3]
72 -d, --drop-trailing-silence
73 Remove trailing silence from a detection. [Default: trailing silence is retained].
74 -R, --strict-min-duration
75 Reject events shorter than --min-duration, even if adjacent to the most recent valid event that reached max-duration.
76 [Default: retain such events].
77 -e FLOAT, --energy-threshold FLOAT
78 Set the log energy threshold for detection. [Default: 50]
79
80 Audio parameters::
81 Set audio parameters when reading from a headerless file (raw or stdin) or when using custom microphone settings.
82
83 -r INT, --rate INT Sampling rate of audio data [Default: 16000].
84 -c INT, --channels INT
85 Number of channels of audio data [Default: 1].
86 -w INT, --width INT Number of bytes per audio sample [Default: 2].
87
88 Use audio events::
89 Use these options to print, play, or plot detected audio events.
90
91 -C STRING, --command STRING
92 Provide a command to execute when an audio event is detected. Use '{file}' as a placeholder for the temporary WAV file
93 containing the event data (e.g., `-C 'du -h {file}'` to display the file size or `-C 'play -q {file}'` to play audio
94 with sox).
95 -E, --echo Immediately play back a detected audio event using pyaudio.
96 -B, --progress-bar Show a progress bar when playing audio.
97 -p, --plot Plot and displays the audio signal along with detections (requires matplotlib).
98 --save-image FILE Save the plotted audio signal and detections as a picture or a PDF file (requires matplotlib).
99 --printf STRING Prints information about each audio event on a new line using the specified format. The format can include text and
100 placeholders: {id} (sequential, starting from 1), {start}, {end}, {duration}, and {timestamp}. The first three time
101 placeholders are in seconds, with formatting controlled by the --time-format argument. {timestamp} represents the system
102 date and time of the event, configurable with the --timestamp-format argument. Example: '[{id}]: {start} -> {end} --
103 {timestamp}'.
104 --time-format STRING Specify the format for printing {start}, {end}, and {duration} placeholders with --printf. [Default: %S]. Accepted
105 formats are : - %S: absolute time in seconds - %I: absolute time in milliseconds - %h, %m, %s, %i: converts time into
106 hours, minutes, seconds, and milliseconds (e.g., %h:%m:%s.%i) and only displays provided fields. Note that %S and %I can
107 only be used independently.
108 --timestamp-format TIMESTAMP_FORMAT
109 Specify the format used for printing {timestamp}. Should be a format accepted by the 'datetime' standard module.
110 [Default: '%Y/%m/%d %H:%M:%S'].
111
10 112
11 Below, we provide several examples covering the most common use cases. 113 Below, we provide several examples covering the most common use cases.
12 114
13 115
14 Real-Time audio acquisition and event detection 116 Real-Time audio acquisition and event detection