aleksey-saenko / MusicRecognizer

An Android application for music recognition that uses AudD and ACRCloud services to perform song identification.
GNU General Public License v3.0
513 stars 14 forks source link

Feature request: Capture device's audio output for recognition. #54

Closed RokeJulianLockhart closed 4 weeks ago

RokeJulianLockhart commented 6 months ago

Problem

As this explains, Audile https://github.com/aleksey-saenko/MusicRecognizer/releases/download/v1.4.3/Audile_v1.4.3_github.apk currently doesn't appear to be able to recognise sound which hasn't been routed via the speakers of the device and subsequently recognised by the microphone. However, Shazam is able to.

Solution

Consequently, please implement the ability to recognise audio from the device which doesn't exit a speaker, whether that's due to 0% audio volume or connected headphones.

pdimu commented 5 months ago

Audile already does that. i just tried it and it seems to take the music that is playing on the phone (even with headphones). at least @aleksey-saenko should have known what he built someone end this issue up

RokeJulianLockhart commented 5 months ago

https://github.com/aleksey-saenko/MusicRecognizer/issues/54#issuecomment-2155228912

@okgamr, I don't understand that last sentence:

at least @aleksey-saenko should have known what he built someone end this issue up

Can you rephrase it?

pdimu commented 5 months ago

i mean, he didn't know this was already working. he edited the title and added the label (or it may have been a bot, idk), so he could just snap in and say "already implemented"

pdimu commented 5 months ago

i'm using 1.4.3 right now (i'm about to update tho) and the issue is between 1.4.3 and 1.5.0, so i can say you were using 1.4.3, isn't it? and in 1.4.3 the feature you were calling here was already implemented

aleksey-saenko commented 5 months ago

@okgamr @RokeJulianLockhart This request refers to the ability to recognize music when it is played only through headphones. This feature has not yet been implemented. Currently, the app recognizes audio recorded using a microphone. It doesn't matter if the music is playing from the phone or another device, as long as it can be heard by the microphone. To implement this feature request, in addition to the microphone, it would also be necessary to capture audio directly from the device. The problem is that Android prohibits doing this without explicit one-time permission. If this were implemented using MediaProjection (an API specifically designed for this purpose that guarantees sound quality), then with each recognition request you will need to grant the permission in system dialog, which is not user-friendly. And you can notice that Shazam does not request such permissions. They likely record audio through the Visualizer, but it is not intended for this purpose, and the recording quality turns out to be very poor (at least in my experiments). Therefore, this feature has not yet found its implementation.

aleksey-saenko commented 5 months ago

@okgamr If you were listening to music only through headphones but the app still recognized it, I assume that your microphone was able to catch this quiet sound (open-type headphones or with built-in mic, high volume?), amplify it, and that was enough for the service. You can perform some tests with the internet turned off; in this case, recordings will be saved in queue, and you'll be able to listen to their quality.

pdimu commented 5 months ago

@okgamr If you were listening to music only through headphones but the app still recognized it, I assume that your microphone was able to catch this quiet sound (open-type headphones or with built-in mic, high volume?), amplify it, and that was enough for the service. You can perform some tests with the internet turned off; in this case, recordings will be saved in queue, and you'll be able to listen to their quality.

ok.... then i will just use the headphones at low volume i guess

0-BlackSpectrum-0 commented 2 months ago

Any news when this feature is going to be implemented? I came here to ask for this! Please add this feature

aleksey-saenko commented 4 weeks ago

Added in version 1.7.0, will be available on F-Droid within a few days.

As I mentioned earlier, Android offers only one official way to record the device's audio output - MediaProjection API. This method has several limitations:

But overall it works.