Converting ape music files to mp3 in Linux

I had a file in the lossless ape (Monkey’s Audio) file format, and wanted to convert it to a .mp3 file so that I could play it on my portable mp3 player. As is usual in Linux, several alternative solutions exist, and I thought I’d try three of them for fun: shntool, ffmpeg and KDE’s Konvertible (Konvertible is a GUI for ffmpeg).

I already had ffmpeg and Konvertible installed, but not shntool. So first I installed shntool and the Monkey’s Audio codecs it uses:

# emerge media-sound/mac
# emerge media-sound/shntool

Here are the details of these two installed packages:

# eix -I shntool
[I] media-sound/shntool
Available versions: 3.0.10-r1 {alac flac mac shorten sox wavpack}
Installed versions: 3.0.10-r1(08:11:30 19/12/12)(flac -alac -mac -shorten -sox -wavpack)
Homepage: http://www.etree.org/shnutils/shntool/
Description: A multi-purpose WAVE data processing and reporting utility

# eix -I media-sound/mac
[I] media-sound/mac
Available versions: 3.99.4.5.7-r1^m {mmx static-libs}
Installed versions: 3.99.4.5.7-r1^m(07:52:12 19/12/12)(mmx -static-libs)
Homepage: http://etree.org/shnutils/shntool/
Description: Monkey's Audio Codecs

Then I used the following command to convert the file My Band 1971 CoolSounds.ape to mp3:

$ shntool conv -i ape -o 'cust ext=mp3 lame - %f' My\ Band\ 1971\ CoolSounds.ape
Converting [My Band 1971 CoolSounds.ape] (59:15.39) --> [My Band 1971 CoolSounds.mp3] : 100% OK
$

The KDE utility Konvertible was also able to convert it. I double-clicked on the file My Band 1971 CoolSounds.ape in Dolphin to launch Konvertible, selected libmp3lame in the ‘Codec:’ drop-down picklist, 192.00 kbits/s in the ‘Bitrate:’ drop-down picklist, clicked on the folder icon and selected /home/fitzcarraldo as the destination directory, and finally clicked ‘Convert’.

The mp3 files created by shntool and Konvertible were of different sizes:

File created by Konvertible:

$ file My\ Band\ 1971\ CoolSounds.mp3
My Band 1971 CoolSounds.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 192 kbps, 44.1 kHz, Stereo
$ ls -la My\ Band\ 1971\ CoolSounds.mp3
-rw-r--r-- 1 fitzcarraldo users 85334024 Dec 19 08:11 My Band 1971 CoolSounds.mp3
$

File created by shntool:

$ file My\ Band\ 1971\ CoolSounds.mp3
My Band 1971 CoolSounds.mp3: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, JntStereo
$ ls -la My\ Band\ 1971\ CoolSounds.mp3
-rw-r--r-- 1 fitzcarraldo users 56889259 Dec 19 08:29 My Band 1971 CoolSounds.mp3
$

So I added the bitrate to the shntool command:

$ shntool conv -i ape -o 'cust ext=mp3 lame -b 192 - %f' My\ Band\ 1971\ CoolSounds.ape
Converting [My Band 1971 CoolSounds.ape] (59:15.39) --> [My Band 1971 CoolSounds.mp3] : 100% OK
$

and this time the mp3 file created by shntool is comparable to the mp3 file created by Konvertible:

$ file My\ Band\ 1971\ CoolSounds.mp3
My Band 1971 CoolSounds.mp3: MPEG ADTS, layer III, v1, 192 kbps, 44.1 kHz, JntStereo
$ ls -la My\ Band\ 1971\ CoolSounds.mp3
-rw-r--r-- 1 fitzcarraldo users 85333889 Dec 19 08:56 My Band 1971 CoolSounds.mp3
$

The ffmpeg command to do the same thing is:

$ ffmpeg -i My\ Band\ 1971\ CoolSounds.ape -ar 44100 -ab 192000 out.mp3
ffmpeg version 0.10.6 Copyright (c) 2000-2012 the FFmpeg developers
built on Nov 26 2012 07:06:40 with gcc 4.6.3
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-O2 -march=native -pipe' --extra-cflags='-O2 -march=native -pipe' --extra-cxxflags='-O2 -march=native -pipe' --disable-static --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --disable-stripping --disable-debug --disable-doc --disable-vaapi --disable-vdpau --enable-runtime-cpudetect --enable-gnutls --enable-libmp3lame --enable-libvo-aacenc --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libfaac --enable-nonfree --enable-libdc1394 --enable-openal --disable-indev=v4l --disable-indev=oss --enable-x11grab --enable-libpulse --disable-outdev=oss --enable-libfreetype --enable-pthreads --enable-libgsm --enable-libspeex --disable-amd3dnow --disable-amd3dnowext --disable-altivec --disable-avx --disable-mmx2 --disable-ssse3 --disable-vis --disable-neon --cpu=ho
libavutil 51. 35.100 / 51. 35.100
libavcodec 53. 61.100 / 53. 61.100
libavformat 53. 32.100 / 53. 32.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 61.100 / 2. 61.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, ape, from 'My Band 1971 CoolSounds.ape':
Metadata:
Album : CoolSounds
Title : C:\1\My Band 1971 CoolSounds
Comment : Exact Audio Copy
Duration: 00:59:15.47, start: 0.000000, bitrate: 829 kb/s
Stream #0:0: Audio: ape (APE / 0x20455041), 44100 Hz, stereo, s16
Output #0, mp3, to 'out.mp3':
Metadata:
TALB : CoolSounds
TIT2 : C:\1\My Band 1971 CoolSounds
Comment : Exact Audio Copy
TSSE : Lavf53.32.100
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 192 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (ape -> libmp3lame)
Press [q] to stop, [?] for help
size= 83334kB time=00:59:15.55 bitrate= 192.0kbits/s
video:0kB audio:83333kB global headers:0kB muxing overhead 0.000892%
$

