Skip to content

Lowering sound volume (effects.Volume) seems to increase it #174

@M4elstr0m

Description

@M4elstr0m

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions