SongRec icon indicating copy to clipboard operation
SongRec copied to clipboard

Ignore the same song repeatedly being recognised

Open thorhop opened this issue 3 years ago • 4 comments

I love this app! It passively listens to tracks so I can get a playlist populated pretty quickly. The bars and cafes won't know what hit 'em!

That being said I would like it if the app compared the previous Shazam lure with the currently generated lure and ignored re-adding it to the list if it's just played. This way if the same song plays down the list you can still see that it's been played more than once but the current song won't be added several times over.

The only issue with this is if the song actually plays again (repeated in the playlist), meaning the app would have to differentiate between the beginning of a song and quite possibly even it's end (something which would require a fair bit of coding I expect, adding to the fact that Shazam doesn't support checking for parts of a song). But I think rather the SongRec playlist and polling issue takes presedence.

I also think this will solve the bug issue #25 since it will compare the lure locally, ignore it if it's the same, minimizing the amount of times the Shazam service is polled.

Screenshot for reference: bilde

thorhop avatar Apr 03 '21 16:04 thorhop

Hello,

Thank you for your feedback.

Screenshot for reference:

The issue that you are describing is more exactly that Shazam is recognizing different parts of the same song as different songs.

I would like it if the app compared the previous Shazam lure with the currently generated lure

The "lure" played by the application is just a re-synthetized audio representation of the fingerprint generated by the Shazam client algorithm.

SongRec does not apply any recognition-type processing over the fingerprint it generates and it is not its intent to do so. The fingerprint is processed by the Shazam server algorithm. Shazam servers then return recognized song info as well as a few metadata.

and ignored re-adding it to the list if it's just played.

A song is already not added to the playlist when it is recognized more than one time in a row (recognition normally applies every ~4 seconds over a ~12 seconds window when microphone recognition is enabled).

But this behavior is suppressed when Shazam servers recognize different parts of the same song as different songs (here, the remix and the non remix, but unrelated songs are also sometimes detected) in an interleaved fashion.

The only issue with this is if the song actually plays again (repeated in the playlist)

Exactly.

meaning the app would have to differentiate between the beginning of a song and quite possibly even it's end (something which would require a fair bit of coding I expect

An useful information that could be leveraged to know whether we are still recognizing the same song that is still playing is the duration of the recognized song, and to see whether at least the concerned duration elapsed since the last occurrence of recognizing the concerned song. But this information does not seem to be present in the Shazam JSON/HTTP response, and would then require to perform an extra HTTP request towards somewhere to be obtained, which would I think likely complicate the functioning of the app as well as underlying constraints.

Shazam seems to emit in the HTTP/JSON response a position of recognition in the original song (expressed in seconds), but I don't think we can leverage it at all, as 1. It is likely often not reflective of the full length of the song, 2. It is likely that it will erroneously detect again repeated parts of a song as already played parts, e.g. during hooks.

But I think rather the SongRec playlist and polling issue takes presedence.

Maybe, but I'm not sure I can propose solid rules that would allow to suppress the first problem while not exacerbating the second one for the moment.

marin-m avatar Apr 06 '21 19:04 marin-m

How about a simple function then, like a button beneath the playlist that lets you clear duplicates from the current playlist? A simple way of just getting a concise list of songs that have been played. But, you also said something interesting...

An useful information that could be leveraged to know whether we are still recognizing the same song that is still playing is the duration of the recognized song, and to see whether at least the concerned duration elapsed since the last occurrence of recognizing the concerned song. But this information does not seem to be present in the Shazam JSON/HTTP response, and would then require to perform an extra HTTP request towards somewhere to be obtained, which would I think likely complicate the functioning of the app as well as underlying constraints.

How about the MusicBrainz API? It will most likely be hit or miss, but at least the service is open. I wouldn't know how you would be able to count that though. I'm guessing the time it takes to recieve a confirmed song from Shazam isn't necessarily close to the beginning of a song, so you'd have your work cut out for you if you use something like MusicBrainz. Maybe an average? Wouldn't know.

thorhop avatar Apr 08 '21 03:04 thorhop

i have the same "issue". im hearing at DJ Streams on Twitch and let this awesome tool making its thing.

I would love to have some simple settings to filter a bit.

  1. something like how often a track has to be recognized to put it in the playlist. 5 times in a row is a hit anything else get ignored. 1.1 or a duaration how long a song have to be the same. it has to be x seconds recognized the same song before putting in the playlist
  2. remove Duplikates.

i get so much hits that are wrong, so something to filter would be awesome

wuast94 avatar Jun 29 '22 09:06 wuast94

I'm getting a sort of similar issue (although I'm not sure this is more relevant to this or #105), where songrec will recognize the wrong song for less than a second or so and then rerecognize the correct one. Is there some way to tweak it to register a song recognition only after some certainty threshold has passed?

aereaux avatar Feb 27 '23 17:02 aereaux