and, as you can see below, the resulting mp3 file is the same size as the mp3 file created using Konvertible (not surprising, since Konvertible is a GUI front-end for ffmpeg) and virtually the same as the mp3 file created by shntool.

$ file out.mp3
out.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 192 kbps, 44.1 kHz, Stereo
$ ls -la out.mp3
-rw-r--r-- 1 fitzcarraldo users 85334024 Dec 20 18:14 out.mp3
$

So, there you have it: GUI or command line; take your pick!

A guided tour of my KDE 4.8.4 desktop (Part 2)

In A guided tour of my KDE 4.8.4 desktop (Part 1) I gave a brief overview of the KDE desktop on my main laptop. This time I’m going to cover some applications, KDE and non-KDE, that I use. Just to prove that I don’t look at KDE through rose-tinted spectacles, I’ll also mention a few problems too.

I don’t use a desktop PC. This laptop is my main PC and I use it for all my professional and personal tasks. I travel frequently and have to connect to public and private networks (wired, wireless and broadband modems) and to many different network printers, so a reliable desktop environment and reliable network management software are essential. KDE satisfies the first requirement. The desktop environment-independent NetworkManager and its KDE front-end, the Plasma widget NetworkManagement, satisfy the second requirement. I also use my laptop for the usual leisure activities such as watching DVDs, video files and TV programmes; listening to music files, Audio CDs and Internet radio; messaging/telephony (PC-to-PC and PC-to-landline/mobile internationally); browsing the Web, blogging and so on.

So this is very much a mission-critical machine for me. The fact that I’m using KDE successfully for all these tasks is a testament to the power of KDE (and Linux, of course). I should also point out that, for a mission-critical machine, I’m living a little dangerously as I use the testing branch (a.k.a. unstable branch), rather than the stable branch, of Gentoo Linux. I’ve been using the unstable branch for several years on this laptop and its predecessor, with only a few hiccups, although I do have to keep an eye on the Gentoo forums in case someone reports a problem.

Office suites

Microsoft Word and LibreOffice Calc

Snapshot 1 - Microsoft Word and LibreOffice Calc

I use both LibreOffice and Microsoft Office 2007, the latter under WINE (see WINE tips: Giving each Windows application its own environment). Office 2007 guarantees me 100 per cent compatibility at work but I also find it easier and more reliable than LibreOffice with the large, complex documents and spreadsheets I create. That said, I also have many Word 97 documents and Excel 97 spreadsheets that I still need to access, and LibreOffice opens some of them that Office 2007 cannot. I prefer to use Writer rather than Word for simple tasks such as typing a letter, as I dislike the Ribbon Interface. And I’m happy to use Calc rather than Excel in the majority of cases.

Once I got Office 2007 running under WINE I did not have to boot into Windows any more, although recently that changed for one very specific task on one work project: checking out (downloading) a Microsoft Word file from a Microsoft SharePoint repository, editing it locally and checking it back in (uploading it). Using Firefox in Linux I can upload a Word file to the SharePoint repository initially, but I have to boot into Windows and use Internet Explorer and Word to check-out, edit and check-in the revised document. I’ve used third-party document management and collaboration software in the past that does not require the use of Internet Explorer and Word. I can see how Microsoft lock you into their product line, and I don’t like that.

For schematic diagrams and flowcharts I usually use an old version of Visio (5 Professional) I bought in 1999, again under WINE. I find Visio easier and faster to use than Dia, a GNOME application I also use sometimes for simple diagrams.

E-mail client

I use Thunderbird to access several POP3 e-mail accounts and, via the excellent DavMail, a couple of Microsoft Exchange OWA (Outlook Web Access) accounts at different companies. DavMail is a life-saver. Having to access those two accounts via a Web browser was a hassle and inefficient. A single e-mail client which can be used to access and manage all my e-mail accounts is a godsend. I still have work e-mails from more than ten years ago, and Thunderbird enables me to find information in them with ease. For professional use by ‘power users’, WebMail cannot hold a candle to a good e-mail client such as Thunderbird. I use a number of Thunderbird extensions which I find essential: Lightning (calendar); Provider for Google Calendar (bidirectional access to Google Calendar); Timezone definitions for Mozilla Calendar; Change quote and reply format (why isn’t this functionality built-in to Thunderbird?); ConfigDate (ditto); Enigmail (encyption/decryption of e-mails); ImportExportTools (conversion tools for different e-mail formats); Dictionaries for several languages.

