Jump to content

play


cybormoron

Recommended Posts

i thought this tip was worth sharing. i kept thinking of bruno's quote while testing this. it's definitely one of those beautiful exotic flowers. :) i also just learned to drag/drop in bash.

Running Linux is like walking in a giant wild garden, you keep discovering beautiful exotic flowers.
The perfect audio player for Linux
Link to comment
Share on other sites

Frank Golden
So the command line approach to playing audio files is better? I just don't see why using a command line to play audio files is better than using a GUI based program.There are times in Linux where the command line is necessary and even preferable but this isn't one of them IMHO,Unless you are trying to learn command line operations.I will always look for GUI methods of doing stuff.If that makes me less of a "real" Linux user, oh well.My 7 cents.BTW, most of the GUI players will play wma files fine if the right codecs are installed. Edited by Frank Golden
Link to comment
Share on other sites

Play handles the system notifications for me in KDE. I did not realize that play could do a lot more if necessary.I just fired up a terminal and tried a Mozart mp3 and it played instantly! This way is a lot quicker than first opening Amarok,browsing to the file, and selecting play.Thanks for the find! One more thing to add to my own Knowledge Base.

Link to comment
Share on other sites

@cybormoronSo you have stumbled upon SoX - Sound eXchange, the Swiss Army knife of audio manipulation :rolleyes: One can even record with it! rec -c 2 sample.aiff trim 0 10 will record 10 seconds of stereo audio.@Frank Golden play & record is just a Tip of the iceberg!

SoX can do a lot of things. SoX reads and writes audio files in most popular formats and can optionally apply effects to them; it can combine multiple input sources, synthesise audio, and, on many systems, act as a general purpose audio player or a multi-track audio recorder.
SUPPORTED FILE FORMATS: 8svx aif aifc aiff aiffc al alsa au auto avi avr caf cdda cdr cvs cvsd dat dvms fap ffmpeg flac fssd gsm hcom ima ircam la lpc lpc10 lu m3u m4a mat mat4 mat5 maud mp2 mp3 mp4 mpg nist nul null ogg oss ossdsp paf pls prc pvf raw s1 s2 s3 s4 sb sd2 sds sf sl smp snd sndfile sndt sou sph sw txw u1 u2 u3 u4 ub ul uw vms voc vorbis vox w64 wav wavpcm wmv wve xa xiSUPPORTED EFFECTS: allpass band bandpass bandreject bass chorus compand dcshift deemph dither earwax echo echos equalizer fade filter flanger highpass key ladspa lowpass mcompand mixer noiseprof noisered oops pad pan phaser polyphase rabbit repeat resample reverb reverse silence speed stat swap synth tempo treble tremolo trim vol :)
Link to comment
Share on other sites

Play is great . . . . I mostly use it here on the forum if people have sound-problems, that way I can determine if it really is the sound-system acting up or just the media-player they are using.The real advantage of a commandline tool is that it does not eat resources while playing music and you have all the computer power available for other tasks you are doing while listening.My favorite command is "play /home/bruno/Music/CD_mp3/Bob_Dylan_Blonde_on_Blonde/*" . . . it will play the full double-album without me having to worry about it :)BTW: you should check the "sox" manpage because next to play sox can do so much more things that could surprise you ;):) Bruno

Link to comment
Share on other sites

OK, I have been using Amarok, but having read this thread, and checked my PCLos2007 which has sox installed anyway, I decided to try it. When I could not get it to work, I renamed a .wav file as "test.wav" and put it both on the desktop and in my /home.I then did in terminal:

$ play /test.wavplay stio: Can't open input file `/test.wav': No such file or directory

Now, why doesn't it work? Or, what do I need to make it work?Thank you,Bill

Edited by BillD
Link to comment
Share on other sites

OK, thanks; that did it. Now how do I get all the special effects (like reverb, base boost, etc)?With it in my home, it then seems to work as

play /home/bill/test.wav

which I could not get to work originally with the multiple word title by stringing it together with the underscores like you did in your example . . . and when I tried it just now from the desktop with "play namepart1_namepart2_namepart3.wav it will not work either . . . hmm? I am being careful to capitalize each section of the name so it looks exactly like it does on the desktop, but I am inserting the underscores to link the whole name together. Is there some other way to insert a multiple word title other than to use underscores? Or better yet, insert an asterisk and abbreviate the title?Bill

Edited by BillD
Link to comment
Share on other sites

Type play /home/bill/Desktop/name (or the beginning few letters of the .wav) then hit the Tab key. It will fill it out for you. Then hit enter and enjoy.I am guessing that you don't need the underscores for a multiple word title, just the empty spaces.

Link to comment
Share on other sites

Type play /home/bill/Desktop/name (or the beginning few letters of the .wav) then hit the Tab key. It will fill it out for you. Then hit enter and enjoy.
Yes, that works great.
I am guessing that you don't need the underscores for a multiple word title, just the empty spaces.
Yes, you do need the spaces. What happens is that when I hit tab, and it fills it in, it puts it in like this:
play namepart1\ namepart2\ namepart3.wav

