-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from mrocamora/dev
v0.1.6
- Loading branch information
Showing
18 changed files
with
1,165 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ Thumbs.db | |
docs/generated/ | ||
docs/_build/ | ||
docs/auto_examples/ | ||
docs/source/auto_examples/ | ||
|
||
# Vim | ||
*.swp | ||
|
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
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,59 @@ | ||
# encoding: utf-8 | ||
# pylint: disable=C0103 | ||
""" | ||
Onsets | ||
====== | ||
Onsets detection | ||
---------------- | ||
.. autosummary:: | ||
:toctree: generated/ | ||
detection | ||
""" | ||
|
||
from . import util | ||
from . import features | ||
|
||
__all__ = ['detection'] | ||
|
||
|
||
def detection(signal, fs=22050, **kwargs): | ||
"""Onset detection from audio signal. | ||
Parameters | ||
---------- | ||
signal : np.array | ||
input audio signal | ||
fs : int | ||
sampling rate | ||
**kwargs : (check) | ||
keyword arguments passed down to each of the functions used | ||
Returns | ||
------- | ||
onset_times : np.ndarray | ||
time instants of the onsets | ||
feature_values: np.ndarray | ||
feature values at the onsets | ||
""" | ||
|
||
# valid keywords for peak_detection (other ones are passed to accentuation feature) | ||
peaks_kw, acce_kw = util.getValidKeywords(kwargs, features.peak_detection) | ||
|
||
# accentuation feature computation | ||
acce, times, _ = features.accentuation_feature(signal, fs, **acce_kw) | ||
|
||
# peak picking in the feature function | ||
ons_indx, _, _ = features.peak_detection(acce, **peaks_kw) | ||
|
||
# time instants of the onsets | ||
onset_times = times[ons_indx] | ||
|
||
# feature values at the onsets | ||
feature_values = acce[ons_indx] | ||
|
||
return onset_times, feature_values |
Oops, something went wrong.