diff --git a/theremin/config.yml b/theremin/config.yml index 94ad2fd..e611490 100644 --- a/theremin/config.yml +++ b/theremin/config.yml @@ -16,6 +16,7 @@ theremin: gain_echo: 24 distance_max: 2 cancel_after: 3 + startup_message: Hello. I'm Maude the bod. Lets make beautiful music together. # font: /usr/share/sounds/sf2/FluidR3_GM.sf2 # glide: 1 # slew: 5 diff --git a/theremin/lib/theremin.rb b/theremin/lib/theremin.rb index ac8d9b5..e0437d3 100755 --- a/theremin/lib/theremin.rb +++ b/theremin/lib/theremin.rb @@ -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