4 from numpy
import float32
, float64
6 from reinteract
.custom_result
import CustomResult
8 class PlayResult(CustomResult
):
9 def __init__(self
, data
):
12 def create_widget(self
):
13 widget
= gtk
.Button("Play")
14 widget
.connect('clicked', self
.play
)
18 def play(self
, *args
):
19 if self
.__data
.dtype
== float32
:
20 command
= 'play -t raw -r 44100 -f -4 -L -q -'
22 command
= 'play -t raw -r 44100 -f -8 -L -q -'
24 f
= os
.popen(command
, 'w')
29 if data
.dtype
!= float32
and data
.dtype
!= float64
:
30 raise TypeError("Data must be float32 or float64, not %s", data
.dtype
)
32 return PlayResult(data
)