-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
4 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
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 |
---|---|---|
|
@@ -2,11 +2,12 @@ | |
# CREATED:2016-02-11 12:07:58 by Brian McFee <[email protected]> | ||
"""Sonification tests""" | ||
|
||
import six | ||
import numpy as np | ||
|
||
from nose.tools import raises, eq_ | ||
|
||
from eval_test import create_hierarchy | ||
|
||
import jams | ||
|
||
|
||
|
@@ -82,7 +83,6 @@ def test_contour(): | |
'index': 0, | ||
'voiced': (t < 3 or t > 4)}) | ||
|
||
|
||
def __test(ann, duration): | ||
y = jams.sonify.sonify(ann, sr=8000, duration=duration) | ||
if duration is not None: | ||
|
@@ -98,7 +98,7 @@ def __test(namespace, value): | |
ann = jams.Annotation(namespace=namespace) | ||
ann.append(time=0.5, duration=1.0, value=value) | ||
y = jams.sonify.sonify(ann, sr=8000, duration=2.0) | ||
|
||
eq_(len(y), 8000 * 2) | ||
|
||
yield __test, 'chord', 'C:maj/5' | ||
|
@@ -136,3 +136,16 @@ def __test(ann, sr, duration): | |
|
||
for length in [None, 5, 15]: | ||
yield __test, ann, 8000, length | ||
|
||
|
||
def test_multi_segment(): | ||
ann = create_hierarchy(values=['AB', 'abac', 'xxyyxxzz'], duration=30) | ||
sr = 8000 | ||
|
||
def __test(ann, duration): | ||
y = jams.sonify.sonify(ann, sr=sr, duration=duration) | ||
if duration: | ||
eq_(len(y), duration * sr) | ||
|
||
for duration in [None, 15, 30]: | ||
yield __test, ann, duration |