Skip to content

Commit

Permalink
updated sonify module
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcfee committed Dec 13, 2015
1 parent e093991 commit ebc3102
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions jams/sonify.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@
.. autosummary::
:toctree: generated/
beat
chord
melody
onset
segment
sonify
'''

import six
import mir_eval.sonify
from .eval import validate_annotation
from .exceptions import NamespaceError

__all__ = ['sonify']


def clicks(annotation, sr=22050, duration=None, **kwargs):
'''Sonify clicks timings
Expand Down Expand Up @@ -48,6 +46,30 @@ def chord(annotation, sr=22050, duration=None, **kwargs):

def sonify(annotation, sr=22050, duration=None, **kwargs):
'''Sonify a jams annotation through mir_eval
Parameters
----------
annotation : jams.Annotation
The annotation to sonify
sr = : int > 0
The sampling rate of the output waveform
duration : float (optional)
Optional length (in seconds) of the output waveform
kwargs
Additional keyword arguments to mir_eval.sonify functions
Returns
-------
y_sonified : np.ndarray
The waveform of the sonified annotation
Raises
------
NamespaceError
If the annotation has an un-sonifiable namespace
'''

# TODO: add pitch contour sonification here
Expand Down

0 comments on commit ebc3102

Please sign in to comment.