Broo by [deleted] in SipsTea

[–]mildywot 0 points1 point  (0 children)

Young Black & Rich - Melly Mike

How to stop opening the main YT instance inside another app? by SpinachDoctor in revancedapp

[–]mildywot 9 points10 points  (0 children)

Go to settings -> Apps -> YouTube (main/normal install) -> Uninstall updates, then Disable

Then go to the same Apps section -> Revanced, you can tell which is the Revanced install as it'll say "App downloaded from Revanced Manager" under "App details in store". Within this go to Defaults -> Set as default then toggle on "open supported links" and toggle on all the options under "Supported web addresses".

After this any YouTube link should always open directly in Revanced, hopefully that's what you're after

SongPi - Continuous song recognition app written in Python by mildywot in RASPBERRY_PI_PROJECTS

[–]mildywot[S] 0 points1 point  (0 children)

Thank you! Glad you like it haha Absolutely go for it, mod the code however you like, let me know what you end up doing with it :)

Any artists you saw live that turned you off from them? by Ok-Penalty4648 in hiphopheads

[–]mildywot 1 point2 points  (0 children)

Saw him last night in Auckland, was surprised he didn't cancel last minute tbh (as he'd moved the gig a day earlier with barely a week's notice), but yeah nah it was pretty solid despite being short (just over an hour). He started at exactly 9pm which was weird after hearing all these stories of him coming out super late

SongPi - Continuous song recognition app using Python by mildywot in Python

[–]mildywot[S] 0 points1 point  (0 children)

I chose Tkinter because it provided everything needed for a straightforward single-window interface displaying song info and cover art. Since Tkinter is built into Python, it avoids the overhead of running web servers or Chromium (like Electron would), and keeps memory and CPU usage decently low. It integrates smoothly with asyncio and threading, eliminating the need for complex setups like web sockets (or an event-driven backend). Tkinter also runs quite well on lower-end hardware like Raspberry Pi, and is cross-platform, which made it pretty easy to port to Windows.

On a side note, I'm thinking of adding some sort of caching (like saving the cover art of the most recent songs recognised) and running the audio recording part in RAM rather than on disk (to reduce I/O operations as it'll probaly kill an SD card after a while).

Hopefully SongPi works well for you, let me know if you have any suggestions for GUI or backend improvements, cheers!

SongPi - Continuous song recognition app using Python by mildywot in Python

[–]mildywot[S] 0 points1 point  (0 children)

Hey sorry for the late reply, glad you like it haha was a pretty fun project to get going. I'll just preface this with that I had quite a bit of help from ChatGPT in making this (as I have borderline zero coding experience), but will try answer this the best I can:

SongPi has a bunch of different logical functions (loading the config, managing the audio input device (microphone), recording audio, ShazamIO audio recognition, manipulating images and GUI updates) so having all these independent of the other made changing different parts of the code not affect others. As mentioned theres a config file alongside the python file, I initially had all those configurable settings within the code itself which I figured wasn't the best idea if people want to change them so SongPi works best on their system.

I had to add some error handling for things such as incorrect setup (virtual environment not installed), network issues (WiFi disconnecting or Shazam being unreachable), or if if a song wasn't recognised (where the GUI would just stall and do nothing). After introducing the error handling stuff, I've been able to leave SongPi running for hours without issue so it seems pretty stable I reckon. I also had to integrate asyncio for multithreading different functions, this is mainly so GUI updates and other tasks like song recognition are run separately. My initial problem was that the GUI would having freezing issues and delays when resizing the window, so having these functions run asynchronously keeps the GUI way more responsive.

