diff --git a/dist/hornverifier b/dist/hornverifier index 1a284d86..902818eb 100755 Binary files a/dist/hornverifier and b/dist/hornverifier differ diff --git a/dist/roverd b/dist/roverd index 8dfc66a4..6429d20b 100755 Binary files a/dist/roverd and b/dist/roverd differ diff --git a/dist/servoverifier b/dist/servoverifier index bb8d6aea..c6b97a21 100755 Binary files a/dist/servoverifier and b/dist/servoverifier differ diff --git a/pi/roverd/config.go b/pi/roverd/config.go index a83dd568..81199b58 100644 --- a/pi/roverd/config.go +++ b/pi/roverd/config.go @@ -71,6 +71,8 @@ type HornConfig struct { SampleRate int `yaml:"sampleRate" json:"-"` Channels int `yaml:"channels" json:"-"` Device string `yaml:"device" json:"-"` + SineGain float64 `yaml:"sineGain" json:"-"` + SawGain float64 `yaml:"sawGain" json:"-"` } type MediaConfig struct { @@ -174,6 +176,8 @@ func LoadConfig(path string) (*Config, error) { Volume: 0.25, SampleRate: 48000, Channels: 1, + SineGain: 1.0, + SawGain: 0.7, }, NightVision: NightVisionConfig{ Enabled: true, @@ -320,6 +324,12 @@ func validateHornConfig(cfg *HornConfig) { if cfg.Channels <= 0 { cfg.Channels = 1 } + if cfg.SineGain <= 0 { + cfg.SineGain = 1.0 + } + if cfg.SawGain <= 0 { + cfg.SawGain = 0.7 + } } func validateNightVisionConfig(cfg *NightVisionConfig) error { diff --git a/pi/roverd/horn.go b/pi/roverd/horn.go index 85696f30..c31127ae 100644 --- a/pi/roverd/horn.go +++ b/pi/roverd/horn.go @@ -162,6 +162,11 @@ func (h *HornSynth) synthLoop(writer *bufio.Writer, waveform string, freqs []flo framesPerChunk := 512 buf := make([]byte, framesPerChunk*channels*2) scale := volume / float64(len(freqs)) + if waveform == "sine" { + scale *= h.cfg.SineGain + } else { + scale *= h.cfg.SawGain + } stopRequested := false releaseStart := -1 diff --git a/pi/roverd/roverd.sample.yaml b/pi/roverd/roverd.sample.yaml index b37ea68e..586fcc58 100644 --- a/pi/roverd/roverd.sample.yaml +++ b/pi/roverd/roverd.sample.yaml @@ -50,6 +50,8 @@ horn: volume: 0.25 sampleRate: 48000 channels: 1 + sineGain: 1.0 + sawGain: 0.7 nightVision: enabled: true gpioPin: 22