Linux side-step – create a notification sound for your phone with linux and youtube

Both myself and my wife are big fans of the hit TV show “The Big Bang Theory” (I am assuming here that you will know of this series, if not LMGTFY), especially of the scenes where Sheldon Cooper gets drunk and misbehaves in the most fun and childish ways (for example here during a speech). One of the scenes in particular we both found hilarious, this is when Sheldon has dropped String Theory as his main focus and completely lost focus. He gets drunk and makes prank calls to Stephen Hawking. The bit that always cracks us up is the “Who am I” bit of the prank calls, so I decided to see if I could make this into a notification sound for my wives phone.

All of this was executed on my MSI GS-60 Ghost-Pro running Manjaro Linux.

What did I need?

First of all, find the video on Youtube, that was easy of course.

Download the video

Downloading a Youtube movie is, at least on Linux quite easy. There is a wonderful Python based tool available called “youtube-dl” which can be found on GitHub. All you need for that is Python running on your machine.

Follow the basic instructions as explained on the site, this will make sure you have youtube-dl immediately in your command-line path on your machine:

sudo curl https://yt-dl.org/downloads/2015.09.09/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

Now that it is “installed” it is instanty ready for use. I decided to not look long for a different video or higher quality sound, since I am going to make it into a phone notification anyway. This video is high enough quality for that purpose.

Downloading the video from youtube with youtube-dl is child’s play! Youtube-dl has a immense amount of possible options to pass if you really want, you can find them all in the documentation section of the youtube-dl site.

Let’s do it the easy way:

youtube-dl https://www.youtube.com/watch?v=aOQp3FHOPyQ

This will save the file in your current directory in the default formatting based on the video title:

The Big Bang Theory - Drunk Sheldon and Geology feat. Stephen Hawking S07E20 [HD]-aOQp3FHOPyQ.mp4

Pull the sound off the MP4

Now that the video is on your PC somewhere the sound needs to be stripped out of the MP4 video file. To do that ffmpeg is the go-to tool for me! As they themselves state:

FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation.

So ensure you have it running on your linux box by punching in something like this:

ffmpeg --version

That should return something like this:

ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
 built with gcc 5.2.0 (GCC)
 configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-shared --enable-version3 --enable-x11grab
 libavutil 54. 31.100 / 54. 31.100
 libavcodec 56. 60.100 / 56. 60.100
 libavformat 56. 40.101 / 56. 40.101
 libavdevice 56. 4.100 / 56. 4.100
 libavfilter 5. 40.101 / 5. 40.101
 libavresample 2. 1. 0 / 2. 1. 0
 libswscale 3. 1.101 / 3. 1.101
 libswresample 1. 2.101 / 1. 2.101
 libpostproc 53. 3.100 / 53. 3.100

Now that you have established it is installed, we can pull the soundtrack off the MP4 file:

ffmpeg -i The\ Big\ Bang\ Theory\ -\ Drunk\ Sheldon\ and\ Geology\ feat.\ Stephen\ Hawking\ S07E20\ \[HD\]-aOQp3FHOPyQ.mp4 The\ Big\ Bang\ Theory\ -\ Drunk\ Sheldon\ and\ Geology\ feat.\ Stephen\ Hawking\ S07E20\ \[HD\]-aOQp3FHOPyQ.wav

This will write the soundtrack away to a WAV file. At this point I got fed up with the long filename, so shortened it to sheldon.wav

I was now left with a wav file of 3:47 mins, which is way too long for a notification or a ringtone and definitely didn’t capture the right part I was looking for properly.

Soundfiles editing

For editing the Wav and saving is as the resulting MP3 I used a very nice simple tutorial from xmodulo.com

What it comes down to is install Audacity and use that to find the spot you are looking for. The simple way is to start by looking for the general part of the original WAV file you want to use, zoom in on that time stamp either with the CTRL+1 key combination or with the mouse by selecting the timeslot you want and using the zoom buttons from Audacity.

When you have managed to select the exact piece of the file you can copy that selection and paste it into a new file (e.g. open a new instance of Audacity and paste the sound clip there). Now save that new piece of sound and you have your very own specific, custom ringtone or notification sound just like I made: the slow version and the fast version of a drunk Sheldon Cooper making crazy sounds and mocking Stephen Hawking.

Take these sounds and drop them in the notifications directory of you (android) phone, set them as your default sound for your favorite messaging app.

btw, I noticed later on LinuxJournal covers something very close to this story🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s