Play CDs Without CD Player, Using AI and YouTube
17936 Views, 77 Favorites, 0 Comments
Play CDs Without CD Player, Using AI and YouTube
![IMG_0634b.JPG](/proxy/?url=https://content.instructables.com/FVZ/YI59/JNSR6ZG3/FVZYI59JNSR6ZG3.jpg&filename=IMG_0634b.JPG)
![Boombox Visually Recognizes CD and Plays It from YouTube](/proxy/?url=https://content.instructables.com/FO2/W838/JNSR6ZLR/FO2W838JNSR6ZLR.jpg&filename=Boombox Visually Recognizes CD and Plays It from YouTube)
Want to play your CDs but have no more CD player? Did not have time to rip your CDs? Ripped them but the files are unavailable when needed?
No problem. Let AI (artificial intelligence) identify your CD, and YouTube play it!
I wrote an Android app doing the following:
1. take a picture of the CD cover,
2. search for text keywords using Google Vision
3. search for a corresponding playlist on YouTube
4. then launch YouTube on the found playlist.
This Instructable covers the installation, setup and usage of the app. As a bonus, it briefly covers the retrofitting of a vintage 80's boombox.
If you like this project, please vote for it in the audio contest!
The Concept
![Screenshot at 2018-10-28 16-21-40.png](/proxy/?url=https://content.instructables.com/F8L/KOXU/JNSR730F/F8LKOXUJNSR730F.png&filename=Screenshot at 2018-10-28 16-21-40.png)
![album.jpg](/proxy/?url=https://content.instructables.com/FIM/OD2N/JNSR72TW/FIMOD2NJNSR72TW.jpg&filename=album.jpg)
![song.jpg](/proxy/?url=https://content.instructables.com/F59/ZOHH/JNSR72TZ/F59ZOHHJNSR72TZ.jpg&filename=song.jpg)
The problem with CDs
I have a few hundreds CDs, but we have no more audio CD player around. More than ten years ago I started to rip my CDs: eventually less than the half would get ripped, and stored no longer sure where.
Today, most of our stuff is in our smartphones, in the cloud, streamed.
But I still like my CDs. What do they represent to me? Maybe the feeling the I can physically own the music I did purchase. Or the reminiscence of a time when concept albums were a thing...
Enter YouTube and Google Cloud Vision
On YouTube, many CDs, even lesser known, have been ripped and published as a playlist.
Google Cloud Vision provides image analysis services, of which we will use image labeling. In short, an image is submitted, the service analyses it (using machine learning with models trained by Google) and returns labels, which are text keywords saying what has been recognized in the image. Cloud Vision is surprisingly good at recognizing CD artworks.
A solution
Having noticed the latter, and after a quick test in Python, I decided to write an Android app (written in Kotlin) that would:
1. take a photo of the CD case,
2. query Google Vision to get keywords describing the image,
3. query YouTube to see if there is a full album corresponding to these keywords,
4. launch YouTube on the found playlist.
Why using a smartphone?
Essentially because everything needed is here and well integrated, in particular the camera.
Arguably, used smartphones are a better alternative to Raspberry Pi for building media centers.
​Stuff Needed: an Android Phone
![IMG_0645.JPG](/proxy/?url=https://content.instructables.com/FFG/0L2F/JNSR6ZGM/FFG0L2FJNSR6ZGM.jpg&filename=IMG_0645.JPG)
![IMG_0662.JPG](/proxy/?url=https://content.instructables.com/FMQ/R3TD/JNSR6ZGS/FMQR3TDJNSR6ZGS.jpg&filename=IMG_0662.JPG)
The Phone
Just use your current Android cell phone, or get (an old) one if you intend to build a dedicated music player.
What to buy?
Should you buy a cheap new phone, or buy a used one?
Although the hardware specs are not tremendously important for this project, I would not recommend buying a new one under $100, as the quality can be very poor (shitty screen, sluggish). If you consider buying an old flagship, remember that you never really know what you will get.
It's always best if you can try it before buying.
Can I use an iPhone?
Not yet, and not that I know. I only developed the app for Android.
If you know an equivalent iOS app, or developed it, or know somebody who did, please let me know!
Google APIs Setup
![g-console-apis.png](/proxy/?url=https://content.instructables.com/FDV/05YI/JNSR6ZS8/FDV05YIJNSR6ZS8.png&filename=g-console-apis.png)
You will need to enable the APIs for you, and get an API key.
1. About APIs and keys
API keys are needed by the mobile app to access the Google services on your behalf.
For the Google Cloud Vision API, as per https://cloud.google.com/vision/pricing#prices, up to 1000 detections per month are free.
For YouTube Data API, as per https://developers.google.com/youtube/v3/getting-started#quota the quota is 1 million units per day. For one CD search you will consume 100+6 units, this means you can do 9433 searches per day.
* * *
This should incur no costs to you.
However, DO IT AT YOUR OWN RISKS.
I cannot be held responsible for any problem caused by this tutorial nor the ScanTube app.
* * *
2. Enable YouTube and Google Cloud Vision APIs, and get a key
2a. Visit https://console.developers.google.com/apis
2b. Create your project, name it e.g. ScanTube.
2c. Create credentials:
- Select credentials: https://console.developers.google.com/apis/credentials
- Create credentials of type API key.
- Copy the key value in a local text file in your computer.
2d. Enable YouTube API:
- Visit https://console.developers.google.com/apis/library and locate YouTube Data API v3. Activate it.
2e. Enable Cloud Vision API:
- Visit https://console.developers.google.com/apis/library and locate Cloud Vision API. Activate it.
We'll use the same API key for both YouTube and Cloud Vision services, so we're done for this part.
Phone Setup
![IMG_0645-phone.JPG](/proxy/?url=https://content.instructables.com/FAF/9PU9/JNSR6ZZ2/FAF9PU9JNSR6ZZ2.jpg&filename=IMG_0645-phone.JPG)
![Screenshot_20181028-131934_ScanTube-sized.png](/proxy/?url=https://content.instructables.com/F25/Z9HX/JNSR70BB/F25Z9HXJNSR70BB.png&filename=Screenshot_20181028-131934_ScanTube-sized.png)
![Screenshot_20181028-131950_ScanTube-sized.png](/proxy/?url=https://content.instructables.com/FQZ/UZNN/JNSR70BC/FQZUZNNJNSR70BC.png&filename=Screenshot_20181028-131950_ScanTube-sized.png)
![Screenshot_20181028-132013_ScanTube-sized.png](/proxy/?url=https://content.instructables.com/FQQ/5FUU/JNSR70BD/FQQ5FUUJNSR70BD.png&filename=Screenshot_20181028-132013_ScanTube-sized.png)
The ScanTube app is available on the Google Play Store in beta test program.
First, be sure to read and accept the Privacy Policy.
1. Install the ScanTube Android app
Visit the following link from your mobile phone: https://play.google.com/apps/testing/digital.bauermeister.scantube, then click download it on Google Play and follow instructions.
(If you are a developer and want read the source, visit https://github.com/pbauermeister/ScanTube.)
2. Configure the ScanTube Android app
2a. Start the ScanTube app, allow it to use the camera.
2b. On the first use, the app suggests to set the app keys, so do it:
- For the Google Vision app key, enter the API key obtained above (*).
- For the YouTube app key, enter the same API key (*).
(*) Instead of typing the API key manually (which is a huge burden), you can send it from your computer to your phone via email or via a DropBox file, and copy-paste it into the ScanTube settings field.
2c. Go back to the main screen, start the settings by clicking the cog icon. Review the General settings. Quite self-explanatory.
In particular, Camera choice shall be set according to your use case. For integration into a media center: front camera. For hand-held use: back camera.
3. Other considerations for an Android-based media center
- Install Nova Launcher and set the desired desktop orientation.
- On the desktop, create shortcuts for ScanTube, YouTube, and any other audio/video relevant apps.
- Uninstall or disable all irrelevant apps.
If anyone may use this media center:
- Disable the lock screen.
- Use a dedicated Google account, free of private data and emails
Optional: Retrofit a Vintage Boombox
![Screenshot at 2018-10-28 11-31-52--1.png](/proxy/?url=https://content.instructables.com/F9Y/VJ5K/JNSR7E5J/F9YVJ5KJNSR7E5J.png&filename=Screenshot at 2018-10-28 11-31-52--1.png)
![20181007_111711.jpg](/proxy/?url=https://content.instructables.com/FZP/YX4P/JNSR6Z4F/FZPYX4PJNSR6Z4F.jpg&filename=20181007_111711.jpg)
![IMG_0664.JPG](/proxy/?url=https://content.instructables.com/F5W/URYA/JNSR6ZGW/F5WURYAJNSR6ZGW.jpg&filename=IMG_0664.JPG)
![20181007_120915.jpg](/proxy/?url=https://content.instructables.com/FX5/CQ1B/JNSR6Z66/FX5CQ1BJNSR6Z66.jpg&filename=20181007_120915.jpg)
![20181006_185020.jpg](/proxy/?url=https://content.instructables.com/FCN/ES72/JNSR6Z0M/FCNES72JNSR6Z0M.jpg&filename=20181006_185020.jpg)
![IMG_0616.JPG](/proxy/?url=https://content.instructables.com/FVJ/25ZF/JNSR6ZEJ/FVJ25ZFJNSR6ZEJ.jpg&filename=IMG_0616.JPG)
![20181007_134200.jpg](/proxy/?url=https://content.instructables.com/F5R/QV35/JNSR6Z6P/F5RQV35JNSR6Z6P.jpg&filename=20181007_134200.jpg)
![20181007_114245.jpg](/proxy/?url=https://content.instructables.com/F8M/2OSP/JNSR6Z54/F8M2OSPJNSR6Z54.jpg&filename=20181007_114245.jpg)
In this step, the cell phone is fitted onto an old boombox from the 80's.
Mounting the smartphone
All original functions of the boombox being intact and perfectly functional, including the cassette player, I decided to preserve them and mount the phone on the outside of the tape deck door.
Audio signals
The boombox has AUX inputs. That was a purchase decision factor. I connected them to the phone jack.
Powering the smartphone
The mains transformer was defective so I am using an external 9V adapter. 9V because the boombox accepts 6 x 1.5V batteries. An LDO voltage regulator (LM1117T-5.0) generates 5V out of the 9V, in order to power the phone via USB.
Connections
Finally I routed the power and audio signals to the outside, using flat-band cable going through the door space.
Now we have a genuine survivor of the 80's
It's in perfect condition, upgraded for the present days of YouTube, Internet streaming and AI.
How lovely!
Use It: Scan and Play Your CDs
![Screenshot at 2018-10-28 14-35-04.png](/proxy/?url=https://content.instructables.com/F5V/0K8G/JNSR71PP/F5V0K8GJNSR71PP.png&filename=Screenshot at 2018-10-28 14-35-04.png)
![Boombox Visually Recognizes CD and Plays It from YouTube](/proxy/?url=https://content.instructables.com/FGV/KVKQ/JNSR71RS/FGVKVKQJNSR71RS.jpg&filename=Boombox Visually Recognizes CD and Plays It from YouTube)
If all went well so far, the usage will be as simple as 1-2-3.
Make sure your phone has data connectivity (over WiFi or mobile data).
Usage
1. Present a CD box to your camera, until it entirely takes the square portion of the screen, and its becomes sharp. Avoid reflections from light sources.
2. Click scan.
3. Wait for YouTube to be called on a playlist matching your CD.
Alternate Usage
![IMG_0657.JPG](/proxy/?url=https://content.instructables.com/FPP/36SY/JNSR6ZGR/FPP36SYJNSR6ZGR.jpg&filename=IMG_0657.JPG)
![IMG_0646.JPG](/proxy/?url=https://content.instructables.com/FZK/JJZL/JNSR6ZGN/FZKJJZLJNSR6ZGN.jpg&filename=IMG_0646.JPG)
Of course you do not need to use actual CD, which honestly take way too much place in a pocket.
For instance, I photocopied and laminated 16 of my favorite CDs with reduction down to 2.75", and have a handy physical surrogate collection, that fit in one pocket!
Reliability - Excellent Performers
![06.jpg](/proxy/?url=https://content.instructables.com/FXA/3SVM/JNSR739M/FXA3SVMJNSR739M.jpg&filename=06.jpg)
![03.jpg](/proxy/?url=https://content.instructables.com/FAK/MJ2U/JNSR739E/FAKMJ2UJNSR739E.jpg&filename=03.jpg)
![07.jpg](/proxy/?url=https://content.instructables.com/FYB/JVQM/JNSR739N/FYBJVQMJNSR739N.jpg&filename=07.jpg)
![08.jpg](/proxy/?url=https://content.instructables.com/F6C/8110/JNSR739O/F6C8110JNSR739O.jpg&filename=08.jpg)
![16.jpg](/proxy/?url=https://content.instructables.com/FXP/L2RF/JNSR739Y/FXPL2RFJNSR739Y.jpg&filename=16.jpg)
These CDs were exceptionally well recognized, and their playlists were found reliably.
Reliability - Good Performers
![12.jpg](/proxy/?url=https://content.instructables.com/FI9/8I4N/JNSR739S/FI98I4NJNSR739S.jpg&filename=12.jpg)
![13.jpg](/proxy/?url=https://content.instructables.com/FXO/CSBT/JNSR739T/FXOCSBTJNSR739T.jpg&filename=13.jpg)
![14.jpg](/proxy/?url=https://content.instructables.com/FEX/2XGB/JNSR739U/FEX2XGBJNSR739U.jpg&filename=14.jpg)
![11.jpg](/proxy/?url=https://content.instructables.com/FWG/9HKB/JNSR739R/FWG9HKBJNSR739R.jpg&filename=11.jpg)
![02.jpg](/proxy/?url=https://content.instructables.com/FYJ/G56P/JNSR739B/FYJG56PJNSR739B.jpg&filename=02.jpg)
![05.jpg](/proxy/?url=https://content.instructables.com/FJ5/VVH2/JNSR739I/FJ5VVH2JNSR739I.jpg&filename=05.jpg)
![09.jpg](/proxy/?url=https://content.instructables.com/F41/ICZA/JNSR739P/F41ICZAJNSR739P.jpg&filename=09.jpg)
For these CDs the end result was good, but they were more difficult to properly capture, because light reflections are more apparent.
Reliability - Bad Performers
![15.jpg](/proxy/?url=https://content.instructables.com/FSX/HX73/JNSR739X/FSXHX73JNSR739X.jpg&filename=15.jpg)
![01.jpg](/proxy/?url=https://content.instructables.com/FS2/JAJE/JNSR739A/FS2JAJEJNSR739A.jpg&filename=01.jpg)
![17.jpg](/proxy/?url=https://content.instructables.com/FX5/GKHL/JNSR73A1/FX5GKHLJNSR73A1.jpg&filename=17.jpg)
![18.jpg](/proxy/?url=https://content.instructables.com/F2R/8182/JNSR73A2/F2R8182JNSR73A2.jpg&filename=18.jpg)
![10.jpg](/proxy/?url=https://content.instructables.com/F77/4OXH/JNSR739Q/F774OXHJNSR739Q.jpg&filename=10.jpg)
![04.jpg](/proxy/?url=https://content.instructables.com/FJ2/NNED/JNSR739F/FJ2NNEDJNSR739F.jpg&filename=04.jpg)
For these CDs, the artists were correctly recognized, but wrong albums were found.
Mostly, the image detection returned good keywords, but unexpected playlists were found.