Results 1 to 10 of 10

Thread: How to play music from the command line

  1. #1
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan Norwich
    Beans
    2,326
    Distro
    Lubuntu 22.04 Jammy Jellyfish

    How to play music from the command line

    The information in this thread has been moved to https://help.ubuntu.com/community/Pl...romCommandLine


    A thread for discussion of the wiki page only can be found here http://ubuntuforums.org/showthread.php?t=2012415


    Thread closed.

    Some people like myself do not thrive on Library-type players and prefer players like xmms audacious or deadbeef and would rather even play their current discs/music files straight from the command-line; call it the Zen school of music-playing [as in pared down]


    This is a short howto for those people


    USING gnome-open-terminal or gnome-terminal



    so to get a great handy command-line music player [looks like a player and is independent from folders and other open terminals]



    1.
    Code:
     sudo apt-get-install gnome-open-terminal
    2. Open Music folder/Right-click/Choose Open In terminal

    3. enter
    Code:
    nvlc */./*


    or refine to cut out random txt/image files to
    Code:
    nvlc */./*flac *ape *wv *shn *aac *m4a *mp3
    and any other music extensions you have you can also simplify this with an alias see here


    there you go.... arrows for navigation


    PS



    a short video to illustrate



    also easy way to have hotkeys to pause/play and go to next track can be set in vlc global preferences and will work with nvlc too


    ================================================== ==============

    3 routes in detail




    I propose 3 routes here SoX which has many functions; NVLC which is part of the VLC package and Mplayer which can be used from the command line too




    1.
    First SoX is really marvelous usually described as the Swiss Army knife of sound processing programs it is perfect for our purpose here



    sudo apt-get install sox libsox-fmt-all


    say you have a bunch of flacs it will play them which a simple command


    Code:
    play * flac
    but with Sox you can add filters thus

    Code:
    play * flac bass +4 gain +2 reverb
    will add quite a bit of bass reverb and added volume

    for all options run
    Code:
    man SoX
    it accommodates a lot of formats

    AUDIO FILE FORMATS: 8svx aif aifc aiff aiffc al amb amr-nb amr-wb anb au avi avr awb cdda cdr cvs cvsd cvu dat dvms f32 f4 f64 f8 ffmpeg flac fssd gsm gsrt hcom htk ima ircam la lpc lpc10 lu m4a m4b maud mp2 mp3 mp4 mpg nist ogg prc raw s1 s16 s2 s24 s3 s32 s4 s8 sb sds sf sl smp snd sndfile sndr sndt sou sox sph sw txw u1 u16 u2 u24 u3 u32 u4 u8 ub ul uw vms voc vorbis vox wav wavpcm wmv wv wve xa
    PLAYLIST FORMATS: m3u pls
    CTRL+c gets you to the next track if you hit CTRL+c and hit c twice it stops play



    2.NVLC is simply superb as a command line player it looks quite nice for starters




    you summon it this way
    Code:
    nvlc */./*
    to enter every folder and play every file in turn. If you are in a single folder simply enter
    Code:
    nvlc *
    or
    Code:
    nvlc *.flac  or whichever extension you are playing
    and it can be used almost as well as the GUI version left and right arrows will move along your file as great speed

    keys "a" and "z" control up and down volume space bar to stop and start and info on your track with i

    h to find all your options


    ================================================== =======



    ================================================== =====

    3.
    Now neither SoX nor Nvlc can handle shorten which is a format that i favour and this is where Mplayer came in handy; and of course it can used for all formats handled by Mplayer and that is like NVLC a lot of formats

    even easier here go into the folder and then enter
    Code:
    mplayer *
    or add your extension if you only want one specific extension played ie
    Code:
    mplayer *.wv
    if you want to enter all the music subfolders in your Music folder and play all the music files with mplayer you can use this little code As is or as a script


    Code:
    for i in */
    do
      cd "$i"
    mplayer *
      cd ..
    done
    or even more simply
    Code:
    mplayer */./*
    will do the same


    Other Tips
    ==============================================

    TO PLAY A CUEFILE

    Code:
    nvlc name.cue


    ==============================================

    TO NAVIGATE ON NVLC AND MPLAYER

    Use top-bottom-left-right arrows


    see further up for info on hotkeys & alias script
    Last edited by Elfy; June 29th, 2012 at 09:26 AM. Reason: cuefile info
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community ie 50 brains are better than one
    Playing with Slackware too now ...
    ShanArt

  2. #2
    Join Date
    May 2010
    Location
    Lahore Pakistan
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to play music from the command line

    Nice how to.

  3. #3
    Join Date
    Feb 2011
    Beans
    13

    Re: How to play music from the command line

    Quote Originally Posted by adeee View Post
    Nice how to.
    Thanks! i'm looking

  4. #4
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan Norwich
    Beans
    2,326
    Distro
    Lubuntu 22.04 Jammy Jellyfish

    to play a lot of cuefiles with NVLC

    will play all lossless and lossy formats


    see here for visual Attachment 213421 in Guake


    for i in */
    do
    cd "$i"
    nvlc *.cue
    cd ..
    done
    save as nvlc.sh and make executable and save in Music



    In Terminal

    Code:
    cd Music
    [assuming all your music folders containing cues are in Music if not change obviously]

    enter
    Code:
    ./nvlc.sh
    it will open and play your first cuefile


    CTRL +C takes you to the next cuefile
    n and p take you to next and previous track in current cuefile
    SHIFT b lets you navigate all folders
    h TO SEE ALL OPTIONS
    c to go black and white [sadly no longer available] well turns out it has been replaced by
    nvlc --nocolor
    Last edited by shantiq; June 20th, 2012 at 10:03 PM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community ie 50 brains are better than one
    Playing with Slackware too now ...
    ShanArt

  5. #5
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,573
    Distro
    Ubuntu

    Re: How to play music from the command line

    Hi shantiq,

    Try this to play your collection randomly

    Code:
    mplayer -quiet -shuffle -playlist <(find ~/Music -type f)

  6. #6
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan Norwich
    Beans
    2,326
    Distro
    Lubuntu 22.04 Jammy Jellyfish

    Re: How to play music from the command line

    cute return key to move to next one

    one more handy tool
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community ie 50 brains are better than one
    Playing with Slackware too now ...
    ShanArt

  7. #7
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan Norwich
    Beans
    2,326
    Distro
    Lubuntu 22.04 Jammy Jellyfish

    Re: How to play music from the command line

    actually there is even another way apart from gnome-terminal

    and that is gnome-open-terminal



    so to get a great handy command-line music player [looks like a player and is independent from folders and other open terminals]



    1.
    Code:
     sudo apt-get-install gnome-open-terminal
    2. Open Music folder/Right-click/Choose Open In terminal

    3. enter
    Code:
    nvlc */./*
    there you go.... arrows for navigation



    you can refine of course if you want to see only certain files played ie

    Code:
     nvlc  */./*.flac *m4a *.mp3 *ape *wv  *cue



    also works with mplayer [navigation not as supple of course]

    Code:
     mplayer */./*.flac *m4a *.mp3 *ape *wv















    Last edited by shantiq; May 25th, 2012 at 01:15 PM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community ie 50 brains are better than one
    Playing with Slackware too now ...
    ShanArt

  8. #8
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan Norwich
    Beans
    2,326
    Distro
    Lubuntu 22.04 Jammy Jellyfish

    Re: How to play music from the command line

    a short video to illustrate



    also easy way to have hotkeys to pause/play and go to next track can be set in vlc global preferences and will work with nvlc too



    see nvlc.png
    Last edited by shantiq; June 22nd, 2012 at 10:52 PM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community ie 50 brains are better than one
    Playing with Slackware too now ...
    ShanArt

  9. #9
    Join Date
    Jun 2012
    Beans
    3

    Smile Re: How to play music from the command line

    Thanks help really appreciated

  10. #10
    Join Date
    May 2007
    Location
    The New Forest
    Beans
    Hidden!
    Distro
    Xubuntu

    Re: How to play music from the command line

    This thread is closed.

    The information is now held on the community wiki at https://help.ubuntu.com/community/Pl...romCommandLine

    Thank you for your thread and the work you have done in keeping it current and of use to the community.

    A thread for discussion of the wiki can be found at http://ubuntuforums.org/showthread.php?t=2012415


    Support threads regarding the wiki and it's content should be created in a suitable forum.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •