Onyx logo

Previous topic

onyx.signalprocessing.delta – Delta calculations.

Next topic

onyx.signalprocessing.filter – Simple FIR and IIR signal processing

This Page

onyx.signalprocessing.endpoint – Support for tagging utterance frames as speech/background. Currently

includes tracker values along with tags in order to support demoing instrumentation. But really raises intersting issues regarding integrated instrumentation.

class onyx.signalprocessing.endpoint.RangeTracker(min_hunt, max_hunt, dtype=<type 'float'>)

Bases: object

Simple, one-dimensional range tracking.

>>> tracker = RangeTracker(min_hunt=1, max_hunt=-2, dtype=np.int)
>>> for sample in range(5) + range(5, 0, -1):
...   sample *= 4
...   print sample, tracker(sample)
0 (0, 0)
4 (1, -2)
8 (2, 8)
12 (3, 12)
16 (4, 16)
20 (5, 20)
16 (6, 18)
12 (7, 16)
8 (8, 14)
4 (4, 12)
>>> for i in xrange(8):
...   print 3, tracker(3)
3 (3, 10)
3 (3, 8)
3 (3, 6)
3 (3, 4)
3 (3, 2)
3 (3, 3)
3 (3, 3)
3 (3, 3)
range
class onyx.signalprocessing.endpoint.UtteranceTagger(min_hunt, max_hunt, min_range, low_per_mil, high_per_mil, start_window, start_count, stop_window, stop_count)

Bases: object

Utterance tagging based on simple tracking.

>>> tagger = UtteranceTagger(1, -2, 10, 200, 600, 20, 10, 25, 15)
>>> tags = tuple(tagger(value) for value in chain([20, 25], [60] * 50, [20] * 40, [60] * 50, [20] * 40))
>>> tagger.range
(20.0, 20.0)
>>> tagger(30)
((False, (20.0, 20.0)),)
>>> tagger(30)
((False, (20.0, 20.0)),)

Subtle: these False tags, and the range are the categorization of earlier samples from the ending set of 20’s we pumped in above, not the 30’s we just pumped. Note that the current range has adapted to the 30’s.

