• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[MODULE][Magisk & Xposed][19/04] Ambient Music Mod - Pixel Ambient Music port for other, compatible devices

Search This thread

Quinny899

Recognized Developer / Recognized Contributor
Jan 26, 2011
8,577
7,795
24
Salford, Greater Manchester, UK
quinny898.co.uk
Important: YOU MUST HAVE BOTH XPOSED AND MAGISK INSTALLED TO USE THIS MODULE. READ THE FAQ FOR MORE INFO.

Ambient Music Mod​

A hybrid Xposed & Magisk module that ports Pixel Ambient Music to other, compatible devices. If you don't know what Pixel Ambient Music is, it's the feature that recognises music that's playing in the background (ie. not from your phone) automatically. It does this locally, without a connection, and doesn't send any data to Google servers for recognition.

The aim of this feature is simple - you'll never wonder "what's that song" again when around the house or out and about - as your phone will tell you without you even having to ask.

Please read the FAQ before asking questions or reporting issues

Features​

  • Full Ambient Music support, including downloading the latest databases from Google
  • Music recognition when the device is idle or in use (exclusions apply, see the FAQ for more details)
  • Now Playing History built in, and support for third party history apps
  • The ability to display the current now playing track on the lock screen using an Accessibility overlay service
  • Manual recognition on demand in the Ambient Music Mod app
  • Settings to control the amplification, how often recognition should be triggered, whether to run on the small CPU cores and what to do when a song recognition notification is tapped
  • View all the recognisable track in your locally downloaded database via the Track List option

Requirements​

  • Magisk
  • Xposed
  • A device with a Snapdragon processor that supports Sound Trigger 2.1 or above (the app will tell you if it's compatible)

Installation Instructions​

  • Install the latest release APK from the GitHub releases page
  • Open the app, check your device is compatible and build the module using the Build Installer option
  • Install the built Magisk module using the Magisk app
  • Enable the Xposed module in Xposed Manager
  • Reboot

Changelog​

1.1.1
Fixed an issue where the Xposed warning dialog continue button did not work

1.1
  • Added a new compatibility checker that checks if getModelState() [and therefore hopefully the module] is supported. This isn't 100% perfect so a bypass is also available
  • Tweaked sound trigger injection to include an XML line that's required for some devices
  • Fixed track list not loading for some people
  • Hopefully fixed log dump zips
  • Newly built modules will now also keep a copy of your original sound trigger XML. This change allows for comparison in the log dumps, and may help updates in the future.
IMPORTANT: When updating the module (which will force you to uninstall/disable the current module and reboot), the module name will change. Therefore, you are advised to uninstall the previous module as part of this process.

Screenshots​

Ambient Music Mod displaying the currently playing track on the lock screen of a OnePlus 7T Pro running Oxygen OS 11:



Settings, Installer, standard Ambient Music settings & Now Playing history



You can verify that the songs displayed in these screenshots were being played at the time by viewing a screenshot of the playlist from the radio station being listened to at the time here

1,270 days, stop the clock.
 
Last edited:

Quinny899

Recognized Developer / Recognized Contributor
Jan 26, 2011
8,577
7,795
24
Salford, Greater Manchester, UK
quinny898.co.uk
App keeps asking to update and there is no update
My bad, forgot to knock the internal version back down after testing the update dialog. I've "updated" the APK on GitHub, it's exactly the same build with the correct internal version, and will install on top :)
 
  • Like
Reactions: toolhas4degrees

SkylinesHD

Senior Member
Sep 27, 2016
121
32
Awesome module! Unfortunately, I couldn't get it working. (SM-A725F - Galaxy A72, Android 11)
When doing the test recognition, it says "Ambient Music failed to start". When I try multiple times, it does actually listen, but when it's done listening, it gives me "No response from Ambient Music".

I paid attention to all the steps and fixes, but none of them worked. Tried with LSPosed and Edxposed. Also tried without whitelist and checked, that ambient services has mic permissions.
 
Last edited:

Quinny899

Recognized Developer / Recognized Contributor
Jan 26, 2011
8,577
7,795
24
Salford, Greater Manchester, UK
quinny898.co.uk
Awesome module! Unfortunately, I couldn't get it working. (SM-A725F - Galaxy A72, Android 11)
When doing the test recognition, it says "Ambient Music failed to start". When I try multiple times, it does actually listen, but when it's done listening, it gives me "No response from Ambient Music".

I paid attention to all the steps and fixes, but none of them worked. Tried with LSPosed and Edxposed. Also tried without whitelist and checked, that ambient services has mic permissions.

Interesting that it's started listening fine but didn't respond at the end, that suggests that maybe the delay time isn't long enough. Try using it as if it were working, see if it picks up music playing as that doesn't have the same delay limit
 

SkylinesHD

Senior Member
Sep 27, 2016
121
32
Interesting that it's started listening fine but didn't respond at the end, that suggests that maybe the delay time isn't long enough. Try using it as if it were working, see if it picks up music playing as that doesn't have the same delay limit
Tried that, didn't work. Couldn't see any addition on my lockscreen, when playing music. My phone starts lagging when turning off or on, as soon as I enabled the recognition on lockscreen.
 

