Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Commit

Permalink
Back to 12kHz replay
Browse files Browse the repository at this point in the history
- And minor doc tweaks
  • Loading branch information
alanbchristie committed Jul 10, 2017
1 parent 4f0f38e commit bbea110
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions PyBdEcho.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
SAMPLE_FREQUENCY_HZ = 8000

# The playback frequency.
PLAYBACK_FREQUENCY_HZ = 8000
PLAYBACK_FREQUENCY_HZ = 12000

# Capture resolution (8 or 12) bits.
# Capture resolution bits (8 or 12).
CAPTURE_BITS = 8

# Size of the Speech Detection Buffer (SDB) (milliseconds).
Expand All @@ -63,7 +63,7 @@

# Speech threshold - the absolute difference between the silence estimate
# and a sample for it to be considered speech. There's a lot of noise
# on my board so expect +/- 156 at 8kHz and 12-bit (or 10 at 8-bit).
# on my board so expect +/- 156 at 8kHz, 12-bit (or 10 at 8-bit).
# Currently the estimate is not modified as recordings are made
# (although it could be adapted during attenuation).
# This value is 2 x standard deviation of typical noise levels.
Expand All @@ -76,15 +76,16 @@
# The proportion of the number of speech samples observed during the
# speech detection phase that are required to trigger a recording.
# Measured as a percentage size of the speech-detection buffer and
# should be greater than 5%.
# should probably be greater than 5%.
DETECTION_SAMPLES_PCENT = 10

# Estimate of the sample value for silence
# (2048 for 12-bit data and 127 for 8-bit).
# (in an ideal world this would be 2048 for 12-bit data and 127 for 8-bit).
# This is just a default seed for the `adc_zero` value, which is adjusted
# during attenuation, a process that occurs immediately prior to playback.
# My board seems to settle around a value of 1893 at 12-bit.
# Your starting value might be different.
# My board seems to settle around a value of 1893 at 12-bits.
# Your starting value might be different depending on amp-skin resistor
# tolerances (see R11 & R13).
# `adc_zero` is not modified if attenuation is disabled.
if CAPTURE_BITS == 8:
SILENCE = 127
Expand Down Expand Up @@ -300,7 +301,7 @@
# if it looks like there's an SD card present.
# Incidentally ... You will need to hard-reset the card
# before you can see any written files.
DUMP_TO_SD_CARD = True
DUMP_TO_SD_CARD = False
# Maximum number of capture files to maintain.
# The files are used on a round-robin basis by writing
# to capture file 1, then capture file 2, etc.
Expand Down Expand Up @@ -379,7 +380,7 @@ def _init():
capture_timer.init(freq=SAMPLE_FREQUENCY_HZ)
capture_timer.callback(_capture_function)

# Stop the loudspeaker (just in case)
# Stop the loudspeaker (just be safe)
_stop()

# Attach a service function that will handle the USER switch being hit.
Expand Down

0 comments on commit bbea110

Please sign in to comment.