def test_ns_contour_invalid(): srand() ann = Annotation(namespace='pitch_contour') seq_len = 21 times = np.arange(seq_len) durations = np.zeros(seq_len) values = np.linspace(0, 22050, seq_len) # includes 0 (odd symmetric) ids = np.arange(len(values)) // 4 voicing = np.random.randn(len(ids)) * 2 confidences = np.linspace(0, 1., seq_len) confidences[seq_len // 2] = None # throw in a None confidence value for (t, d, v, c, i, b) in zip(times, durations, values, confidences, ids, voicing): ann.append(time=t, duration=d, value={ 'pitch': v, 'id': i, 'voiced': b }, confidence=c) ann.validate()
def est_melody(): srand() freq = np.linspace(110.0, 440.0, 10) voice = np.sign(np.random.randn(len(freq))) return create_annotation(values=freq * voice, confidence=1.0, duration=0.01, namespace='pitch_hz')