Quinny899

Recognized Developer / Recognized Contributor
Jan 26, 2011
8,577
7,795
24
Salford, Greater Manchester, UK
quinny898.co.uk
This is the dump I got
Thanks, that's very useful:

Code:
sound_trigger_platform: platform_get_lsm_usecase: No lsm usecase found for exec_mode 0

is in the logs, suggesting it doesn't like the sound_trigger_platform.xml file, specifically the lsm_usecase bit. Unfortunately the current version of the app fails to zip that right when dumping, so could you do the following please:

- Send the current file in /system/vendor/etc/sound_trigger_platform_info.xml
- Disable the Magisk module in the Magisk app, and reboot
- Send the new file in /system/vendor/etc/sound_trigger_platform_info.xml (this should be different to the first, and be original to your device)

I'll then try to figure out if something else may be required to be added on some devices, or if there's a limitation of the 'magic numbers' in the file I took from the Pixels (in which case it will likely sadly never work).

I'll also fix the dump thing so it zips the xml correctly for the next build.

Cheers!
 

SkylinesHD

Senior Member
Sep 27, 2016
121
32
Thanks, that's very useful:

Code:
sound_trigger_platform: platform_get_lsm_usecase: No lsm usecase found for exec_mode 0

is in the logs, suggesting it doesn't like the sound_trigger_platform.xml file, specifically the lsm_usecase bit. Unfortunately the current version of the app fails to zip that right when dumping, so could you do the following please:

- Send the current file in /system/vendor/etc/sound_trigger_platform_info.xml
- Disable the Magisk module in the Magisk app, and reboot
- Send the new file in /system/vendor/etc/sound_trigger_platform_info.xml (this should be different to the first, and be original to your device)

I'll then try to figure out if something else may be required to be added on some devices, or if there's a limitation of the 'magic numbers' in the file I took from the Pixels (in which case it will likely sadly never work).

I'll also fix the dump thing so it zips the xml correctly for the next build.

Cheers!
Got the files, I hope the issue will be fixable. Good luck!
 

Attachments

  • sound trigger files.zip
    6.3 KB · Views: 72

Quinny899

Recognized Developer / Recognized Contributor
Jan 26, 2011
8,577
7,795
24
Salford, Greater Manchester, UK
quinny898.co.uk
Got the files, I hope the issue will be fixable. Good luck!
Re-enable the module, extract and drop the attached file in /data/adb/modules/AmbientMusicTest/system/vendor/etc/ and reboot, see if that helps

Side note, I really need to change that AmbientMusicTest name
 

Attachments

  • sound_trigger_platform_info.zip
    3.3 KB · Views: 87

SkylinesHD

Senior Member
Sep 27, 2016
121
32
Re-enable the module, extract and drop the attached file in /data/adb/modules/AmbientMusicTest/system/vendor/etc/ and reboot, see if that helps

Side note, I really need to change that AmbientMusicTest name
Great, this really works! But now I noticed another problem..
The database is loading for ever when I go on Track list, it also cannot recognize any song.
 
Last edited:

Quinny899

Recognized Developer / Recognized Contributor
Jan 26, 2011
8,577
7,795
24
Salford, Greater Manchester, UK
quinny898.co.uk
Great, this really works! But now I noticed another problem..
The database is loading for ever when I go on Track list, it also cannot recognize any song.

It's unlikely to be loading forever, it just takes a long time to load. Leave it for a few minutes and it should load.

Meanwhile, if the module is working now you'll probably want to play with the amplification a bit, test the output with the test playback and fingers crossed it'll start recognising things then.
 

SkylinesHD

Senior Member
Sep 27, 2016
121
32
It's unlikely to be loading forever, it just takes a long time to load. Leave it for a few minutes and it should load.

Meanwhile, if the module is working now you'll probably want to play with the amplification a bit, test the output with the test playback and fingers crossed it'll start recognising things then.
The output is perfect, I left it loading for about ~2-3 mins., I'll try again. Hopefully it'll work.
 

Quinny899

Recognized Developer / Recognized Contributor
Jan 26, 2011
8,577
7,795
24
Salford, Greater Manchester, UK
quinny898.co.uk
The output is perfect, I left it loading for about ~2-3 mins., I'll try again. Hopefully it'll work.
If it still doesn't load after like 5 minutes (there's also a progress bar that should show progress) after restarting the app, what region are you in? I've previously tested the database parsing with en_GB and en_US and it was working fine but maybe it's broken for another one
 

SkylinesHD

Senior Member
Sep 27, 2016
121
32
If it still doesn't load after like 5 minutes (there's also a progress bar that should show progress) after restarting the app, what region are you in? I've previously tested the database parsing with en_GB and en_US and it was working fine but maybe it's broken for another one
I'm located in germany (probably something like de_DE)
There is a progress bar, but it doesn't show me a progess. It's just like.. loading
 

McFlypants

Senior Member
Mar 22, 2013
338
118
On miui 12.5 I think my Problem is that I can't grant the App access to the microphone.
 

