A new API was added to ShazamKit is iOS 16 that lets you generate a signature from an AVAsset. https://developer.apple.com/documentation/shazamkit/shsignaturegenerator/3991425-generatesignature
This new API is great, it cuts down on a lot of custom code, but is there a way to make the duration of the signature generated a desired length?
Currently the API creates a signature for the entire duration of the AVAsset. If you give it a 60 second long audio file, the signature is 60 seconds. This makes sense when creating signatures for a custom catalog BUT this is not useful when trying to match a song using the Shazam Music Catalog from an audio file.
When matching a song, the match API enforces limits on the signature length (minimumQuerySignatureDuration of 3s, maximumQuerySignatureDuration or 12s). Unless the audio file is between 3 and 12 seconds, the signature from generateSignature will always fail to find a match because it is too short/long.