using play on the command line
Topic: using play on the command line
started by: wavetel
Posted by wavetel on Oct. 02 2007,20:56Ok maybee I am mad but I am working on some DSL exts. One of which uses the binary called play to play wav files on the command line. This is a pretty standard Linux binary feature so you can work from a console command line and just type play /path/wavfile.wav .. Most of my testing has been done on DSLv4 RC3 and RC4 using a USB install. Thats all fine but when I started trying to use the DSL exts on live CD sessions then the play does not work. There is no such file found. The file seems to be usually at /usr/share/play but on the CD it does not exist. There also seems to be no DSL ext for this one either. Why on earth isnt there a play binary on the CD ? How can I play wav files from the command line ? Any ideas ?
Posted by ^thehatsrule^ on Oct. 02 2007,21:31You must realize that different distributions are tailored to their different ways... and what can be what you call a standard may not be one in another.
I think mpg123 is included in DSL... you could try that.
Or else if you looked hard enough, there is a mydsl extension for it under uci. It can be hard to search sometimes... I sometimes use a search on the web pages, or use a search engine, or even a manual grep. If you don't want to do that, just make sure you also look under the uci and unc sections.
Posted by mikshaw on Oct. 02 2007,23:51"play" is part of sox, which is not included with DSL.
It is available as a uci extension in the mydsl repository.
Since the executables (sox, soxmix, play and rec) are not added to PATH in a uci, you will need to use the full path to it, or create an alias (alias play=/opt/sox/play), or add /opt/sox to your PATH variable
Posted by wavetel on Oct. 03 2007,09:19Yep .. Ive found sox .. Did a bit of searching to find out where play comes from. Along with rec and also some bits of the lame encoder by the looks and you have sox .. Problem is that adds another 500k to the mydsl Exts .. I am trying to keep it light weight .. The binary for play is only about 6k and all I need is play frankly..
Is there any issue with just grabbing the play binary and including that in one of my Exts along with the sound files?? I have no need of sox ..
Also if the binary is so system specific then how can sox possibly work like that as its a precompiled tar.gz ..
Also why does play appear on a USB install and not on a CD boot.. The USB install just copies the image file across from the CD and makes it bootable.. There must be something more going on there however I can take a USB installed system and run it on several different machines and find that play works fine.. They all have radically different sound cards etc ..
Sorry cant buy some of the explanations as yet..
Posted by ^thehatsrule^ on Oct. 03 2007,13:31afaik `play` is just a wrapper script that invokes sox. You could try my first suggestion as well...
You probably have the extension saved on your USB so it gets automatically loaded.
Posted by mikshaw on Oct. 03 2007,13:34
First, the only actual executables are "sox" and "soxmix". The play and rec commands are simply a shell script and a link that run the sox command using specific parameters. The actual command is much larger than 6k.
Second, the application was linked to libmp3lame, which is also not a part of DSL. This strengthens the need for the play script, as that script sets up LD_LIBRARY_PATH to include the libmp3lame directory.
Third, the application cannot legally be distributed without also including the license file(s).
So ultimately, your only options in reducing the size of the package are removing only the soxmix executable and help files, or recompiling the application without mp3 support. The minimum files required to use play in this case, in a new extension, are the play script, the non-mp3 sox executable, and the license files.
Posted by wavetel on Oct. 03 2007,14:30
Nope NO Extensions saved on the USB stick at all.. Try it .. Boot from a DSL CD and open a command line and type "play" .. Its not there anywhere ..
Now install to a USB stick and dont install any exts or anything extra .. Boot that USB stick up and open a console and type "play" again.. Hey now its there .. Ive done this with DSL v2 3 and 4 .. I thought a USB install was just a CD image across to a bootable USB stick but there is something else going on there.. I dont understand it as yet.. You will find play at /usr/bin/play on a USB install from memory.
I have not tried sox as yet but I am pretty sure it will make the command line play work if I load it on a CD booted system.
Looking at the actual extension it seems to be about 500k and contains something that looks like it belongs to the lame library. This lame stuff would appear to be the largest part of the ext with the play binary being about 6k ..
When I say I cant BUY some of the explanations as yet.
This comment from thehatsrule is what I cant get a grip on.
"You must realize that different distributions are tailored to their different ways... and what can be what you call a standard may not be one in another."
I mean that Ive found a sox mydsl app thats in the multimedia group and its just a tar.gz precompiled binary. Yes Ive since found one thats a UCI as well that appears to be a later version. That might be a bit different but the tar.gz can not be a system specific thing. Its just a binary that runs on DSL regardless of system one would think ..
I should go and find mpg123 as well I guess.. Will have to fiddle with some of this stuff.. Ive copied the play binary off a USB install and will try and run that raw on a CD bootup for laughs.. I suspect the sox.tar.gz may be safer but I suspect its got the dependancy on that libmp3lame.so.0 file which is some 315k in itself.
Maybee the problem is with having it on a live distro CD.. The lame mp3 encoder I mean.. Maybee your not allowed to redistribute that under GPL or whatever licence scheme ..
Thanks for the pointers.
Will post any further findings on here as an update..
Posted by curaga on Oct. 03 2007,18:27I think mpg123 only plays mp1/2/3 files. How about some another console wav player?
With alsa I've used aplay, but there must be many small ones for OSS too. How about bplay? The source is only 18k...
Posted by mikshaw on Oct. 03 2007,19:12
I still do not believe the "play" executable is available in any DSL release, regardless of how it may appear to you. There must be some other explanation.
Posted by ^thehatsrule^ on Oct. 03 2007,22:21
ah my bad... I always forget which one is which
The man page says it can write to .wav's but doesn't say about playing them...
Posted by wavetel on Oct. 04 2007,00:19Ive not been able to play a wav file as yet with mpg123 mpg321 .. It says its decoding but nothing plays from the speakers.. The output device is libao by defualt but whats that ?? Too many ambigiuos arguments on the help texts to make any sense .. Why cant I just go with "mpg123 mywavfile.wav" ??
I need a light weight player from the command line that just plays wavs and finds the sound system by itself so it can be used in a DSL package that should run on most if not all systems..
I dont care for MP3s frankly in this case.. By the time a old system machine has managed to uncompress and play a MP3 file the reason for the sound event is lost or its killed the system with overheads and lame encoders..
Still can not figure out where the play binary has come from on the USB install .. Will have to look at that too .. This whole thing is rather interesting as well as solving a problem its become an education..
Posted by mikshaw on Oct. 04 2007,02:08mpg321 can write to a wav file, but that does not mean it can take a wav as input. I'm guessing that the wav output is available because a decompressed mp3 is essentially the same as a wav, so writing the decompressed data to a file is a trivial matter. Maybe adding the code to play a wav directly was more than the developers wanted to bother with?
sox is a pretty feature-rich application designed to play/modify/convert multiple formats, so I guess that would mean a relatively large size for a commandline program. If you want a tiny program that only plays wav files, I'd recommend wavplay, or bplay as curaga suggested.
Posted by wavetel on Oct. 06 2007,14:30
Well Ive figured alot of things out.. First off I was dead wrong about the Play binary appearing on the USB install .. It did creep into the system via a DSL ext that I never expected it to be in. That explains that one. I looked deep into the ext and found it there. Just assuming you know everything thats in the ext is a trap.
I grabbed the deb file for bplay and made a bplay.dsl ext and that works well. Problem solved I guess. The bplay ext turns out to be about 9k as compared to the sox ext at 477k or so.
Thanks for your guidance and input folks.
Posted by ^thehatsrule^ on Oct. 06 2007,18:46If you think the extension might help others, please consider submitting it to email@example.com
All you need to do is to make a .md5 and .info
Posted by wavetel on Oct. 10 2007,13:15
I posted the extension off a couple of days ago but nothing as yet on the testing area. Made a md5 and info file up and posted them as 3 separate attachments. There isnt much info on exactly how they want it submitted so maybee they dont like it or just think its too insignificant. Who knows.
Posted by ^thehatsrule^ on Oct. 10 2007,14:41I think I usually give it a week or so... but it could've been eaten up by spam filters :P
I think one of the things to help prevent that was to include "dsl" in the subject header.
But for now, I'd just wait it out.
You could also upload them somewhere and post links in the extension threads as an alternative.
Posted by roberts on Oct. 10 2007,16:33
Just checked in the inbox and nothing is pending. It is likely the spam filters swallowed it.
I get hundreds of emails a day on this account and almost everyone has an attachment.
Please re-send and indicate in the subject line that it is a DSL extension.