alias somafm='read -p "Which station? "; mplayer --reallyquiet -vo none -ao sdl http://somafm.com/startstream=${REPLY}.pls'

Bash Alias That Plays Music from SomaFM

This is the alias command that I discussed in my prior release which you can add to your ~/.bashrc. This command asks for the station name and then connects to somafm, Great for those who have linux home entertainment boxes and ssh enabled on them, just for the CLI fiends out there ( I know I'm one of them ;) You can find future releases of this and many more scripts at the teachings of master denzuko - denzuko.co.cc.

These Might Interest You

  • This command asks for the station name and then connects to somafm, Great for those who have linux home entertainment boxes and ssh enabled on them, just for the CLI fiends out there ( I know I'm one of them ;) Also, don't forget to add this as alias(ie alias somafm="read -p 'Which Station? "; mplayer --reallyquite -vo none -ao sdl


    11
    read -p "Which station? "; mplayer --reallyquiet -vo none -ao sdl http://somafm.com/startstream=${REPLY}.pls
    denzuko · 2009-05-04 00:26:19 8
  • An alias i made for myself to play music in a faster way. Works great when you have Guake / Tilda installed (Console that drops down like in the game QUAKE) --- I put this in my bash_alias file (I'm on ubuntu, the bash_alias file does autostart with the right config) but it works putting it in bashrc too. Or anything that autostarts when the console is opened. --- Needs Mplayer and music files to work. With out music theres nothing to play! Oh, and also, without modification, this alias will try to play stuff from your ~/Music folder! (case sensitive). Make sure that folder exists and has music OR edit this alias to fit your needs. Show Sample Output


    -2
    alias mux='clear && cd ~/Music/ && ls && echo -n "File> " && read msi && mplayer ~/Music/$msi'
    Noxn · 2009-03-23 10:45:27 0
  • Of course, a fifo is required for piloting the fade out of another song, but with a few bash function, we can mix music in bash like : crossfadeIn > mplayerfifo1 & crossfadeOut > mplayerfifo2 loop 0 10 > mplayer fifo1 etc etc


    0
    ( for((i=0;$i<100;i++))do echo volume $i 1; sleep 0.1s; done; )| mplayer -slave -quiet sample.mp3
    Juluan · 2011-01-06 11:22:03 1
  • Plays the sound of the file, should sound like *some* kind of music, most files sound like static but some are really cool. variations: sudo cat /dev/sda > /dev/dsp sudo cat /dev/sda5 | aplay Check out http://bbs.archlinux.org/viewtopic.php?id=70937 for more variations! semi-dupe--like http://www.commandlinefu.com/commands/view/985/generate-white-noise but with different syntax and program. Show Sample Output


    0
    sudo cat /usr/share/icons/*/*/* > /dev/dsp
    12345678 · 2009-08-06 03:12:27 0
  • Play files in shuffle mode with bash and mpg123. Why bother using big-as-hell stuff like mplayer? This will play all your music files contained in */* (in my case author/song.format) with bash and mplayer showing a nice output. Show Sample Output


    0
    while [[ 1 ]]; do n=( */* ); s=${n[$(($RANDOM%${#n[@]}))]}; echo -e " - $s"; mpg123 -q "$s"; done
    XayOn · 2013-01-18 09:20:58 0
  • The glob pattern * expands to all files, no need for the 'ls' command. The quotes around "$i" make sure filenames with spaces in them are handled correctly. mplayer determines if it is a media file and plays it, or gives errors and the loop asks if this file has to be removed. Show Sample Output


    0
    for i in *; do mplayer "$i" && rm -i "$i"; done
    warkruid · 2013-12-26 17:13:23 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: