-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an aubiolevel CLI tool to compute the sound pressure level
Aubio enables users to compute the sound pressure level of a buffer using miscutils.h, but there is no way to get that information from CLI tools right now. This adds support for a standalone CLI tool so that extracting sound pressure level information does not require building a program against the library.
- Loading branch information
Showing
12 changed files
with
158 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,7 @@ SEE ALSO | |
|
||
aubioonset(1), | ||
aubiopitch(1), | ||
aubiolevel(1), | ||
aubiotrack(1), | ||
aubionotes(1), | ||
aubioquiet(1), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
NAME | ||
aubiolevel - a command line tool to extract audio sound pressure level | ||
|
||
SYNOPSIS | ||
|
||
aubiolevel source | ||
aubiolevel [[-i] source] | ||
[-r rate] [-B win] [-H hop] | ||
[-T time-format] | ||
[-v] [-h] | ||
|
||
DESCRIPTION | ||
|
||
aubiolevel outputs audio sound pressure level information. | ||
|
||
The sound pressure level is printed on the console, prefixed by a timestamp | ||
in seconds. The level is in dB SPL, which is ten times the log10 of the | ||
average of the square amplitudes. | ||
|
||
The sound pressure level is either a negative number, or negative infinity | ||
(printed as -inf) when there is no sound. | ||
|
||
OPTIONS | ||
|
||
This program follows the usual GNU command line syntax, with long options | ||
starting with two dashes (--). A summary of options is included below. | ||
|
||
-i, --input source Run analysis on this audio file. Most uncompressed and | ||
compressed are supported, depending on how aubio was built. | ||
|
||
-r, --samplerate rate Fetch the input source, resampled at the given | ||
sampling rate. The rate should be specified in Hertz as an integer. If 0, | ||
the sampling rate of the original source will be used. Defaults to 0. | ||
|
||
-B, --bufsize win The size of the buffer to analyze, that is the length | ||
of the window used for spectral and temporal computations. Defaults to 2048. | ||
|
||
-H, --hopsize hop The number of samples between two consecutive analysis. | ||
Defaults to 256. | ||
|
||
-T, --timeformat format Set time format (samples, ms, seconds). Defaults to | ||
seconds. | ||
|
||
-h, --help Print a short help message and exit. | ||
|
||
-v, --verbose Be verbose. | ||
|
||
SEE ALSO | ||
|
||
aubiopitch(1), | ||
aubioonset(1), | ||
aubiotrack(1), | ||
aubionotes(1), | ||
aubioquiet(1), | ||
aubiomfcc(1), | ||
and | ||
aubiocut(1). | ||
|
||
AUTHOR | ||
|
||
This manual page was written by Paul Brossier <[email protected]>. Permission is | ||
granted to copy, distribute and/or modify this document under the terms of | ||
the GNU General Public License as published by the Free Software Foundation, | ||
either version 3 of the License, or (at your option) any later version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,7 @@ SEE ALSO | |
|
||
aubioonset(1), | ||
aubiopitch(1), | ||
aubiolevel(1), | ||
aubiotrack(1), | ||
aubionotes(1), | ||
aubioquiet(1), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,6 +100,7 @@ SEE ALSO | |
|
||
aubioonset(1), | ||
aubiopitch(1), | ||
aubiolevel(1), | ||
aubiotrack(1), | ||
aubioquiet(1), | ||
aubiomfcc(1), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,7 @@ ONSET METHODS | |
SEE ALSO | ||
|
||
aubiopitch(1), | ||
aubiolevel(1), | ||
aubiotrack(1), | ||
aubionotes(1), | ||
aubioquiet(1), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,7 @@ PITCH METHODS | |
SEE ALSO | ||
|
||
aubioonset(1), | ||
aubiolevel(1), | ||
aubiotrack(1), | ||
aubionotes(1), | ||
aubioquiet(1), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,7 @@ SEE ALSO | |
|
||
aubioonset(1), | ||
aubiopitch(1), | ||
aubiolevel(1), | ||
aubiotrack(1), | ||
aubionotes(1), | ||
aubiomfcc(1), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,7 @@ SEE ALSO | |
|
||
aubioonset(1), | ||
aubiopitch(1), | ||
aubiolevel(1), | ||
aubionotes(1), | ||
aubioquiet(1), | ||
aubiomfcc(1), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
Copyright (C) 2022 Paul Brossier <[email protected]> | ||
This file is part of aubio. | ||
aubio is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
aubio is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with aubio. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "utils.h" | ||
#include "parse_args.h" | ||
|
||
smpl_t level; | ||
|
||
void process_block(fvec_t * ibuf, fvec_t * obuf) | ||
{ | ||
level = aubio_db_spl (ibuf); | ||
} | ||
|
||
void process_print (void) | ||
{ | ||
print_time(blocks * hop_size); | ||
outmsg(" %f\n", level); | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
int ret = 0; | ||
|
||
buffer_size = 2048; | ||
|
||
examples_common_init(argc,argv); | ||
|
||
verbmsg ("using source: %s at %dHz\n", source_uri, samplerate); | ||
|
||
verbmsg ("buffer_size: %d, ", buffer_size); | ||
verbmsg ("hop_size: %d, ", hop_size); | ||
|
||
examples_common_process(process_block, process_print); | ||
|
||
beach: | ||
examples_common_del(); | ||
return ret; | ||
} |