May 7, 2024 - NOT GAME RELATED
I took some time off from looking at anything related to this endeavor, but I'm back! I thought almost zilch about this project and it was very refreshing if I'm being honest. So while I don't have a game related updated, I did have a small side project I worked on. I don't remember if I mentioned in any previous posts, but my job is a Product Owner for an insurance company. I don't do any development for it. My college education 20 (!!!!) years ago was Computer Information Systems which did require all the same programming courses as the comp sci folks. So I do understand how to code. I've dabbled a bit here and there over the years just to stay sort of fresh with concepts to help in my day job directing dev work.
One thing I never really had experience in was Python or APIs. Sure, I understand JSON and APIs, but haven't actually done anything with them personally(I did a Halloween prop -- a functional Pokeball-- for my daughter a few years ago in python). Now I can at least say I'm beginner there. I recently got a turntable. Whenever I take the record out, i basically set the sleeve on a table next to the TT. I started looking at "now playing" stands so I could view the album art while it plays. I didn't get a stand, but it got me thinking about spare parts from various projects over the years. I have a few spare raspberry pi 0Ws and a spare GPIO 3.2" screen with a 320x240 resolution, and a USB microphone. So why not throw those all together with duct tape and python and see what I get!?
Well, the answer is my DIY Shazam-box! If you don't know, Shazam is a music identification service. It listens to a few seconds of a song and gives you the metadata for the song. I tried a few different approaches for this at first. I really didn't want to use a pre-built service. I wanted to capture the sound clip, generate my own "audio fingerprint", and query a database of audio fingerprints. I feel that's the 'best' way to do this; however, all of those services would cost me money every month. This was purely for fun and education. At some point I may try to create my own LOCAL database of audio fingerprints so I can just generate and store the fingerprints of the albums I own, but that'd be a task for another time.
Anyhow, basically how this is works is that I have the Pi load up my python app at boot and make it full screen (320x240). From there, it records a 5 second audio clip. I found an existing free API that allows 2500 calls a month on the rapidAPI website, so I cheated a bit there. But you send that API the 5 second clip and it queries Shazam and returns all of the metadata it finds that corresponds to the song. I grab that API response, parse it, and display it (song, artist, album, and album art) on my tiny screen. If the clip is unknown (happens sometimes when audio is low or there's a lot of other noise in the room), I display unknown with generic album art as seen below. I grab a clip and perform an API call every 60 seconds. I also added a power button icon to the UI as seen in one of the pics. Since this is a touch screen, tapping that will shut the pi down when you're done so you don't have to yank the power cord since it is a computer after all.
This isn't perfect and it has some items I need to fix. I'm definitely not a UX expert, so I need to come back at some point to make this look better. I need to align the album art better. Improve the column wdiths. And improve error handling (if a response isn't formatter correctly, my current error handling shuts the pi down). I believe the API returns the track length along with the offset it thinks my sound clip is at, so at some point I want to use those 2 data elements to adjust when the api call happens and basically have it happen a few seconds after the currently displayed track info would theoretically end. It wont' be perfect since the pi is not powerful and takes a few seconds to record, format it accordingly, make the call, and process the results.
Anyhow, that's some of what has been occupying my time away!
Get Tower of Meowgic
Tower of Meowgic
Just playing with gb studio. this is not intended for actual playing. just sharing the url with friends.
Status | Prototype |
Author | PestoRavioli |
More posts
- Slow and Steady...2 days ago
- New animation21 days ago
- And we're back!21 days ago
- Stepping away for a while...Jul 11, 2024
- June 26, 2024Jun 26, 2024
- June 19, 2024Jun 19, 2024
- May 30, 2024May 30, 2024
- May 28, 2024May 28, 2024
- May 23, 2024 - It's been awhileMay 23, 2024
Comments
Log in with itch.io to leave a comment.
I love this (and the story behind it). I have run out of ideas on what to do with my RPis over here. :-)
Sometimes, a distraction such as a side project like this can be a good thing. I often find kits (like the ones from CircuitMess) to build with my son since he has shown a lot of interest in both electronics and programming. He is 11 and has been soldering for years. He has been programming his own games in Scratch for just as long and only recently started to tinker with Python (to eventually learn PyGame).
A lot of this game related stuff that I do is really to inspire and motivate him. Although, I too am learning as I am going along. My day job is a Linux kernel and file system developer. So, while it involves coding, it is coding in a different way.
Anyway, a break usually helps with the creative juices. So, take that time to recharge.
thanks for the response and encouragement! my daughter is 12 and at one point a few years ago was really in to coding with scratch and hummingbird. I did a little bit of python back then to try to get her thinking at a higher level, but she eventually outgrew it. She still likes doing it when they use hummingbird in school (which I find awesome that they teach coding at all), but has no desire to do it outside of school anymore. Disappointing, but I suppose I'll let her be a little clone of her mom!
That's awesome your son is in to this. And also soldering at that age. I'm hot garbage at it, but can do enough to mod game boys and other small projects.
I get it. My daughter is 14 and once upon a time, she had some interest but now is doing teenage girl things. Although, I think the interest may stick with my son. Time will tell.
Here is one example where he is soldering and building a small portable gaming console: https://twitter.com/pkoutoupis/status/1686018282787115008
Anyway, when you get back into it, I look forward to seeing the updates.