ALL BUSINESS
COMIDA
DIRECTORIES
EDUCATIONAL
ENTERTAINMENT
FASHION TIPS
FINER THINGS
FREE CREATOR TOOLS
HEALTH
MARKETPLACE
MEMBER's ONLY
MONEY MATTER$
MOTIVATIONAL
NEWS & WEATHER
TECHNOLOGIA
TELEVISION NETWORKS
USA VOTES 2024
VIDEOS
INVESTOR RELATIONS
IN DEVELOPMENT
Posted by - Latinos MediaSyndication -
on - July 16, 2023 -
Filed in - Technology -
-
373 Views - 0 Comments - 0 Likes - 0 Reviews
i already created the bridge but its hard to understand the documention of ShazamKit . i wonder if there was any idea/help/source code to help me detect music by microphone on a react native application with latest Shazamkit version. thank you.
i tried this but i got the error: Cannot find 'SHMatcher' in scope
// my swift file import Foundation import ShazamKit import AVFoundation import React @objc(ShazamBridge) class ShazamBridge: NSObject { private let audioEngine = AVAudioEngine() private let session = SHSession() private var signatureGenerator = SHSignatureGenerator() @objc func startListening(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) { let inputNode = audioEngine.inputNode let recordingFormat = inputNode.outputFormat(forBus: 0) inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { (buffer: AVAudioPCMBuffer, when: AVAudioTime) in self.signatureGenerator.append(buffer, at: nil) } audioEngine.prepare() do { try audioEngine.start() } catch { reject("Error", "Audio engine could not start", error) } resolve("Listening started") } @objc func stopListeningAndIdentify(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) { audioEngine.stop() audioEngine.inputNode.removeTap(onBus: 0) let matcher = SHMatcher() let signature = signatureGenerator.signature() matcher.addSignature(signature) session.match(matcher, completion: { (matches, error) in if let error = error { reject("Error", "Failed to match audio", error) } else if let match = matches?.first { resolve(match.mediaItem.title) } else { resolve(nil) } }) } }