Skip to content

Commit

Permalink
Fixed debugging output. Fixed CHUNK sizes. Minor config changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bishoph committed Nov 11, 2017
1 parent 782dbb8 commit a34841f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sopare/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
THRESHOLD = 400

# Silence time in seconds when analysis is called
MAX_SILENCE_AFTER_START = 1
MAX_SILENCE_AFTER_START = 1.4

# Time in seconds after the analysis is forced
MAX_TIME = 2.4
Expand Down
13 changes: 10 additions & 3 deletions sopare/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ def __init__(self, hatch):
self.logger = self.hatch.get('logger').getlog()
self.logger = logging.getLogger(__name__)

defaultCapability = self.pa.get_default_host_api_info()
self.logger.debug(defaultCapability)

self.stream = self.pa.open(format = self.FORMAT,
channels = self.CHANNELS,
rate=sopare.config.SAMPLE_RATE,
Expand All @@ -61,7 +58,16 @@ def __init__(self, hatch):
else:
self.readfromfile()

def debug_info(self):
defaultCapability = self.pa.get_default_host_api_info()
self.logger.debug(str(defaultCapability))
self.logger.debug('SAMPLE_RATE: '+str(sopare.config.SAMPLE_RATE))
self.logger.debug('CHUNK: '+str(sopare.config.CHUNK))



def readfromfile(self):
self.debug_info()
self.logger.info("* reading file " + self.hatch.get('infile'))
file = io.open(self.hatch.get('infile'), 'rb', buffering = sopare.config.CHUNK)
while True:
Expand Down Expand Up @@ -90,6 +96,7 @@ def readfromfile(self):
sys.exit()

def recording(self):
self.debug_info()
self.logger.info("start endless recording")
while self.running:
try:
Expand Down
2 changes: 1 addition & 1 deletion sopare/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "1.3.8"
__version__ = "1.3.9"

2 changes: 1 addition & 1 deletion test/test_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class test_audio():

SAMPLE_RATES = [ 8000, 11025, 12000, 16000, 22050, 32000, 44100, 48000 ]
CHUNKS = [ 500, 1000, 2000, 4000, 8000 ]
CHUNKS = [ 512, 1024, 2048, 4096, 8192 ]
TEST_RESULTS = { }

def __init__(self):
Expand Down

0 comments on commit a34841f

Please sign in to comment.