One of the reasons I chose Thunderbird was because it is available for both Linux and Windows. As I can dual boot this laptop, I put Thunderbird’s data files on the Windows NTFS partition (Windows cannot access Linux file systems), and Thunderbird in either OS accesses the same data files. I virtually never boot into Windows, but it is good to know that I can access my e-mail accounts from either operating system using the same application.

Scanning

I occasionally use SANE scanner interface software and its GUI front-end XSane for scanning images and documents to create image files. But I am much more likely to use the GUI front-end gscan2pdf, as I often need to create PDF files for work. gscan2pdf is another application I find indispensable.

Web browsing

Browsers and Google Earth

Snapshot 2 - Browsers and Google Earth

I use Firefox and the KDE browser/file manager/universal viewer Konqueror. I configured Konqueror to use the WebKit rendering engine instead of KHTML (Install the package kwebkitpart then launch Konqueror, select Settings > ‘Configure Konqueror…’ and select ‘WebKit’ as the ‘Default web browser engine’ on the General tab). There have been a few times when Firefox has not been able to display a Web page properly or at all, and Konqueror came to the rescue. The KIO Slaves I mentioned in Part 1 also add to Konqueror’s versatility.

I use the Oxygen KDE Firefox extension (see Snapshot 2), a theme for Firefox that makes it look like a native KDE application. Very nice indeed.

Google Earth needs no introduction. It runs well in KDE on my laptop, and I find it useful both in my work and for personal use.

I have the KDE blogging client Blogilo installed and it was easy to configure it to synchronise with my blog. In fact I started preparing this article in Blogilo but had to abandon it as Blogilo would not save reliably my incomplete work to my hard disk. After losing changes several times I gave up and turned to my tried and tested KWrite to draft the article offline first. Shame, really, as Blogilo looks really handy for preparing blog posts offline and then uploading them. Hopefully the next release will work for me.

For Web site creation and editing I use KompoZer. It’s not as sophisticated as Dreamweaver, but is easy to use and does a good job for my purposes.

Messaging and telephony

I use Skype for Linux for PC-to-PC and PC-to-phone communication domestically and internationally. There is simply no alternative if I want to communicate with my Windows-using friends, family and work colleagues: they are not going to switch to anything else. Actually, I find Skype for Linux perfectly usable (unlike Skype for Android on my Motorola Xoom tablet, which has a fiddly and rather annoying user interface). In some countries the state-owned telecom provider blocks Skype for commercial reasons, but I have been able to circumvent this using Tor (see How to install and use Tor for anonymous browsing or to access country-restricted content from another country). Furthermore, some office networks I use also block Skype, to enforce the use of another product or to stop personal communication, but Tor has helped me out there too.

Graphics

I use the GIMP quite a lot, mostly for photo editing/retouching for work purposes but sometimes to edit/retouch personal photos. I have only used the vector graphics application Inkscape a few times at work and at home. I enjoyed using it to produce the graphics for a laptop ‘Powered by’ sticker.

Gwenview

Snapshot 3 - Gwenview

Apart from the excellent KDE image viewer Gwenview, which gets better with every release of KDE, I use GQView. GQview has been around for many years and its UI looks rather dated, but it has some powerful features which I find useful at work (and at home). GQview makes it easy for me to assign keywords to image files and to search on keywords; to examine EXIF data; to print thumbnail proof sheets; to view multiple image files and page through directories of image files, and so on. This application has often been of help to me at work.

Okular and Adobe Reader

Snapshot 4 - Okular and Adobe Reader

KDE’s Okular document viewer and Adobe Reader are in frequent use on my laptop. I use them both but resort to Adobe Reader for the huge PDF files I sometimes have to view at work, as they load quicker in Adobe Reader. Also, Okular has had a rather irritating habit of printing Landscape pages in Portrait, and vice versa. This problem seems to come and go with different releases of Okular.

CAD

I hardly ever need to use CAD applications, but occasionally I do need to view some old AutoCAD files. For this I use an old version (2009-en-1.06-1) of VariCAD Viewer which opens those old files although it can’t open newer AutoCAD files. I tried unsuccessfully to install newer versions of VariCAD Viewer in the past, but have not tried again recently.

E-books

I only recently began reading e-books. The EPUBReader Firefox extension is an excellent and easy-to-use e-book reader, library manager and shop window for both free and commercical e-books in ePub format. The display of book pages when using the extension as a reader is better than many of the dedicated e-book applications I have seen.

