AudioKit / AudioKitUI

Controls and Visualization for AudioKit apps
MIT License
209 stars 52 forks source link

sampler.loadSoundFont not working #76

Closed KittenYang closed 1 year ago

KittenYang commented 1 year ago

macOS Version(s) Used to Build

macOS 13 Ventura

Xcode Version(s)

Xcode 14

Description

public func loadSequencerFile(fileURL: URL) {
        sequencer.loadMIDIFile(fromURL: fileURL)
        if sequencer.allTempoEvents.isNotEmpty {
            lastTempo = sequencer.allTempoEvents[0].1
        } else {
            lastTempo = sequencer.tempo
        }
        sequencer.setGlobalMIDIOutput(sampler.midiIn)
        do {
            try sampler.loadSoundFont("UprightPianoKW-20190703", preset: 0, bank: 0)
        } catch {
        }
    }

I replace the SoundFont with custom .sf2 file, and the url is not nil. But in the demo MIDITrack.swift still play the default beeper sound. How can I load custom .sf2 file?

Crash Logs, Screenshots or Other Attachments (if applicable)

No response

KittenYang commented 1 year ago

I figured it out, must turn on the background modes for audio!!

截屏2023-11-27 02 29 22