Caution
You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.10.2.
librosa.util.example
- librosa.util.example(key, hq=False)[source]
Retrieve the example recording identified by ‘key’.
The first time an example is requested, it will be downloaded from the remote repository over HTTPS. All subsequent requests will use a locally cached copy of the recording.
For a list of examples (and their keys), see
librosa.util.list_examples
.By default, local files will be cached in the directory given by pooch.os_cache(‘librosa’). You can override this by setting an environment variable
LIBROSA_DATA_DIR
prior to importing librosa:>>> import os >>> os.environ['LIBROSA_DATA_DIR'] = '/path/to/store/data' >>> import librosa
- Parameters:
- keystr
The identifier for the track to load
- hqbool
If
True
, return the high-quality version of the recording. IfFalse
, return the 22KHz mono version of the recording.
- Returns:
- pathstr
The path to the requested example file
See also
Examples
Load “Hungarian Dance #5” by Johannes Brahms
>>> y, sr = librosa.load(librosa.example('brahms'))
Load “Vibe Ace” by Kevin MacLeod (the example previously packaged with librosa) in high-quality mode
>>> y, sr = librosa.load(librosa.example('vibeace', hq=True))