Calibre is an excellent dedicated e-book reader and format converter that I discovered by accident when reading a review of the Amazon Kindle. If you are looking for an application that can handle all the various e-book formats, convert between them, manage your e-book library, upload and download e-books, and act as a reader, look no further. Even the application’s Web site oozes class.

Multimedia

SMPlayer multimedia player, and YouTube in Firefox

Snapshot 5 - SMPlayer multimedia player, and YouTube in Firefox

I have far too many multimedia players installed, but I like to alternate between them. In any case it’s useful to have several players installed because sometimes one of them is able to play a certain file that another cannot.

SMPlayer, VLC and Xine play DVDs, CDs, music files, video files, Internet radio, and digital TV (DVB). I like all three.

Miro is a music and video player, torrent downloader, Internet TV and podcast viewer, and more. Another very polished application I enjoy using.

Dragon Player is a KDE player for CDs, DVDs, audio and video files. It plays DVDs, audio and video files well on my laptop, but cannot play Audio CDs for some reason. It is not as versatile or as polished as the multimedia players mentioned above, so I rarely use it.

UPDATE (January 10, 2014): As of KDE 4.11.3, Dragon Player can play Audio CDs on my laptop. I believe this was due to an update to KDE’s Phonon and/or the Phonon backends.

Clementine music player

Snapshot 6 - Clementine music player

The music players I have installed are Audacious, Clementine and Amarok. These three applications focus on playing and managing collections of music files, Audio CDs and streaming Internet radio.

In the days of KDE 3 I used exclusively Amarok 1.4, which was darn near a perfect music player. But new releases of Amarok were buggy in early releases of KDE 4, and today Amarok still does not work as well for me as the KDE 3 version did. Some of the album covers disappear randomly from the album cover manager, and it is irritating to have to restore covers. Clementine, on the other hand, has no trouble managing album covers and I find it is more polished than Amarok and nicer to use all round. I cannot get Amarok to play Audio CDs with the KDE GStreamer Phonon backend, only with the KDE VLC Phonon backend. Even then the optical drive in my laptop spins very fast and produces a loud noise, making listening to Audio CDs painful. Audacious, on the other hand, plays Audio CDs quietly and perfectly on my laptop. Although Clementine is superb in other respects, for some reason it cannot play Audio CDs on my laptop, whichever KDE Phonon backend is selected. All three players can stream Internet radio without problem, although the long pre-configured list of radio stations in Clementine is simply excellent. If Clementine could play Audio CDs on my laptop, it would be my favourite music player.

UPDATE (January 10, 2014): As of KDE 4.11.3, Clementine can play Audio CDs on my laptop. I believe this was due to an update to KDE’s Phonon and/or the Phonon backends.

MIDI players and Karaoke

I have four different MIDI players installed. PyKaraoke (see HOWTO: PyKaraoke) and KDE’s own KMid can both play MIDI files with and without embedded karaoke lyrics. TiMidity++ is a MIDI file player, as well as an ALSA sequencer which can be used by the other MIDI player applications here. Drumstick has three applications: a MIDI player, a drumkit sequencer and a virtual piano keyboard. I enter the following command once before launching any of them:

modprobe snd_seq && timidity -iA -Os

Actually, I have put the above command in a Desktop Configuration File with a nice icon in my Desktop directory, so I just double-click on it. I could have instead loaded the snd_seq module automatically at startup by specifying it in the file /etc/conf.d/modules.

Audio CDs

KsCD is a simple KDE application with a sole purpose: to play Audio CDs. For me it fails miserably in this task, and has done in several releases of KDE. The last time I remember it working for sure was in KDE 4.3.3, and here we are today with KDE 4.8.4. The KDE Bug Tracking System has quite a few bug reports regarding KsCD. I don’t know if the application itself has a bug, or if the KDE Phonon backends are buggy, or if KDE has a bug, or if there is a problem with udev, or a combination. Anyway, whatever the reason, in my case KsCD is useless. Come to that, for Audio CDs Amarok is next to useless. Luckily for me, Audacious, SMPlayer, VLC and Xine can play Audio CDs perfectly on my laptop.

UPDATE (January 10, 2014): As of KDE 4.11.3, KsCD can play Audio CDs on my laptop. I believe this was due to an update to KDE’s Phonon and/or the Phonon backends.

YouTube

I should mention the excellent command line tool youtube-dl (‘YouTube download’) which is great for downloading videos from YouTube. You can specify the resolution, extract the audio, and various other tricks. Well worth adding to your set of mutlimedia tools. Or, if you prefer a GUI, Minitube is a cracking application for watching and streaming YouTube videos without using a Web browser, and also enables you to download them.

Backing up CDs/DVDs or ripping audio and video

K3b is a superb KDE application. It’s a one-stop shop for making back-ups of CDs and DVDs, creating data CDs and DVDs, and ripping CDs and DVDs. I use K3b to rip my Audio CDs to mp3 files.

Another well-known KDE application is the excellent K9Copy DVD ripper. Unfortunately the developer stopped working on it in July 2011. I hope someone else picks it up, as K9Copy has an intuitive GUI and I have used it on a number of occasions to rip my DVDs to my hard disk so that I could watch them when travelling.