, so if I put the backslashes in, it works fine and if I leave them out it will not work.The tab scheme is clearly the way to do it if one is not going to use the GUI of Amarok or something like that.However, having tried the echo effect, I find that the delay and decay times seem backward to me; maybe I am confusing echo and reverb, but I cannot get reverb to work at all. I got this far with various pseudo tutorials on the Net, and they just don't hack it, so if you know of a good one, please give me the link!Thank you,Bill

Edited by BillD
Link to comment
Share on other sites

OK, I gotta try this. But I'm using Pardus as my main distro now (and will post a longish review about it shortly, unless there are too many protests) and it's not in the Pardus repository. Would I be safe unpacking the tar I just downloaded from SourceForge (which I just did) and doing the ./configure | make | make install routine from Konsole or the non-X command line? (What do you call that, where you go Alt-F1 and get out of the GUI, anyway? what's the proper name?)

Link to comment
Share on other sites

actually it's better to have the underscores in the file name because it's the recommended way to name files and directories in unix/linux. spaces and or other special characters in file names can cause problems in bash commands. there's 2 ways to work around them, quoting or escaping.this page can explain it better.http://www.tuxfiles.org/linuxhelp/weirdchars.htmlanother issue is absolute pathname vs relative pathname. this page explains.http://www.tuxfiles.org/linuxhelp/linuxfiles.htmlnotice the command in bruno's comment. his directory path has underscores to avoid any spaces issues. i suspect every file/directory on his computer is properly named as such, hehe.i did a little experiment to show this.this first command fails because i'm not in the same directory as the file. the file is not relative to my home directory.

[steve@localhost ~]$ play Andrews_Sisters_-_Boogie_Woogie_Bugle_Boy.mp3play soxio: Can't open input file `Andrews_Sisters_-_Boogie_Woogie_Bugle_Boy.mp3': No such file or directory
next i type the absolute pathname and it plays.
[steve@localhost ~]$ play /media/07home/cybormoron/Music/a/Andrews_Sisters_-_Boogie_Woogie_Bugle_Boy.mp3Input File : '/media/07home/cybormoron/Music/a/Andrews_Sisters_-_Boogie_Woogie_Bugle_Boy.mp3'Sample Size : 16-bit (2 bytes)Sample Encoding: MPEG audio (layer I, II or III)Channels : 2Sample Rate : 44100Time: 02:17.18 [00:00.04] of 02:17.22 (100% ) Samples out: 6.05M Clips: 1.28kplay sox: alsa: output clipped 1275 samples; decrease volume?Done.[steve@localhost ~]$
or i can cd into the correct directory and then just type the relative pathname.
[steve@localhost ~]$ cd /media/07home/cybormoron/Music/a[steve@localhost a]$ play Andrews_Sisters_-_Boogie_Woogie_Bugle_Boy.mp3Input File : 'Andrews_Sisters_-_Boogie_Woogie_Bugle_Boy.mp3'Sample Size : 16-bit (2 bytes)Sample Encoding: MPEG audio (layer I, II or III)Channels : 2Sample Rate : 44100Time: 02:17.18 [00:00.04] of 02:17.22 (100% ) Samples out: 6.05M Clips: 1.28kplay sox: alsa: output clipped 1275 samples; decrease volume?Done.[steve@localhost a]$
now let's rename the file removing the underscores and see what happens. it fails because of the spaces in the name.
[steve@localhost a]$ play Andrews Sisters - Boogie Woogie Bugle Boy.mp3play soxio: Can't open input file `Boy.mp3': No such file or directory[steve@localhost a]$
wrap it in quotes and it plays.
[steve@localhost a]$ play "Andrews Sisters - Boogie Woogie Bugle Boy.mp3"Input File : 'Andrews Sisters - Boogie Woogie Bugle Boy.mp3'Sample Size : 16-bit (2 bytes)Sample Encoding: MPEG audio (layer I, II or III)Channels : 2Sample Rate : 44100Time: 02:17.18 [00:00.04] of 02:17.22 (100% ) Samples out: 6.05M Clips: 1.28kplay sox: alsa: output clipped 1275 samples; decrease volume?Done.[steve@localhost a]$
or i can escape the spaces with the backslash character to play it.
[steve@localhost a]$ play Andrews\ Sisters\ -\ Boogie\ Woogie\ Bugle\ Boy.mp3Input File : 'Andrews Sisters - Boogie Woogie Bugle Boy.mp3'Sample Size : 16-bit (2 bytes)Sample Encoding: MPEG audio (layer I, II or III)Channels : 2Sample Rate : 44100Time: 02:17.18 [00:00.04] of 02:17.22 (100% ) Samples out: 6.05M Clips: 1.28kplay sox: alsa: output clipped 1275 samples; decrease volume?Done.[steve@localhost a]$
personally, i prefer spaces in my file names, they look nicer to me, but i had to learn how to deal with them.bill...i'm afraid i don't know much about the reverb feature.eggdog...isn't there a way to see if it's already installed? i think alt-f1 is called a virtual terminal. Edited by cybormoron
Link to comment
Share on other sites

OK, I gotta try this. But I'm using Pardus as my main distro now (and will post a longish review about it shortly, unless there are too many protests) and it's not in the Pardus repository. Would I be safe unpacking the tar I just downloaded from SourceForge (which I just did) and doing the ./configure | make | make install routine from Konsole or the non-X command line? (What do you call that, where you go Alt-F1 and get out of the GUI, anyway? what's the proper name?)
Hi Eddie . . . have a look if "sox" is installed or available in the package manager. . . . Or else, if you only play mp3's have a look here: Commandline mp3 playerB) Bruno
Link to comment
Share on other sites

Actually, I did have it all along. I looked in Pardus's package manager and it doesn't show up, but

$ locate sox

told me that it was all there. (Note to self: never forget locate.)This is wonderful! I listen more to Webradio than to .mp3s, but I just hardcopied a list of command-line options and I wonder if I could point it at an URL and have it play a .pls. That'll give me something to research.

Link to comment
Share on other sites

  • 3 months later...

I had SoX working well in Pardus 2008.1, but I'm migrating back to Ubuntu for a number of my various tasks, and much to my surprise SoX wasn't included in the install. I just installed Sox 14.0.0 from the Ubuntu repository into 8.04.1, and "play" doesn't seem to be working.Several posts ago, Bruno said:

My favorite command is "play /home/bruno/Music/CD_mp3/Bob_Dylan_Blonde_on_Blonde/*" . . . it will play the full double-album without me having to worry about it smile.gif
I tried that, back in my younger days, and liked it just fine. But in this Ubuntu install, the last couple of days, I'm getting
eddie@eddie-qcdesktop:~$ play /home/eddie/Music/*play soxio: Failed reading `/home/eddie/Music/Kulenty_Ad-unum_WOSPR_Wicherek.mp3': unknown file type `auto'

It's not just that file, it's everything I've tried. At the moment, Kulenty's Ad Unum is the only file in the Music directory, so that's accurate. SoX seems to be identifying everything I ask it to play, after a fashion, but not playing it. I think every sound file I've tried is an .mp3. I tried building a .pls, and got similar results. (The .pls worked in Rhythmbox, so that wasn't me.)I looked at the changelogs. This version is a year old, but no showstoppers were reported in the 14.1 and 14.2 changelogs, at least not that I could recognize as such.Any ideas?Eddie

Link to comment
Share on other sites

Hi EddieMaybe it's not sox but some mp3 codec you are missing . . . can you try 2 commands:

$ mpg123  /home/eddie/Music/<some_file.mp3>

and

$ play /usr/share/sounds/<some_file.wav>

:thumbsup: Bruno

Link to comment
Share on other sites

Hi Bruno,I got the same error message on the .wav file. I know these things do play, so I'd assume that the codec is there. Maybe I'm wrong.I don't have mpg123 installed. Ubuntu gave me the option of installing one of six different packages: mpg123, mpg123-alsa, mpg123-oss-i486, mpg123-nas, mpg123-esd, and mpg321 (some people just have to be different, huh B) ?)It just occurred to me that I set Ubuntu up on this computer to utilize Pulse Audio Sound Server (except the "default mixer tracks" are C-media USB audio, Alsa mixer). Maybe SoX and Pulse Audio aren't a great mix (no pun intended)?But also, I prowled around SoX's Web site and, while I couldn't find anything about Pulse Audio, I did learn that

This release handles the following audio file formats:(snip) * MP3 (with optional libmad and libmp3lame libraries) * MP4, AAC, AC3, WAVPACK, AMR-NB files (with optional ffmpeg library) * AVI, WMV, Ogg Theora, MPEG video files (with optional ffmpeg library)
slocate can't find libmad or libmp3lame, so I assume they ain't there, and maybe my next step should be seeing about acquiring them. What confuses me is that everything else -- the GNOME Totem Movie Player, Rhythmbox, even YouTube audio in Firefox -- seems to work just fine. I guess I don't understand how codecs work; I had the idea that they were systemwide, but maybe they're only linked to whatever application asked for them. I know Totem Movie Player asked me for a bunch of them before I could listen to much of anything.I'd like to get SoX working because this isn't the most powerful computer and I could dig having audio with a light footprint, but I don't want to add too many libraries and start breaking things due to internal conflicts. If it sounds to you like adding those libraries would get SoX on the move, I'll go ahead.Thanks,Eddie
Link to comment
Share on other sites

This is strange Eddie . . . looks like there is a bug in your sox because it should have played those files ! Look for an update or file a bugreport at Ubuntu. ( I have pulseaudio as default soundserver too and no problem using sox )As for mpg123 . . just only install the mpg123 package, that should do. . . . . I hope that mpg123 will play your mp3's B) Bruno

Link to comment
Share on other sites

  • 2 months later...

Reopening this one up after a couple of months....The version of SoX that comes with Ubuntu 8.x comes with no codecs at all. In 8.10, at least, there's a file in Synaptic Package Manager called

libsox-fmt-all

. I installed that, and it works now.Eddie

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...