Make espeak options and startup behavior configurable.
FossilOrigin-Name: 153d02185cc6e0ea224ef04593383612ca2f4795e62fda3d73750c8046cf7dad
This commit is contained in:
parent
e96f8d2f12
commit
65ac4ce493
2 changed files with 12 additions and 2 deletions
|
|
@ -123,6 +123,13 @@ class Theremin
|
|||
# Only change the note if the range finder value moves +/- this much
|
||||
# between samples. This helps hold pitch, and avoids "warbles".
|
||||
setting :slew, default: 5
|
||||
|
||||
##
|
||||
# Optional message to speak at startup.
|
||||
setting :startup_message, default: nil
|
||||
|
||||
## ESpeak TTL options.
|
||||
setting :espeak_flags, default: %w[ -k20 -v f5 -s 160 -a 150 ]
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -177,7 +184,7 @@ class Theremin
|
|||
@threads << self.note_thread
|
||||
@threads << self.gain_thread
|
||||
self.led( :green )
|
||||
self.speak "Hi. I'm Maude."
|
||||
self.speak( self.class.startup_message ) if self.class.startup_message
|
||||
self.log.warn "Waiting for interaction, or ctrl-c to exit."
|
||||
@threads.map( &:join )
|
||||
end
|
||||
|
|
@ -268,7 +275,9 @@ class Theremin
|
|||
##
|
||||
def setup_speech
|
||||
self.log.info "Starting background espeak process."
|
||||
cmd = %w[ espeak -k20 -v f5 -s 160 -a 150 ]
|
||||
cmd = [ 'espeak' ]
|
||||
cmd << self.class.espeak_flags
|
||||
cmd.flatten!
|
||||
@speech_io, stdout, stderr, wait_thr = Open3.popen3( *cmd )
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue