Posts Tagged ‘mpg123’

Play Audio Music CDs in Linux console / terminal in the 21 Century mission hard but possible

Tuesday, July 30th, 2024


Compact discs (CD's)
ain't dead yet but there easy straigh use on free operating systems Linux / FreeBSD / OpenBSD is starting to deteriorate. That is quite normal I guess, as CDs are no longer officially produced or sold for few years in America and there is no Audio CD bookstores, neither in europe and perhaps there are just few in europe, perhaps CD are used somewhere in Africa and Asia, but most modern world has officially buried them.

However as I love old stuff and I had the opportunity, I bought an old Audio CD (fake copy one 🙂 of Judas Priest Screaming for Vengence and the famous Jimi Hendrix  (Best Complilation) Experience an improvised shelf-book store selling books by a half deaf aging guy who sells books for years in Dobrich in the center.
And to remember the young years of Rock Roll wanted to play it on my very old but still kicking Lenovo Thinkpad R61 notebook (that is now 16 years old but thanksfully it still works and kicks ass with a Debian GNU / Linux 10 Buster.)

The task is very easy and as I have a Window Maker (Wmaker) on it in order to save myself an extra loading of this a kind of "archaic machine" and tried to play my CDs with everything at hand thus I tried first to play the CD in console with the good old but gold cdplay with which I have played a dozens of Audio CDs back in the days … 

# cdplay

just to find out the CD got red and started to roll but I get no sound via the Sound Card 🙁

Next thing, i assumed was the problem might be the pulseaudio process blocking the sound card to be used, preventing cdplay to be able to properly channel the sound to the sound card, that used to be quite of classical problem, if you remember, thus I tried to run the cdplay via the aoss (Wrapper script to facilitate use of alsa oss compatibility library.)

Before using oss of course i've loaded the snd-pcm-oss kernel module, to make the sound blaster be able to use the old obsolete Open Sound System.

# modprobe snd-pcm-oss

# aoss cdplay

Though that aoss trick worked for some programs that used old Open Sound System scheme to output sound, it doesn't unfortunately, at that case.
 

Strange enough my sound card is properly identified by the Debian Linux and I can play MP3 songs, as well browse videos in youtube and other Internet resources in Firefox and even the pulseaudio process that is running in the background is spitting sounds out of the Notebook Speakers.

The laptop doesn't seem to have any sound driver or Sound Card issues, as I can normally play my old .XM and .MOD  sound extension files with the good old mikmod

 

# mikmod

as well as I can even normally play MIDI audio files by using the timidity tool as well as with playmidi

# timidity HitTheLights.mid

# playmidi HitTheLights.mid


Just to proove the MIDIs can be played normally via the Sound Blaster (for a more on the topic check my previous article talking in depth about Linux and MIDI – Play Midis on Linux / Make Linux MIDI Ready for the Future – Enable embedded MIDI music to play in a Browser, Play MIDIs with VLC and howto enjoy Midis in Text Console.

Next logically to make sure, something is not wrong with audio drivers, I tried to play some music normally with, the standard console players I have played with for years on Linux mpg123 / mpg321 for reference check my Listening music in text mode in Linux console but this was no luck again …

I tried even to install the opencubicplayer ( Linux port) music player and tried to open the CD, but even though the CD can be heard to be rolling in the CD drive no sound was outputed out of the laptop speakers.

 

open-cubic-player-screenshot-on-linux

Thus to resolve tried everything at power starting from increasing any missing volumes via the aumix command, as often in the past I remember the problem in such situations is the sound volume is decreased to zero percentage or completely muted.

# aumix


aumix-with-linux-htop-screenshot-animated-gif

as well as with 

# alsamixer


Alsamixer-control-sound-volume-linux-screenshot

Nevertheless, every possible volume up volume was raised and everything looked cool as I could play normally music on machine or in a browser, the AUDIO CD Music refused to play out of the Speakers.
 

Playing the Audio CD via success with mplayer

The work around to make it play was up to a one liner with mplayer

# mplayer -cdrom-device /dev/cdrom cdda://

To easify the play of CDs I've created for my self a tiny one liner script to run it.

 

#!/bin/bash
mplayer -cdrom-device /dev/cdrom cdda://

I've called the script playcd.sh, made it executable and placed it under /usr/local/bin

# vim /usr/local/bin/playcd.sh
#!/bin/bash
mplayer -cdrom-device /dev/cdrom cdda://


# chmod +x /usr/local/bin/playcd.sh

 

Playing Audio CDs with VLC (VideoLAN Media Player)

I've vlc client installed on my Linux box, if you don't have it, do:

# apt install –yes vlc

Then roll on the CD with vlc with passing it the location to the CD, usually one of the down two pointers should work:

# vlc vcd:///dev/sr0

# vlc vcd:///dev/cdrom

If you want to loop the Tracks to play forever

# vlc –loop vcd:///dev/cdrom

By the way vlc can do much more than you think as you can even play youtube with it, for example you can try it with the Axel Folly classics Mod file, by running it like this.

# vlc https://www.youtube.com/watch?v=SlyK_elUmIw


Cheers and Enjoy CD audio on Linux  ! 🙂

Linux: 8 Console Music players / Listening mp3 music in text mode

Monday, June 17th, 2013

As most of computer geeks, music is very important to make up my day and bring me up from bad mood or boredom. I like doing things from console, so even though nowadays Linux Desktop is so convenient, I still often prefer playing my mp3s from command line. In that spirit its worthy share with newer Linux users about existence of few mp3 players I used over the years to play my MODs / XM / Wavs / Mp3 etc.in pure console:

1. First and maybe most used over the years is mpg123 and its clone mpg321

mpg321 debian gnu linux playing mp3 in console screenshot
mpg123 is first mp3 player I ever used in Linux with no graphical environment and even to this day I install it on every Linux Desktop I have to configure. Its small its handy and it plays well most of mp3 music. Historically there was some issues with licensing of mpg321 making it not 100% (GPL-ed free software). Therefore a clone of it was made mpg321.
mpg321 is also a good mp3 player, but in some encoded mp3s my experience shows mpg123 plays music better (with less glitches).

 Install both mpg321 and mpg123 on Debian and Ubuntu and rest of deb based Linuces is with trivial:

debian:~# apt-get install --yes mpg321 mpg123
...

2. MP3Blaster (More interactiveNcurses mp3 and ogg vorbis player)

mp3blaster console music mp3 player Debian linux wheezy gnome terminal screenshot

debian:~#  apt-cache show mp3blaster|grep -i -A 1 description

Description-en: Full-screen console mp3 and Ogg Vorbis player
 mp3blaster is an interactive text-based mp3 and Ogg Vorbis player with

Description-md5: 0f28b31112e54bf3e946048856a7b6ce
Tag: interface::text-mode, role::program, sound::mixer, sound::player,

root@noah:/home/hipo/Плот# apt-cache show mp3blaster|grep -i -A 1 description
Description-en: Full-screen console mp3 and Ogg Vorbis player
 mp3blaster is an interactive text-based mp3 and Ogg Vorbis player with

Description-md5: 0f28b31112e54bf3e946048856a7b6ce
Tag: interface::text-mode, role::program, sound::mixer, sound::player,

To install:

 

debian:~# apt-get install --yes mp3blaster
...

3. Open Cubic Player – Cubic Player rewrite for UNIX and Linux

listening mp3 mod xm in console and terminal opencubicplayer ocp gnu linux debian

Those who remember how we used to listen music in DOS (Disk Operating System) days, should certainly remember Cubic Player – IMHO it used to be best MSDOS music player to play CDAudio, midi, MODs, WAVES etc. sound formats. I was more than delighted to find out some few years ago, some geeky developers started project aiming to rewrite from scratch Cubic Player for UNIX OS-es. Open Cubic Player is nowadays reality stable and kicks ass. I warmly recommend it to everyone who want to play music from console or terminal! It simply kicks ass!!! 🙂

Install it with;

debian:~# apt-get install --yes opencubicplayer
...

4. Cmus C Music Player (mp3 / wav / aac / flac / ogg vorbis) console player

Cmus tiny console terminal gnu linux mp3 music player screenshot
debian:~# apt-cache show cmus|grep -i description -A 2

Description-en: lightweight ncurses audio player
 C* Music Player is a modular and very configurable ncurses-based audio player.
 It has some interesting features like configurable colorscheme, mp3 and ogg

Install it with:

debian:~# apt-get install --yes cmus
...

Cmus tiny console terminal gnu linux mp3 music player screenshot
5.Good old but gold Mplayer

noah:~# apt-cache show mplayer|grep -i description -A 2

Description: Ultimate Movie Player For Linux.
 It plays most mpeg, avi and asf files, supported by many native and win32
 DLL codecs. You can watch VCD, DVD and even DivX movies too. The other

Description-en: movie player for Unix-like systems
 MPlayer plays most MPEG, VOB, AVI, Ogg/OGM, VIVO,
 ASF/WMA/WMV, QT/MOV/MP4, FLI, RM, NuppelVideo, yuv4mpeg, FILM, RoQ, PVA files,

noah:~# apt-get install --yes mplayer

playing music in console and terminal mplayer play mp3 ogg and videos in linux console

 


7. herrie – Minimalistic console music player

herrie linux console music player
Other newer player I just recently heard of is Herrie.
I red quite positive things about it, installed it but never got into habit of using it.

8. MikMod – Portable tracked music player

mikmod-console-mod-xm-it-old-school-music-format-player-for-gnu-linux-and-freebsd

Talking about geek music and old school stuff it is impossible not to mention MikMod. Even 12 years after i saw it for first time I still use it often to play cool music from modarchive.org. Its my personal believe MikMod is a player for hard core coders and hackers 🙂

noah:~# apt-cache show mikmod|grep -i description -A 2

Description-en: Portable tracked music player
 Mikmod is a very portable tracked music player which supports a wide
 variety of module formats including compressed sample Impulse Tracker

I'll be glad to hear from others what was your favourite console sound player

noah:~# apt-get install --yes mikmod
...

Convert WAV to MP3 in command line with LAME on Linux

Friday, April 8th, 2011

I needed to convert a bunch of files from WAV to MP3 format on my Linux desktop.

I’ve placed all my wav files to the directory /home/hipo/wav

And then I issued the small one liner script to convert the .wav files to .mp3 using the niftly lame linux mp3 convertor.

Here is how I did it:

linux-desktop:~$ cd wav
linux-desktop:/home/hipo/wav$ for i in *.wav; do
new_name=$(echo $i |sed -e 's#wav#mp3#g');
lame -V0 -h -b 160 --vbr-new "$i" "$new_name";
done

After executing the little script you might go and have a coffee, if you have thousands of files, each file convertion takes about 10-15 seconds of time (speed depends on your CPU).

Here is some output from a lame convertion to mp3 taking place:

Encoding as 8 kHz single-ch MPEG-2.5 Layer III VBR(q=0)
Frame | CPU time/estim | REAL time/estim | play/CPU | ETA
27237/27237 (100%)| 0:12/ 0:12| 0:12/ 0:12| 155.89x| 0:00
64 [27237] ***************************************************************
----------------------------------------------
kbps mono % long switch short %
64.0 100.0 84.1 8.9 7.0
If you want to save my convertion quickly for a later, download my Convert WAV to mp3 from a directory with lame shell script here

Actually there are plenty of other ways to convert wav to mp3 on Linux through mplayer, ffmpeg even with mpg123.

There are also some GUI programs that could do the convertion like winff , however for some weird reason after installing WinFF on my debian it was not able to complete convertion to mp3?!
But it doesn’t matter, the good news is I did what I wanted to via the simple lame program and the above script, hope it helps somebody out there.