Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio fingerprint 2.0 #957

Merged
merged 3 commits into from
Oct 16, 2023
Merged

Audio fingerprint 2.0 #957

merged 3 commits into from
Oct 16, 2023

Conversation

Finesse
Copy link
Member

@Finesse Finesse commented Oct 12, 2023

The new audio fingerprint withstands the fingerprinting protection of Safari 17

@Finesse Finesse self-assigned this Oct 12, 2023
}
}

async function getAudioFingerprintWithoutTimeout(): Promise<number> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to specify in the name that this function doesn't have a timeout? Seems unnecessary

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAudioFingerprint is already taken, so I have to make this name more specific. I'd be happy to use a better naming. What function names can you suggest?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe getAudioFingerprintWithoutTimeout ->getUnstabilisedFingerprint or getBaseAudioFingerprint

Or rename default export getAudioFingerprint ->getStabilizedAudioFingerprint

But it is not a blocker anyway, you can leave as is if other names don't feel right

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 3 functions:

  1. getAudioFingerprint (stabilized, with timeout)
  2. getRawAudioFingerprint (not stabilized, with timeout)
  3. getAudioFingerprintWithoutTimeout (not stabilized, without timeout)

I don't quite understand how you want to rename all of them.

What do you think about this:

  1. getStableAudioFingerprintWithTimeout,
  2. getAudioFingerprintWithTimeout,
  3. getAudioFingerprint?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe like this

getAudioFingerprint (stabilized, with timeout) -> as is
getRawAudioFingerprint (not stabilized, with timeout) -> getUnstableAudioFingerprint
getAudioFingerprintWithoutTimeout (not stabilized, without timeout) -> getBaseAudioFingerprint

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't like the part about timeout because it looks like more generic function tries to explain the behavior of particular use case

for (let i = 0; i < signal.length; i++) {
const value = signal[i]
// In very rare cases the signal is 0 on a short range for some reason. Ignoring such samples.
if (value === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: might be not safe if all the values are zeros (not sure if it's possible) because we will return NaN as a signal value

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is indeed possible and handled by extractFingerprint (see the comments). getMiddle is called only if there is at least 1 non-zero sample in the signal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, makes sense, thanks

@Finesse Finesse merged commit 0b398a9 into master Oct 16, 2023
2 of 3 checks passed
@Finesse Finesse deleted the feature/audio2.0 branch October 16, 2023 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants