You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for making this! I'm interested in using an audio file for the click sound rather than a generated triangle wave, but it doesn't seem to work.
The change (also using only one sound rather than 2):
let clickURL = Bundle.main.url(forResource: "metronome.click", withExtension: "wav")!
let audioFile = try! AVAudioFile(forReading: clickURL)
let audioFormat = audioFile.processingFormat
let audioFrameCount = UInt32(audioFile.length)
audioBuffer = AVAudioPCMBuffer(pcmFormat: audioFormat, frameCapacity: audioFrameCount)
audioBuffer.frameLength = audioFrameCount
try! audioFile.read(into: audioBuffer!)
self.audioFormat = buffers[0]!.format
self.bufferSampleRate = audioFormat.sampleRate
initiazeDefaults()
engine.attach(player)
engine.connect(player, to: engine.outputNode, fromBus: 0, toBus: 0, format: audioFormat)
This works perfectly at BPMs below 90 or so, but as the BPM increases the clicks get quieter and quieter until they disappear. Any thoughts on how to support audio files?
EDIT: Sound file works if it's 0.02 seconds in duration or less it seems.
The text was updated successfully, but these errors were encountered:
Thanks for making this! I'm interested in using an audio file for the click sound rather than a generated triangle wave, but it doesn't seem to work.
The change (also using only one sound rather than 2):
This works perfectly at BPMs below 90 or so, but as the BPM increases the clicks get quieter and quieter until they disappear. Any thoughts on how to support audio files?
EDIT: Sound file works if it's 0.02 seconds in duration or less it seems.
The text was updated successfully, but these errors were encountered: