Lowering sound volume (effects.Volume) seems to increase it
Hey there! I was using your module for my app normally when I found that the sound was a little too loud for users, so I decided to lower it a little. But I can't achieve to lower sound's volume, it seems I can only increase it (if I put -10.0 it is extremely loud):
func PlayNotificationSound(name string, vol float64) {
path := path.Join("assets", "sounds", name+".mp3")
soundFile, err := os.Open(path)
if err != nil {
fmt.Println("Error when reading audio file: ", err)
}
defer soundFile.Close()
streamer, format, err := mp3.Decode(soundFile)
if err != nil {
fmt.Println("Error when decoding audio file: ", err)
}
defer streamer.Close()
speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10))
volume := &effects.Volume{Streamer: streamer, Volume: vol}
speaker.Play(volume)
// speaker.Play(streamer)
time.Sleep(time.Duration(500 * time.Millisecond))
}
So here normally, I would have put vol=-10.0 to lower the volume, but when I do volume := &effects.Volume{Streamer: streamer, Volume: vol} it does the opposite (it hurts)
Can you please tell me how to lower this volume?
Thank you very much!
Hello, I'm not on my computer right now but I suspect the volume struct is missing the Base value, which causes negative volumes to result in an infinite gain.
If that doesn't work let me know. Also consider switching to the gopxl/beep fork. Faiface's repository is no longer maintained. I'll also see issues on the gopxl repo more quickly.