-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
You can find other examples in the tests/processors folder.
To find the opening of a series by audio paths:
cfg = Config()
files = [f'assets/audio_files/{i}.wav' for i in paths]
recognised = recognise_from_audio_files(files, cfg)
# Returns a list of intervals
# [(start=0.25, end=30.25), (start=0.20, end=30.20), ...]To find the opening of a series by audio samples:
def some_audio_loading_function() -> np.ndarray:
return np.random.rand(1000)
cfg = Config()
samples = map(lambda _: (some_audio_loading_funciton(), None, None), range(10))
recognised = recognise_from_audio_samples(samples, cfg)
# Returns a list of intervals
# [(start=0.25, end=30.25), (start=0.20, end=30.20), ...]To find the ending of a series by audio paths, analysing intervals from 1 to 35 seconds:
cfg = Config()
files = [(f'assets/audio_files/{i}.wav', 2, 30) for i in paths]
recognised = recognise_from_audio_files(files, cfg)
# Returns a list of intervals
# [(start=0, end=28.25), (start=0, end=28.20), ...]- Iterator of audio samples (numpy ndarrays), offset and duration
- Iterator of audio files
- Iterator of audio files, offset and duration
Offset and duration are used to extract the audio features of the episodes and can be None. If None, the whole audio will be used.
WARN: See the warning #1 in the Usage section.
- List of intervals of the same fragment in the episodes
To find an opening, pass the first minutes (e.g. 5 minutes) of the episodes. To find an ending, pass the last minutes (e.g. 5 minutes) of the episodes.
WARN: See the warning #2 in the Usage section.
WARNING #1: Do not pass the whole episodes, it will take a long time to process and the results will not be accurate (in this case, the library will find the intro or outro, depending on which part is longer).
WARNING #2: If you use recognise_from_audio_files_with_offsets and offsets are provided, the library WILL NOT add it to the output intervals. Please, add it manually.
WARNING #3: There is a well-known memory leak in sklearn. You will see a warning
when running the app. The memory leak should not be a problem for a short run,
but it is recommended to add OMP_NUM_THREADS=1 to the environment variables.