dvd::rip does just what the name suggests, and I’ve used this excellent application too. The GUI is intuitive and the online documentation is very good.

Winki the Ripper is a good application for ripping DVDs to MKV files (it can also rip to AVI files). I have used it but noticed recently that the Web site is up for sale, so I hope the application is still being developed.

WINE

WINE menu in Lancelot Launcher

Snapshot 7 - WINE menu in Lancelot Launcher

I have mentioned Office 2007 already, but I have a few other Windows applications installed under WINE, such as IE7 (so that I can see how a Web site looks in a Windows browser), IrfanView, Lotus ScreenCam Player (so that it is still possible to view some videos of a specialist application running in Windows 95 many years ago), Notepad, Pinball and a few applications and utilities I need that are not available in Linux. WINE is not perfect, but it is wonderful software that also makes it possible to run some older Windows applications that are probably not able to run in Windows Vista and 7.

Utilities

Some utilities

Snapshot 8 - Some utilities

I used to use the brilliant command line utility ImageMagick to scale image files, but have not had to resort to the command line since the GUI front-end Converseen was released (see Converseen, a GUI batch image converter and resizer using Qt4 and ImageMagick).

I encrypt and decrypt some of my sensitive files using GnuPG GUI front-ends KGpg and Kleopatra. Kleopatra is slightly easier to use than KGpg, but they’re much of a muchness. The Enigmail extension I use in Thunderbird also uses GnuPG.

KAlarm is a handy KDE utility to produce sounds or pop-up reminder messages, or issue commands, at specific times or time intervals. The GUI is easy to use and KAlarm can be used in many cases as an alternative to setting up a cronjob. It was simple to configure it as a talking clock (see Setting up a talking clock easily in Linux).

AutoKey is a macro utility I use frequently. It can be used in a number of ways, but I use it to insert text in documents and e-mails. For example, I have configured AutoKey to insert the output of the Linux date command where my cursor is in an open document or e-mail if I press Ctrl-Alt-D: Sun Jul 22 14:41:25 BST 2012. For another example, I have configured AutoKey to enter my full postal address when I type “adr” and press the Space key (but puts it back to “adr” if I press the Backspace key). It is a very handy utility and can be configured to execute simple or complex scripts.

Easystroke is the mouse equivalent of AutoKey. For example, I have configured Easystroke to type “———- Original Message ———-” when I press the mouse scroll wheel and move the mouse pointer diagonally from left to right on the screen. As another example, I have configured it to launch an instance of DavMail to access a specific company’s OWA Exchange Server when I trace the first letter of the company’s name on the screen with the mouse cursor. It’s a clever utility!

BasKet Note Pads is a KDE application for recording and reading notes. The notes can be simple text or complex with embedded pictures, hyperlinks and so on. I switched to BasKet from Tomboy as the latter is a GNOME application and requires some GNOME-specific packages that I didn’t want cluttering up my hard disk. However, I can’t say I like BasKet: I miss the simplicity and easy-to-use UI of Tomboy which was a pleasure to use. I think I may have to try another KDE application (KJots) instead of BasKet, as it may fit my needs better.

KRename is a batch file renamer for KDE that has come in handy both at work and at home.

Filelight is a KDE utility that shows you graphically how much of each partition is occupied and how much is free. I like it because it makes it easy for me to see at a glance how much disk space I have left.

JDiskReport is another utility for showing you disk occupancy graphically. You can select pie carts, segment charts or bar charts. It is freeware but not open-source, but is nevertheless a nice utility to have in your set of tools.

Antivirus software

BitDefender Antivirus for Unices

Snapshot 9 - BitDefender Antivirus for Unices

As I run some Windows applications under WINE, and as I dual boot with Windows 7, I use both BitDefender Antivirus Scanner for Unices and ClamTk, the GUI front-end to ClamAV. That way I can scan my Windows directories from Linux. My work colleagues sometimes pass work files to me on USB pen drives, and I use these two anti virus utilities to scan the pen drives just to be a bit safer. Yes, it has flagged the occasional malware in Windows files.

Games

Games

Snapshot 10 - Games

I hardly ever play games, but still installed the entire KDE Games suite (you never know, after all!). Of the KDE games, I play KPatience, KCheckers, KBlocks (a Tetris clone), KBreakOut (takes me back to playing BreakOut written in Applesoft BASIC on an Apple II+!) and KMahjongg, a solitaire game using beautifully rendered Mahjong tiles.

I have also installed a few non-KDE arcade games such as Missile Command and Pacman Arena (nicely done in 3D). I loved Pac-Mania on my Acorn Archimedes in the early 1990s, so I also use SDLMame and its GUI front-end GMameUI to play Pac-Mania and a few other old favourites such as Frogger.

As far as chess is concerned, I installed the 3D DreamChess, as well as the older but perfectly decent XBoard and eboard.

