-
Listening to music in the CLI
I want to make my linux machine command line only for a while. I know how to do that buy now. The question is how can i listen to music in CLI. Or maybe should i be asking where can i get a music player that will do that. right now im using xmms in Xwindows. Thanks
-
-
-
-
mpg123 or mp3blaster (very user-friendly, it has an interface).
djserz.com.ar
"All the drugs in this world won't save you from yourself..."
-
My prefered music player is mpd (music player daemon), it runs in the background and you then have a choice of frontends that you can use to control it...
mpc (cli)
ncmpc (curses based interface)
gmpc (gui interface)
foxytunes (firefox/thunderbird extension)
...and more aswell.
The downside is that you have to set it up before you can use it and need to add songs to your music database before you can listen to them, but unless you are constanly adding new songs it isn't a big deal. But the advantages of not needing to be logged in for your music to play, automatic resumption of the last playing tune after you reboot (optional) and being able to choose what frontend I use to control it outways it's disadvantages.
-
I have a 10 gig partition filled with .ogg file and use mplayer via CLI to play them.......when I'm not sure what song I want to listen to, I activate this script I wrote to pick a song at random and poof......music
it can be run from CLI or GUI.....
Code:
#!/bin/bash
#random-ogg: play a random file from jukebox
mount /dev/hda8 #change this to your drive
cd /linux/ #change this to your mount point
filename=$(find -type f |
gawk 'BEGIN{
srand()
}
{
names[NR]=$0
}
END{ i=1+int(rand()*NR)
print names[i]
}
')
echo "$filename"
mplayer "$filename" #change this to use XMMS, kaboodle, etc
Last edited by janet loves bill; 05-19-2005 at 03:39 AM.
-
I use mpg123 to play mp3's via a remote ssh session.
First, create a playlist:
Code:
find /mnt/Music -name '*.mp3' >/mnt/Music/playlist.m3u
Then play with shuffle from the newly created playlist:
Code:
mpg123 -vCzyb1024 -@playlist.m3u
mpg123 options:
v - verbose
C - enable control keys
z - shuffle (Alternatively, you can just cd to a music directory and run -Z)
y - try to resync on broken file or stream
b - buffer
1024 - buffer size
@ - specify playlist file (you can replace the * in the find command with a keyword or artist name to build specialized playlists)
If you can get the URL of a streaming mp3 feed from the internet, you can save it in a text file with a .m3u extension and play it the same way.
And don't forget alsamixer to control the volume...
-
Re: Listening to music in the CLI
Originally posted by linuxnewbie05
The question is how can i listen to music in CLI. Or maybe should i be asking where can i get a music player that will do that.
Ogg Whips The Llamas ***!!
Commandline Player: ogg123
Enjoy,
Mike
Man-page: http://www.die.net/doc/linux/man/man1/ogg123.1.html
Examples:
The ogg123 command line is fairly flexible, perhaps confusingly so. Here are some sample command lines and an explanation of what they do.
Play on the default soundcard:
ogg123 test.ogg
Play all of the files in the directory ~/music and its subdirectories.
ogg123 ~/music
Play a file using the OSS driver:
ogg123 -d oss test.ogg
Pass the "dsp" option to the OSS driver:
ogg123 -d oss -o dsp:/dev/mydsp
Use the ESD driver
ogg123 -d esd test.ogg
Use the WAV driver with the output file, "test.wav":
ogg123 -d wav -f test.wav test.ogg
Listen to a file while you write it to a WAV file:
ogg123 -d oss -d wav -f test.wav test.ogg
Note that options apply to the device declared to the left:
ogg123 -d oss -o dsp:/dev/mydsp -d raw -f test2.raw -o byteorder:big test.ogg
Stress test your harddrive:
ogg123 -d oss -d wav -f 1.wav -d wav -f 2.wav -d wav -f 3.wav -d wav -f 4.wav -d wav -f 5.wav test.ogg
Create an echo effect with esd and a slow computer:
ogg123 -d esd -d esd test.ogg
I miss MDWatts. He was knowledgeable, thoughtful, and genuinely enjoyed sharing his talents with others.
-
I use ogg123 and mpg123, and here's a script that I wrote to play all my music randomly, I just hit ctrl-C to go to the next song, hit it twice to quit. I also use this script to wake me up in the morning. And to everyone that knows bash: is this the ugliest hack or what?
I forget which one I currently use, so I'll post both, justlinux isn't letting me upload them
randommusic.sh:
Code:
#!/bin/bash
#plays random music
while : ; do
if test -z "$file"; then
#file=$(locate /home/share/Music | sed -n "$RANDOM"p | grep .)
file=$(find /home/share/Music | sed -n "$RANDOM"p | grep .)
echo -n '.'
else
if file "$file" | grep Ogg &> /dev/null && ogg123 "$file" && file= && echo -n "Searching "; then
:
else
mpg123 "$file" && file= && echo -n "Searching "
fi
fi
done
randommusic2.sh:
Code:
#!/bin/bash
# plays random music
# Set this to the dir where your music is, with or without a leading slash.
MUSICDIR=/home/jt/Music/
# Get the total number of songs (including dirs, which will be ignored)
TOTALFILES=`find $MUSICDIR | wc -l`
# This is the loop that will keep the music playing forever
while : ; do
# get out of this loop with a file from $MUSICDIR
while test -z "$file"; do
# keep generating a random number until we get one that is less than the number of TOTALFILES
until [ "$goodrandom" -lt "$TOTALFILES" ] &>/dev/null; do
goodrandom=$RANDOM
# echo this dot for a crude spinner
echo -n .
done
# Extract the file from line $goodrandom
file=$(find "$MUSICDIR" | sed -n "$goodrandom"p)
done
if file "$file" | grep Ogg &> /dev/null; then
ogg123 "$file"
elif file "$file" | grep MP3 &>/dev/null; then
mpg123 "$file"
fi
unset file
echo -n "Searching "
done
-
madplay
use:
madplay --tty-control -r -z -v <path>
--tty-control - control with the keyboard
-r - repeat
-z - shuffle
-v - verbose
<path> eg.: /storage/mymusic/*mp3
this way u get all the files, in all subdirectories
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|