Attachments

  • IMG_20210414_233430.jpg
    IMG_20210414_233430.jpg
    202.5 KB · Views: 242
  • IMG_20210414_233447.jpg
    IMG_20210414_233447.jpg
    193.1 KB · Views: 241
  • IMG_20210414_233455.jpg
    IMG_20210414_233455.jpg
    203.9 KB · Views: 244

Quinny899

Recognized Developer / Recognized Contributor
Jan 26, 2011
8,577
7,795
24
Salford, Greater Manchester, UK
quinny898.co.uk
On miui 12.5 I think my Problem is that I can't grant the App access to the microphone.

Tap the microphone prompt in Ambient Music, you have to grant it manually via the app info (not sure why Google didn't just implement a prompt like everyone else does). I have also found that sometimes when you've just granted it access it doesn't immediately respond to test recognition, if you find it still sits loading after that then kill Ambient Music via the recents, reopen it via Ambient Music Mod, return to Ambient Music Mod and try running the recognition again.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 15
    Important: YOU MUST HAVE BOTH XPOSED AND MAGISK INSTALLED TO USE THIS MODULE. READ THE FAQ FOR MORE INFO.

    Ambient Music Mod​

    A hybrid Xposed & Magisk module that ports Pixel Ambient Music to other, compatible devices. If you don't know what Pixel Ambient Music is, it's the feature that recognises music that's playing in the background (ie. not from your phone) automatically. It does this locally, without a connection, and doesn't send any data to Google servers for recognition.

    The aim of this feature is simple - you'll never wonder "what's that song" again when around the house or out and about - as your phone will tell you without you even having to ask.

    Please read the FAQ before asking questions or reporting issues

    Features​

    • Full Ambient Music support, including downloading the latest databases from Google
    • Music recognition when the device is idle or in use (exclusions apply, see the FAQ for more details)
    • Now Playing History built in, and support for third party history apps
    • The ability to display the current now playing track on the lock screen using an Accessibility overlay service
    • Manual recognition on demand in the Ambient Music Mod app
    • Settings to control the amplification, how often recognition should be triggered, whether to run on the small CPU cores and what to do when a song recognition notification is tapped
    • View all the recognisable track in your locally downloaded database via the Track List option

    Requirements​

    • Magisk
    • Xposed
    • A device with a Snapdragon processor that supports Sound Trigger 2.1 or above (the app will tell you if it's compatible)

    Installation Instructions​

    • Install the latest release APK from the GitHub releases page
    • Open the app, check your device is compatible and build the module using the Build Installer option
    • Install the built Magisk module using the Magisk app
    • Enable the Xposed module in Xposed Manager
    • Reboot

    Changelog​

    1.1.1
    Fixed an issue where the Xposed warning dialog continue button did not work

    1.1
    • Added a new compatibility checker that checks if getModelState() [and therefore hopefully the module] is supported. This isn't 100% perfect so a bypass is also available
    • Tweaked sound trigger injection to include an XML line that's required for some devices
    • Fixed track list not loading for some people
    • Hopefully fixed log dump zips
    • Newly built modules will now also keep a copy of your original sound trigger XML. This change allows for comparison in the log dumps, and may help updates in the future.
    IMPORTANT: When updating the module (which will force you to uninstall/disable the current module and reboot), the module name will change. Therefore, you are advised to uninstall the previous module as part of this process.

    Screenshots​

    Ambient Music Mod displaying the currently playing track on the lock screen of a OnePlus 7T Pro running Oxygen OS 11:



    Settings, Installer, standard Ambient Music settings & Now Playing history



    You can verify that the songs displayed in these screenshots were being played at the time by viewing a screenshot of the playlist from the radio station being listened to at the time here

    1,270 days, stop the clock.
    2
    So this is a weird one. Installed on 7t OOS 11.0.0.2, but doesn't work.
    After some digging I realized that Magisk doesn't mount the pixel ambient services app into /system/product/priv-app, as in the folder gets created, but the apk and lib folder inside isn't there. They are there though under the /data/adb/modules/AmbientMusicMod folder. Tried installing manually, but I guess it needs to be a system app to function. What kind of logs should I even send for this one?
    Initially had this issue, but solved it by installing Zackptg5's Overlay Mount Fix. You can find it in Magisk Manager module downloads.
    2
    Sorry for the second question: when I try to enable the mod in LSPosed manager, it asks to me to select an app. I don't know which app to select and the Ambient Music apps don't appear on the list. If I don't select an app the mod doesn't get enabled. Not sure what to do about that.
    I selected System Framework, Android System, Ambient Services, and Device Personalization Services.

    For some reason this mods own app doesn't show up tho, otherwise I would've enabled it as well like mentioned.
    1
    App keeps asking to update and there is no update
    1
    It would be nice to have a list of compatible devices. I have a Poco F1 and it doesn't work because of drivers incompatibility issues
    It would have to be crowd sourced because there is no list of which devices have which sound trigger HALs. And crowd sourced incurs maintenance, checking for conflicts, figuring out why it works for someone but not someone else on the same device (instructions not followed correctly, system updates, etc.). It would basically become the same as this thread.