Scrabble and Boggle are popular games in my family, so I installed XScrabble and GBoggle, the latter being one of only a handful of the packages mentioned in this article that I had to install outside the Portage package manager because there is no ebuild (another being the commercial game Machinarium, which is available for Linux, beautiful and I recommend highly).

I occasionally play TORCS, which is not bad for a car racing game.

There are a lot more Linux games to discover, if you’re that way inclined.

Summary

I’ve just scratched the surface, but hopefully have given you a taste of how I use KDE (and Linux). Of course my needs and uses are different from everyone else’s, but I hope this and the previous article have shown you the breadth of KDE and Linux applications, and that they are completely viable on the desktop. If you have not tried KDE yet, I hope this has tempted you. And, if you’re new to Linux, I hope this has tempted you to try Linux too.

Setting up a talking clock easily in Linux

There are several ways to set up a talking clock in Linux. One simple way to do it if you’re a KDE user is to use the Analogue Clock widget. Once you have placed the Analogue Clock widget on your Desktop, click on the widget’s spanner icon, select the ‘General’ tab and it shows the title ‘Text to Speech’ and a ‘Speak time’ box where you can select the frequency at which you want the talking clock to speak the time. When you click ‘Apply’, an icon appears in the System Tray on the Panel: Jovie KDE Text-to-speech Manager. You can right-click on the Jovie icon then click on ‘Configure’ to change the language and voice etc.

Another alternative is to install the eSpeak text-to-speech synthesizer and use the GUI KAlarm utility to run the following command at any interval you like (every hour, every half hour, every 15 minutes or whatever you want):

date +%I:%M%p | espeak

When the command above is executed on the hour, the voice speaks the hour followed by “zero zero AM/PM”. For example it says “seven zero zero PM” rather than “seven o’clock PM”. If you prefer the latter, you can modify the one-line command:

if [ $(date +%M) != "00" ]; then date +%-H:%M%p%Z; else echo -n $(date +%-H); echo -n "oh clock "; date +%p; date +%Z; fi | espeak -ven+f6

Use the command date --help to find out the different parameters available for the date command. You can also play around with the last two characters in the above command to get different voices. For example “m1″, “f4″ etc.

Using KAlarm’s GUI is less daunting for many people than setting up a cronjob to run the command, which would be yet another way of doing it. Also, by using KAlarm it is quick and easy to enable and disable the talking clock.

An alternative to the above command would be to run one of the many Bash scripts found on the Web. One such is saytime. SayTime uses the festival text-to-speech engine, an alternative to espeak, which you would need to install. The guts of SayTime is simply the command:

echo "Today is `date +%d` `date +%B` `date +%Y` and now the time is `date +%k` and `date +%M` minutes" | festival --tts

so you could use that command with KAlarm or a cronjob if you wanted. You can play around with the commands to get the time spoken the way you want.

eSpeak is also configurable; check out the Web site eSpeak text to speech. For example, the following is the time spoken in Portuguese instead of English:

date +%I:%M%p | espeak -vpt

or in English with a Scottish accent:

date +%I:%M%p | espeak -ven-sc

or in English with a Brummie accent:

date +%I:%M%p | espeak -ven-wm

or in Latin with a female voice:

date +%I:%M%p | espeak -vla+f4

Three guesses what this one does:

date +%I:%M%p | espeak -ven+whisper

You can have some fun exploring the options.

One small step for [a] man… revisited using Audacity

Earth view from Columbia

Audacity audio editor and recorder

On the 42nd anniversary of the Apollo 11 Moon landing, I look at a couple of ways that the FOSS application Audacity has been used to study that amazing event, and marvel at the sheer audacity (pardon the pun) of the Apollo programme.

Some of you may remember the 2006 audio analysis of Neil Armstrong’s famous words as he stepped onto the Lunar surface for the first time on 21 July 1969, 42 years ago tomorrow (the Lunar module landed on the 20 July). The analysis, which supposedly proved that Armstrong did say “That’s one small step for a man, one giant leap for mankind.”, was performed using the Windows application GoldWave. You can read the following BBC article about the analysis: Armstrong ‘got Moon quote right’.

But Linux users can analyse the recording for themselves using, for example, Audacity. You might want to do it to celebrate the 42nd anniversary of that momentous occasion. You can download an MP3 file (a11a1091545-1101226.mp3) of the recording from the following NASA Web page: One Small Step.

If you haven’t already got Audacity installed, you can install it using your Linux distribution’s package manager.

