Skip to content

Commit

Permalink
Add 24000 Hz as supported sampling rate (#467)
Browse files Browse the repository at this point in the history
* add 24k to files in core

* Add 24k to conversion and flavor tests.

* documentation of 24k sampling rate.

* remove debugging leftover.
  • Loading branch information
ChristianGeng authored Nov 20, 2024
1 parent de9d72b commit f8e992d
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions audb/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def exists(
format: file format, one of ``'flac'``, ``'wav'``
mixdown: apply mono mix-down
sampling_rate: sampling rate in Hz, one of
``8000``, ``16000``, ``22500``, ``44100``, ``48000``
``8000``, ``16000``, ``22500``, ``24000``, ``44100``, ``48000``
cache_root: cache folder where databases are stored.
If not set :meth:`audb.default_cache_root` is used
Expand Down Expand Up @@ -416,7 +416,7 @@ def flavor_path(
format: file format, one of ``'flac'``, ``'wav'``
mixdown: apply mono mix-down
sampling_rate: sampling rate in Hz, one of
``8000``, ``16000``, ``22500``, ``44100``, ``48000``
``8000``, ``16000``, ``22500``, ``24000``, ``44100``, ``48000``
Returns:
flavor path relative to cache folder
Expand Down
2 changes: 1 addition & 1 deletion audb/core/define.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Format:

FORMATS = [Format.WAV, Format.FLAC]
BIT_DEPTHS = [16, 24, 32]
SAMPLING_RATES = [8000, 16000, 22500, 44100, 48000]
SAMPLING_RATES = [8000, 16000, 22500, 24000, 44100, 48000]

# Progress bar
MAXIMUM_REFRESH_TIME = 1 # force progress bar to update every second
2 changes: 1 addition & 1 deletion audb/core/flavor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Flavor(audobject.Object):
format: file format, one of ``'flac'``, ``'wav'``
mixdown: apply mono mix-down on selection
sampling_rate: sampling rate in Hz, one of
``8000``, ``16000``, ``22500``, ``44100``, ``48000``
``8000``, ``16000``, ``22500``, ``24000``, ``44100``, ``48000``
Raises:
ValueError: if a non-supported ``bit_depth``,
Expand Down
4 changes: 2 additions & 2 deletions audb/core/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ def load(
format: file format, one of ``'flac'``, ``'wav'``
mixdown: apply mono mix-down
sampling_rate: sampling rate in Hz, one of
``8000``, ``16000``, ``22500``, ``44100``, ``48000``
``8000``, ``16000``, ``22500``, ``24000``, ``44100``, ``48000``
attachments: load only attachment files
for the attachments
matching the regular expression
Expand Down Expand Up @@ -1521,7 +1521,7 @@ def load_media(
format: file format, one of ``'flac'``, ``'wav'``
mixdown: apply mono mix-down
sampling_rate: sampling rate in Hz, one of
``8000``, ``16000``, ``22500``, ``44100``, ``48000``
``8000``, ``16000``, ``22500``, ``24000``, ``44100``, ``48000``
cache_root: cache folder where databases are stored.
If not set :meth:`audb.default_cache_root` is used
num_workers: number of parallel jobs or 1 for sequential
Expand Down
2 changes: 1 addition & 1 deletion audb/core/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def stream(
format: file format, one of ``'flac'``, ``'wav'``
mixdown: apply mono mix-down
sampling_rate: sampling rate in Hz, one of
``8000``, ``16000``, ``22500``, ``44100``, ``48000``
``8000``, ``16000``, ``22500``, ``24000``, ``44100``, ``48000``
full_path: replace relative with absolute file paths
cache_root: cache folder where databases are stored.
If not set :meth:`audb.default_cache_root` is used
Expand Down
1 change: 1 addition & 0 deletions docs/load.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ The following properties can be changed.
- 8000
- 16000
- 22500
- 24000
- 44100
- 48000
Expand Down
2 changes: 1 addition & 1 deletion tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def test_mixdown(db_root, mixdown):

@pytest.mark.parametrize(
"sampling_rate",
[None, 16000],
[None, 16000, 24000],
)
def test_sampling_rate(db_root, sampling_rate):
db = audb.load(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_flavor.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
None,
audb.core.define.Format.WAV,
True,
16000,
24000,
),
pytest.param(
0,
Expand Down

0 comments on commit f8e992d

Please sign in to comment.