procedural audio with swift
guard let soundFileURL = Bundle.main.url(forResource: "TestSound",
withExtension:"wav") else {
print("URL not found")
return
}
do {
audioPlayer = try AVAudioPlayer(contentsOf: soundFileURL)
} catch let error {
print("Failed to load the sound: \(error)")
}
audioPlayer?.prepareToPlay()