In KDE, an Audacity icon subtitled Sound Editor will be installed under Kickoff > Applications > Multimedia. So launch Audacity, click on File > Open and open the MP3 file you downloaded from the NASA Web site. It’s quite a large file, so it will take a little while to load into Audacity. You can click on the Play button to listen to the whole file — which I recommend you do as it’s simply awe inspiring — but then you can zoom in on those famous words (notice the Zoom In and Zoom Out buttons in the top right corner, and the scroll left and right buttons at the bottom of the Audacity window?). If you want to select only the relevant section, then you can enter the Selection Start as 00 h 08 m 38.000 s and the Selection End as 00 h 08 m 46.500 s. Then when you click on the Play and Stop buttons Audacity will play only that section. Or perhaps you prefer to hear just “That’s one small step for (a) man”, in which case set the Selection End as 00 h 08 m 41.100 s. Notice the smaller Play-at-speed button and speed slider about mid-way across the top of the Audacity control panel? You can even slow down the playback speed if you want. Try it. Now zoom in to the range 08 m 39.750 s to 08 m 40.000 s.

Well, the NASA Web page I referred to above states:

At the time of the mission, the world heard Neil say “That’s one small step for man; one giant leap for mankind”. As Andrew Chaikin details in A Man on the Moon, after the mission, Neil said that he had intended to say ‘one small step for a man’ and believed that he had done so. However, he also agreed that the ‘a’ didn’t seem to be audible in the recordings. The important point is that the world had no problem understanding his meaning. However, over the decades, people interested in details of the mission – including your editor – have listened repeatedly to the recordings, without hearing any convincing evidence of the ‘a’. In 2006, with a great deal of attendant media attention, journalist/ entrepreneur Peter Shann Ford claimed to have located the ‘a’ in the waveform of Neil’s transmission. Subsequently, more rigorous analyses of the transmission were undertaken by a number of people, including some with professional experience with audio waveforms and, most importantly, audio spectrograms. As of October 2006, none of these analyses support Ford’s conclusion. The transcription used above honors Neil’s intent.

What do you think? I’m not convinced he said the “a”.

Another twist to the tale is a dispute about the originator of the famous line itself: Apollo 11 Moon Landing: British scientist claims to have coined Neil Armstrong’s ‘one small step’ line.

While we’re at it, newspaper reports for the 21 and 22 July 1969 make fascinating reading. For example you can read on-line the UK Daily Telegraph pages about the Apollo 11 Moon landing here: Moon landings: How the Daily Telegraph reported on Apollo 11.

Also, I was fascinated to read about the Italian high school class that used Audacity to analyse the time delay between Mission Control’s and Armstrong’s replies — you can hear the delays in the MP3 file — and calculated accurately the distance between the Earth and the Moon: Echoes from the Moon. Now that is one science class those school students won’t forget. What a fantastic idea by the school teacher.

A wonderful demonstration of the laws of physics, albeit not on the Apollo 11 mission, was performed on the Moon by the Apollo 15 astronaut David Scott: he dropped a hammer and a feather simultaneously. For those of you who aren’t engineers or scientists, or who don’t remember your school physics classes, take a look at practice proving theory correct in a fun way: The Apollo 15 Hammer-Feather Drop.

Did you know that more than 300,000 people worked on the Apollo programme, and it cost between 20 and 25 billion US dollars (1969 US dollars, which would be much more today taking into account inflation between 1969 and 2011)? It also cost several lives.

As I look up at the Moon in awe, and recall watching on a black-and-white TV set in 1969 as Armstrong climbed down the ladder of the Eagle, I think the Apollo programme was one of Mankind’s most amazing technological achievements, and perhaps the most amazing of them all. To think that the Lunar Module was controlled by a computer with far less processing power and memory than the smartphone that I hold in my hand today is astounding. No wonder the Apollo astronauts came back to Earth changed men. After their mission, everything else must have paled into insignificance.

This article is a refreshed version of a post I made in 2009 Sabayon Linux Forums on the 40th anniversary of the Apollo 11 Moon landing. I used Audacity again recently, this time to reduce the loudness of an event sound for Mozilla Thunderbird, and I thought it would be nice to celebrate again both the Apollo 11 landing and the usefulness of Audacity and the fun that can be had with it.

Nostalgia for those ALSA mixer channels that KMix and GNOME Volume Control used to have?

These days the GUI mixers KMix and GNOME Sound Preferences display PulseAudio devices and streams rather than ALSA mixer channels. For example, prior to its integration with PulseAudio, KMix typically displayed a mixer window that looked like the one below.

KMix showing ALSA channels

KMix with ALSA channels

whereas, today, a KMix window typically looks like the following:

KMix with PulseAudio channels

KMix with PulseAudio channels

 

KMix 3.8 in KDE 4.6.1 does not provide separate speaker and headphone channels. You can alter the headphone and speaker volume by using PulseAudio Volume Control instead (see the picture below), but people are not as familiar with the PulseAudio GUI, and it is yet another step to perform.

PulseAudio Volume Control showing selection of Headphones channel

PulseAudio Volume Control showing selection of Headphones channel

 

If you are like me, you probably end up using KMix (or GNOME Sound Preferences) but also launch ALSA Mixer in a Konsole/Terminal for fine-grained control of the underlying ALSA channels:

ALSA Mixer running in Konsole

ALSA Mixer running in Konsole

 