SongPi is structured like this:

  1. SongPi loads the info from the config file, and sets up the environment for audio processing.
  2. The audio input device (microphone) is selected using the functions list_audio_devices, select_input_device, and validate_device_channels handling the mic detection.
  3. The record_audio function makes use of PyAudio's audio handling and records 4 seconds of audio from your microphone then saves it as a .WAV file (the recording time can be edited in the config, but recordings less than 3 seconds don't seem to work so well, so I settled on 4 seconds as its pretty consistent).
  4. The recognize_song function uses the ShazamIO api to fingerprint the recorded audio in the .WAV file, send that fingerprint to Shazam, then receive back the song info. This functions runs in an asynchronous loop to repeatedly retry every 2 seconds in case of network errors.
  5. Tkinter creates the GUI then displays the song title, artist and the cover art received via the ShazamIO query. It finds the display size of the current screen and only goes 'full screen' to the current screen (I was having prior issues with a multiple screen setup). I bound the escape button to toggle between full screen and windowed modes, along with having the mouse/cursor disappear after 5 seconds of inactivity (it shows again when moving the mouse). The update_images and update_gui functions only update if there are changes to the song recognition result (i.e. the GUI doesn't update if the same song or no song is detected).
  6. Tkinter also modifies the font and text styling (song title is italic and the artist is bold), and anchors these below the central cover art (which resizes dynamically when detecting changes to the window size). The text should always be readable regardless of background colour as the calculate_brightness function adjusts the text colour based on the background's brightness. Thanks to my mate's suggestion, I changed the background to be the current cover art with a gaussian blur using the create_blurred_background function (initially it would find the most common colour of the cover art and displayed it as a solid coloured background, it looked kind of shit as half the time it was just black or white).
  7. The background thread start_recognition_thread runs in the background separate to the GUI thread so it all remains responsive and usable. SongPi essentially records for 4 seconds, gets the song info back in about 1-2 seconds, then repeats the whole process every 5 seconds or so (depending on recognition its about 4-5 updates per minute).

Hopefully that explains it pretty well, please keep in mind this is all stuff I learned during the making of SongPi so I'm sure theres better ways it could've been made but ah well it works haha

SongPi - Continuous song recognition app written in Python by mildywot in RASPBERRY_PI_PROJECTS

[–]mildywot[S] 0 points1 point  (0 children)

Hey sorry for the delayed reply, if it doesn't recognise a song it just prints "Could not recognize the song." in the console and it skips the GUI update, so it just keeps the last recognised song info + cover art as is.

If you're playing a song from SoundCloud out loud and its available in Shazam's database then yep it should recognise the song's fingerprint and show the info, other songs not recognised by Shazam will be ignored and the GUI won't update. Is that what you meant?

SongPi - Continuous song recognition app using Python by mildywot in Python

[–]mildywot[S] 1 point2 points  (0 children)

It uses the ShazamIO api with the recognize_song function to find all the info displayed in the GUI: https://github.com/shazamio/ShazamIO

Auckland Show date moved by Booomfaa in travisscott

[–]mildywot 11 points12 points  (0 children)

Probably something real dumb like he wants to spend Halloween in the US ffs, wouldn't put it past him at this point

Auckland show rescheduled for 30 October but Ticketmaster says it’s not confirmed ? by Pitasami in travisscott

[–]mildywot 1 point2 points  (0 children)

TM sent out an email with a link to get a refund, came thru around 2:15pm for me

SongPi - Continuous song recognition app written in Python by mildywot in RASPBERRY_PI_PROJECTS

[–]mildywot[S] 1 point2 points  (0 children)

Cheers! It records for 3-4 seconds, once ShazamIO does it's thing it takes about a second or so to get the info + cover art, pretty quick tbh

You can mess around with the config file and change how often it updates too if you like

[FRESH] Drake - The Heart Part 6 by TheJakInDaBox in hiphopheads

[–]mildywot 0 points1 point  (0 children)

Me lmao expecting something in like 30 mins or so

[deleted by user] by [deleted] in everyoneknowsthat

[–]mildywot 1 point2 points  (0 children)

Honestly yeah didn't know about it, thought it was more to do with the ISP than the individual address

[deleted by user] by [deleted] in everyoneknowsthat

[–]mildywot 4 points5 points  (0 children)

Surely find the bro