Linux music on console

From Ever changing code
Jump to navigation Jump to search

MOC - Music On Console

One of favourite music player in terminal is MOC - Music On Console feature rich, easy to use and solid stable. So, follow the steps below for a of minimum configuration and quick way to start listening your most favourite notes.

Install

apt-get install moc moc-ffmpeg-plugin

Shortcuts

mocp                #start MOC
  • T - theme selection
  • o - open URL
  • ^u - add URL to a play-list
  • A - add a folder recursively to play-list
  • d - remove track from play-list
  • V - save play-list current location at a given file name, can override
  • C - clear play-list
  • < or > - master volume down or up
  • q - quit MOC
  • Q - shutdown the mocp service
  • Shift+C - clear play-list
  • Shift+A - append tracks from selected (from left) to the current play-list (to right pane)

Custom shortcuts configuration

The package includes a sample configuration file at /usr/share/doc/moc/config.example. To configure moc, copy this file to ~/.moc/config and edit it. For instructions about customizing the keybindings, read /usr/share/doc/moc/keymap.example.

 cd ~/.moc && cp /usr/share/doc/moc/examples/config.example.gz ./ && gunzip config.example.gz && mv config.example config

Edit playlist manually radio stream

Go to http://forum.internet-radio.com or similar Internet radio portal and download a playlist file .pls. Open using a text editor and find any stream links and add them to MOC playlist pressing ^u in mocp.

My example of linux-radio-mocp.m3u playlist file:

#EXTM3U
#EXTINF:-1,>>> P O L S K A S T A C J A <<<- Chillout
http://91.121.89.153:7100
#EXTINF:-1,Tylko Polskie Przeboje
http://91.121.164.186:8050
#EXTINF:-1,Tylko Polskie Przeboje
http://91.121.236.246:80
#EXTINF:-1,Tylko Polskie Przeboje - HQ
http://188.165.20.29:9000
#EXTINF:-1,Tylko Polskie Przeboje
http://91.121.103.183:8000
#EXTINF:-1,Radio Zet
http://zetclassic-01.eurozet.pl:8400
#EXTINF:-1,RADIO BOGORIA 94,5 FM
http://s7.radiohost.pl:8888
#EXTINF:-1,RADIO BOGORIA 94,5 FM
http://s6.radiohost.pl:8888
#EXTINF:-1,AmbientRadio.org
http://uk2.internet-radio.com:31491
#EXTINF:-1,KISS FM
http://uk4.internet-radio.com:10911/

Note that each stream entry has 2 lines, first is title position and the title itself in green, the second line is direct url to the stream.

Automatic download and import of playlists

Download python DI-PlaylistParser.py script and add executable attributes. As recently DigitallyImported is paid service you may not be able to download all playlists but I was able to download followings, please make sure you are running this from not UK ip address:

cd ~ && mkdir -p Playlists && cd Playlists        #Create and navigate to Playlist directory
 python DI-PlaylistParser.py -s di -q 40           #Low quality DI lists
 python DI-PlaylistParser.py -s sky -c mp3         #Sky radio mp3 lists
 for file in *.pls; do mocp -a $file; done         #Import all .pls lists to mocp

Now just run mocp and you should see all lists in the right pane.

Audio Mixer on console

ALSA sound control system is one of most popular way to manipulate your sound card settings. It runs in a console.

Install

sudo apt-get install alsa alsa-tools           # installs alsa-base, alsa-utils, alsa-tools and libasound2
sudo adduser yourusername audio                # add yourself to the group audio
sudo init 6                                    # reboot to take effect 

Use

alsamixer          # start

Use arrows up and down to change volume, left and right to change source. To mute/unmute press M. To quit press Q.