This is more hassle, because you launch Konsole/Terminal and you enter the command alsamixer and press F6 (alternatively, use the command alsamixer -c 0 if your sound card is Card 0). The PulseAudio channels are displayed by default if you don’t specify your sound card when you launch ALSA Mixer.

EDIT (January 28, 2012): With recent versions of ALSA Mixer I have found that I must specify the card in the alsamixer command (e.g. alsamixer -c 0) because the command alsamixer alone results in a Segmentation fault message.

It would be handy to have an icon on the Panel or on the Desktop that you could use to launch ALSA Mixer. Well, you can. In fact, as there is also a GUI version of ALSA Mixer (albeit with a few less features than its console equivalent) you can use that instead if you prefer. Below I explain a few of the possible ways you can display ALSA Mixer easily from within a desktop environment.

 

Change KMix from a PulseAudio mixer to an ALSA mixer

By default KMix displays PulseAudio channels instead of ALSA channels. However, if you want to display the ALSA channels instead (as shown in the first picture above), quit KMix and enter the following command in a Konsole window or in KRunner:

export KMIX_PULSEAUDIO_DISABLE=1 && kmix

If you want to make this permanent then add KMIX_PULSEAUDIO_DISABLE=1 to the file /etc/conf.d/alsasound

Personally, though, I prefer not to do this as I want to control the PulseAudio channels via the KMix mixer. Try running two or more audio/video apps simultaneously and you’ll see what I mean – it’s useful! For example, I can control the volume of various applications separately (handy when you want to check something or are using Skype), as illustrated by the picture below:

KMix showing PulseAudio playback streams tab

KMix showing PulseAudio playback streams tab

 

and I run ALSA Mixer separately to tweak the underlying ALSA channels. Using Yakuake (or Guake in GNOME) is quite a good way to run ALSA Mixer in a console: it is quick and easy to pop-up a window to launch ALSA Mixer, and ALSA Mixer is displayed in colour at nearly the width of the desktop.

 

Launch ALSA Mixer GUI from an icon on the Panel

First, use your package manager to install the package alsamixergui. It’s a GUI equivalent of the console ALSA Mixer, but with a few less options.

Once you install it, you should find ALSA Mixer GUI in your desktop environment menu (e.g. Kickoff > Applications > Multimedia > ALSA Mixer GUI). By default this will show the PulseAudio channels, so use the menu editor (e.g. right-click on Kickoff and select Menu Editor) to change the command to the following if your sound card is Card 0:

alsamixergui -c 0

Once you have done this, save the new menu entry, log out and log in again, and when you launch ALSA Mixer GUI from the menu a window similar to the following will pop-up:

ALSA Mixer GUI

ALSA Mixer GUI

 

To put an icon on the Panel in order to make it even easier to launch ALSA Mixer GUI, just drag the icon from the menu to the Panel and it will be copied to the Panel. Simple as that.

 

Launch ALSA Mixer in a Konsole docked in the System Tray

You can do this using KDocker, which works in KDE, GNOME, Xfce and other desktop environments.

For KDE, create the following Desktop Configuration File Konsole-alsamixer.desktop (or whatever name you want) and put it in the directory ~/.kde4/Autostart/

[Desktop Entry]
Comment[en_GB]=Console (docked) running ALSA Mixer
Comment=Console (docked) running ALSA Mixer
Exec=kdocker konsole -e alsamixer -c 0
GenericName[en_GB]=Dock Konsole running ALSA Mixer in the System Tray
GenericName=Dock Konsole running ALSA Mixer in the System Tray
Icon=kmix
MimeType=
Name[en_GB]=Konsole (Docked)
Name=Konsole (Docked)
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

KDE System Tray showing Konsole docked using KDocker

KDE System Tray showing Konsole docked using KDocker

Clicking on the docked Konsole icon in the System Tray will pop-up a Konsole window with the familiar ALSA Mixer running in it, as shown in the fourth picture above. Clicking on the icon again will minimise the Konsole to the System Tray.

 

Launch ALSA Mixer in a Konsole from an icon on the Desktop

For KDE, create the following Desktop Configuration File Konsole-alsamixer.desktop (or whatever name you want) and put it in the directory ~/Desktop/

[Desktop Entry]
Comment[en_GB]=Console running ALSA Mixer
Comment=Console running ALSA Mixer
Exec=konsole -e alsamixer -c 0
GenericName[en_GB]=Konsole running ALSA Mixer
GenericName=Konsole running ALSA Mixer
Icon=kmix
MimeType=
Name[en_GB]=Konsole
Name=Konsole
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

You can change the icon displayed on the Desktop either by right-clicking on the icon on the Desktop and selecting Properties or by editing the file directly. For example, I specified Icon=/usr/share/icons/mono/scalable/apps/kmix.svgz which looks rather retro and I think suits the unsophisticated looks of ALSA Mixer.

 

Summary

I have not covered all the options for making it easy to display ALSA channels as well as PulseAudio channels, but hopefully one of the above methods will suit your needs or will spur you to experiment.

Follow

Get every new post delivered to your Inbox.

Join 49 other followers