I'm playing a prerecorded sound using a technique from an apple sample:
// Set up the pieces needed to play a sound.
if (clickSound == NULL) {
NSBundle *mainBundle = [NSBundle mainBundle];
clickSound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"clickdown" ofType:@"wav"]];
}
// Play the sound.
[clickSound play];
This works, but the resulting sound is far louder than intended. This is not a problem with the sound volume for the device; the sound itself seems to have been amplified, and changing the amplitude of the original sound using a sound editor does not change the playback volume on the iPhone. I believe the original sound is being amplified by SoundEffect so the peak volume meets some system standard, but that's exactly what I don't want: I'm after a softer, gentler sound, to paraphrase an aging politician.
How do I set the volume of the sound for a prerecorded sound sample?