Use RNNoise for noise suppression

This commit is contained in:
Storm Dragon
2026-06-28 23:15:09 -04:00
parent c54a5b42b0
commit 5ac6703489
6 changed files with 103 additions and 292 deletions
+14 -44
View File
@@ -18,21 +18,20 @@ type Config struct {
}
type exportableConfig struct {
Hotkeys *Hotkeys
AudioDriver *string
MicVolume *float32
InputDevice *string
OutputDevice *string
Servers []*server
DefaultServer *string
Username *string
NotifyCommand *string
NoiseSuppressionEnabled *bool
NoiseSuppressionThreshold *float32
VoiceEffect *int
Certificate *string
RecordingFormat *string
RecordingDirectory *string
Hotkeys *Hotkeys
AudioDriver *string
MicVolume *float32
InputDevice *string
OutputDevice *string
Servers []*server
DefaultServer *string
Username *string
NotifyCommand *string
NoiseSuppressionEnabled *bool
VoiceEffect *int
Certificate *string
RecordingFormat *string
RecordingDirectory *string
}
type server struct {
@@ -132,10 +131,6 @@ func (c *Config) LoadConfig() {
enabled := false
jc.NoiseSuppressionEnabled = &enabled
}
if c.config.NoiseSuppressionThreshold == nil {
threshold := float32(0.08)
jc.NoiseSuppressionThreshold = &threshold
}
if c.config.VoiceEffect == nil {
effect := 0 // Default to EffectNone
jc.VoiceEffect = &effect
@@ -325,31 +320,6 @@ func (c *Config) SetNoiseSuppressionEnabled(enabled bool) {
c.SaveConfig()
}
func (c *Config) GetNoiseSuppressionThreshold() float32 {
if c.config.NoiseSuppressionThreshold == nil {
return 0.08
}
threshold := *c.config.NoiseSuppressionThreshold
if threshold < 0.0 {
return 0.0
}
if threshold > 1.0 {
return 1.0
}
return threshold
}
func (c *Config) SetNoiseSuppressionThreshold(threshold float32) {
if threshold < 0.0 {
threshold = 0.0
}
if threshold > 1.0 {
threshold = 1.0
}
c.config.NoiseSuppressionThreshold = &threshold
c.SaveConfig()
}
func (c *Config) GetVoiceEffect() int {
if c.config.VoiceEffect == nil {
return 0