I have the following situation:
I took 3 audio files and generated a Shazam signature for each
I created a custom catalog with these 3 signatures
All 3 audio items have an identical 40 second intro
When I create a SHSession with my custom catalog and try to match audio from that common intro section, the matcher returns on the delegate method session(_ session: SHSession, didFind match: SHMatch) - without exception - only 1 object in the match.mediaItems array.
For example: if didFind is called once per second, for signatures A, B, C, I would get a random sequence like - A, B, A, A, C, C, B, A (it's different every time).
According to the documentation, mediaItems should contain all 3 sounds represented by the signatures as possible matches: mediaItems - An array of the media items in the catalog that match the query signature, in order of the quality of the match.
The catalog was built by loading the signature files from disk:
let signatureData = try Data(contentsOf: sigUrl)
let signature = try SHSignature(dataRepresentation: signatureData)
let mediaItem = SHMediaItem(properties: [.title: sigName])
try customCatalog.addReferenceSignature(signature, representing: [mediaItem])
I tried matching:
with session.matchStreamingBuffer(buffer, at: audioTime) (so sending the audio input directly to the matching session)
by creating a signature of the recorded audio for different durations (from 3 to 15 seconds recording duration) and sending the signature to the matcher to session.match(signature).
I also tried the async/await version, for the small chance of implementation differences between the two
but I always, without exception, only get 1 item in the mediaItems array.
Everything else seems to be working correctly - apart from matching within the common section.
Does anyone have any suggestions about this? Is it expected behaviour or a ShazamKit bug?