>>> tagger.range
(22.0, 30.0)
>>> tuple(tuple(tagx[0] for tagx in tag) if tag else () for tag in tags)
((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True,), (True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,), (False,))
>>> tags
((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ((True, (20.0, 20.0)), (True, (21.0, 18.0)), (True, (22.0, 60.0)), (True, (23.0, 60.0)), (True, (24.0, 60.0)), (True, (25.0, 60.0)), (True, (26.0, 60.0)), (True, (27.0, 60.0)), (True, (28.0, 60.0)), (True, (29.0, 60.0)), (True, (30.0, 60.0)), (True, (31.0, 60.0)), (True, (32.0, 60.0)), (True, (33.0, 60.0)), (True, (34.0, 60.0)), (True, (35.0, 60.0)), (True, (36.0, 60.0)), (True, (37.0, 60.0)), (True, (38.0, 60.0)), (True, (39.0, 60.0))), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ((True, (40.0, 60.0)),), ((True, (41.0, 60.0)),), ((True, (42.0, 60.0)),), ((True, (43.0, 60.0)),), ((True, (44.0, 60.0)),), ((True, (45.0, 60.0)),), ((True, (46.0, 60.0)),), ((True, (47.0, 60.0)),), ((True, (48.0, 60.0)),), ((True, (49.0, 60.0)),), ((True, (50.0, 60.0)), (True, (51.0, 60.0)), (True, (52.0, 60.0)), (True, (53.0, 60.0)), (True, (54.0, 60.0)), (True, (55.0, 60.0)), (True, (56.0, 60.0)), (True, (57.0, 60.0)), (True, (58.0, 60.0)), (True, (59.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (20.0, 58.0)), (True, (20.0, 56.0)), (True, (20.0, 54.0))), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ((False, (20.0, 52.0)),), ((False, (20.0, 50.0)),), ((False, (20.0, 48.0)),), ((False, (20.0, 46.0)),), ((False, (20.0, 44.0)),), ((False, (20.0, 42.0)),), ((False, (20.0, 40.0)),), ((False, (20.0, 38.0)),), ((False, (20.0, 36.0)),), ((False, (20.0, 34.0)),), ((False, (20.0, 32.0)),), ((False, (20.0, 30.0)),), ((False, (20.0, 28.0)),), ((False, (20.0, 26.0)),), ((False, (20.0, 24.0)),), ((False, (20.0, 22.0)),), ((False, (20.0, 20.0)),), ((False, (20.0, 18.0)),), ((False, (20.0, 20.0)),), ((False, (20.0, 20.0)),), ((False, (20.0, 20.0)),), ((False, (20.0, 20.0)),), ((False, (20.0, 20.0)),), ((False, (20.0, 20.0)),), ((False, (20.0, 20.0)),), ((False, (20.0, 20.0)),), ((False, (20.0, 20.0)),), ((True, (20.0, 20.0)), (True, (20.0, 20.0)), (True, (20.0, 20.0)), (True, (20.0, 20.0)), (True, (20.0, 20.0)), (True, (20.0, 20.0)), (True, (20.0, 20.0)), (True, (20.0, 20.0)), (True, (20.0, 20.0)), (True, (20.0, 20.0)), (True, (21.0, 60.0)), (True, (22.0, 60.0)), (True, (23.0, 60.0)), (True, (24.0, 60.0)), (True, (25.0, 60.0)), (True, (26.0, 60.0)), (True, (27.0, 60.0)), (True, (28.0, 60.0)), (True, (29.0, 60.0)), (True, (30.0, 60.0))), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ((True, (31.0, 60.0)),), ((True, (32.0, 60.0)),), ((True, (33.0, 60.0)),), ((True, (34.0, 60.0)),), ((True, (35.0, 60.0)),), ((True, (36.0, 60.0)),), ((True, (37.0, 60.0)),), ((True, (38.0, 60.0)),), ((True, (39.0, 60.0)),), ((True, (40.0, 60.0)),), ((True, (41.0, 60.0)),), ((True, (42.0, 60.0)),), ((True, (43.0, 60.0)),), ((True, (44.0, 60.0)),), ((True, (45.0, 60.0)),), ((True, (46.0, 60.0)),), ((True, (47.0, 60.0)),), ((True, (48.0, 60.0)),), ((True, (49.0, 60.0)),), ((True, (50.0, 60.0)), (True, (51.0, 60.0)), (True, (52.0, 60.0)), (True, (53.0, 60.0)), (True, (54.0, 60.0)), (True, (55.0, 60.0)), (True, (56.0, 60.0)), (True, (57.0, 60.0)), (True, (58.0, 60.0)), (True, (59.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (60.0, 60.0)), (True, (20.0, 58.0)), (True, (20.0, 56.0)), (True, (20.0, 54.0)), (True, (20.0, 52.0))), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ((False, (20.0, 50.0)),), ((False, (20.0, 48.0)),), ((False, (20.0, 46.0)),), ((False, (20.0, 44.0)),), ((False, (20.0, 42.0)),), ((False, (20.0, 40.0)),), ((False, (20.0, 38.0)),), ((False, (20.0, 36.0)),), ((False, (20.0, 34.0)),), ((False, (20.0, 32.0)),), ((False, (20.0, 30.0)),), ((False, (20.0, 28.0)),), ((False, (20.0, 26.0)),), ((False, (20.0, 24.0)),), ((False, (20.0, 22.0)),), ((False, (20.0, 20.0)),), ((False, (20.0, 18.0)),))
>>> with DebugPrint('UtteranceTagger'):
...   tagger = UtteranceTagger(1, -2, 10, 200, 600, 20, 10, 25, 15)
...   tagger(0)
...   tagger(30)
...   tagger(25)
UtteranceTagger: __init__: 1 -2 0.2 0.6 10 20 10 25 15
UtteranceTagger: state bac  count 0  queue 0  value 0  range 0.0 0.0
()
UtteranceTagger: state bac  count 0  queue 1  value 30  range 1.0 -2.0
UtteranceTagger: new_count 1
()
UtteranceTagger: state bac  count 1  queue 2  value 25  range 2.0 25.0
UtteranceTagger: new_count 2
()
range