Post

Replies

Boosts

Views

Activity

Comment on Error ShazamCustomRecognizer
Unfortunately it still doesn't work... It's really weird that the second in which I start to play the sound the matcher is not working anymore or maybe it's the AVAudioSession... I really don't know... If you have any other idea or suggestions, will be really appreciated. Thanks a lot !
Jun ’21
Comment on Error ShazamCustomRecognizer
Thanks a lot for the reply. In specific: My app is running the matcher as following (snippet from the code session) if let catalog = try CatalogProvider.catalog(signaturePath: data) {                                                 try matcher.match(catalog: catalog)                                             } At this point the app I'm calling a function called playSounds and I'm passing a URL, that is a remote URL of an .mp3 file hosted on my server. func playSounds(soundUrl: URL, atTime: Double) {         //Remove previous player         self.audioPlayer?.removeObserver(self, forKeyPath: "timeControlStatus")                  //Setup new player         do {             try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default)             try AVAudioSession.sharedInstance().setActive(true)             audioPlayer = AVPlayer(url: soundUrl)             audioPlayer?.addObserver(self, forKeyPath: "timeControlStatus", options: [.old,.new], context: &playerContext)             guard let player = audioPlayer             else             {                 return             }             player.playImmediately(atRate: 1.0)             player.seek(to: CMTime(seconds: atTime + 2, preferredTimescale: CMTimeScale(1.0)))         } catch let error {             print("ERROR AUDIO",error.localizedDescription)         }              } After that playSounds function is called, the matcher stop to do any match. It's basically not working and it's returning me the error that I mentioned above. Platform: iOS 15 on iPhone X. The match function is below: func match(catalog: SHCustomCatalog) throws {                  session = SHSession(catalog: catalog)         session?.delegate = self                  let audioFormat = AVAudioFormat(standardFormatWithSampleRate: audioEngine.inputNode.outputFormat(forBus: 0).sampleRate,                                         channels: 1)         audioEngine.inputNode.installTap(onBus: 0, bufferSize: 2048, format: audioFormat) { [weak session] buffer, audioTime in             session?.matchStreamingBuffer(buffer, at: audioTime)         }                  try AVAudioSession.sharedInstance().setCategory(.record)         AVAudioSession.sharedInstance().requestRecordPermission { [weak self] success in             guard success, let self = self else { return }             try? self.audioEngine.start()         }              }
Jun ’21