load_media()¶
- audb.load_media(name, media, *, version=None, bit_depth=None, channels=None, format=None, mixdown=False, sampling_rate=None, cache_root=None, num_workers=1, timeout=86400, verbose=True)[source]¶
Load media file(s).
If you are interested in media files and not the corresponding tables, you can use
audb.load_media()to load them. This will not download any table files to your disk, but share the cache withaudb.load().- Parameters
name (
str) – name of databasemedia (
str|Sequence[str]) – load media files provided in the listchannels (
Union[int,Sequence[int],None]) – channel selection, seeaudresample.remix(). Note that media files with too few channels will be first upsampled by repeating the existing channels. E.g.channels=[0, 1]upsamples all mono files to stereo, andchannels=[1]returns the second channel of all multi-channel files and all mono filesmixdown (
bool) – apply mono mix-downsampling_rate (
Optional[int]) – sampling rate in Hz, one of8000,16000,22050,24000,44100,48000cache_root (
Optional[str]) – cache folder where databases are stored. If not setaudb.default_cache_root()is usednum_workers (
Optional[int]) – number of parallel jobs or 1 for sequential processing. IfNonewill be set to the number of processors on the machine multiplied by 5timeout (
float) – maximum time in seconds before giving up acquiring a lock to the database cache folder.Noneis returned in this caseverbose (
bool) – show debug messages
- Return type
- Returns
paths to media files
- Raises
ValueError – if a media file is requested that is not part of the database
ValueError – if a non-supported
bit_depth,format, orsampling_rateis requested
Examples
>>> paths = audb.load_media( ... "emodb", ... ["wav/03a01Fa.wav"], ... version="1.4.1", ... format="flac", ... verbose=False, ... ) >>> paths[0].split(os.path.sep)[-5:] ['emodb', '1.4.1', '40bb2241', 'wav', '03a01Fa.flac']