mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-14 18:58:50 +01:00
...
This commit is contained in:
parent
ce9261f409
commit
f1961ee5d6
@ -34,6 +34,7 @@ class PIFI(object):
|
|||||||
_FIRST_SELECTED_BIN = 5
|
_FIRST_SELECTED_BIN = 5
|
||||||
_NUMBER_OF_SELECTED_BINS = 1024
|
_NUMBER_OF_SELECTED_BINS = 1024
|
||||||
|
|
||||||
|
_samples_buffer = None
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.sampleSize = self._SAMPLE_SIZE
|
self.sampleSize = self._SAMPLE_SIZE
|
||||||
@ -43,12 +44,17 @@ class PIFI(object):
|
|||||||
try:
|
try:
|
||||||
rawSamples = os.read(fifoFile,self.sampleSize) # will return empty lines (non-blocking)
|
rawSamples = os.read(fifoFile,self.sampleSize) # will return empty lines (non-blocking)
|
||||||
if len(rawSamples) < 1:
|
if len(rawSamples) < 1:
|
||||||
# print("Read error")
|
# print("Read error")
|
||||||
return rawSamples
|
pass
|
||||||
|
else:
|
||||||
|
self._samples_buffer = rawSamples
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if self._samples_buffer == None:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
data = numpy.fromstring(rawSamples, dtype=numpy.int16)
|
data = numpy.fromstring(self._samples_buffer, dtype=numpy.int16)
|
||||||
|
|
||||||
data = data * numpy.hanning(len(data))
|
data = data * numpy.hanning(len(data))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user