Re: Basic questions on SoX for Mac OS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2019-12-23 16:29, Matthew Mitcheltree wrote:

I copied the input.dat file to Downloads > sox-14.4.2 as well.
So when I launch terminal, navigate there, and enter "sox input.dat
output.wav," I get the error:

-bash: sox: command not found



So, maybe I need to install SoX

I don't think so.  But when you issue a command in the terminal, the
command's executable either needs to be in one of the directories that
the OS always looks in, when looking for executables, or you explicitly
need to tell the OS where the program is.

So in simple tutorials about using terminal (which you can find by
googling for 'mac terminal') you'll see examples of using eg  ls
to list the contents of a directory, mv  to move files etc... but
'ls' and 'mv' are part of the Mac OS and it already knows how to
find those.

How?  They're in directories which are defined/listed on something
called PATH.

So, one solution would be to add the Downloads\sox-14.4.2
directory to PATH, so the OS would always look in there when looking
for any executable to run.

I don't know if that's a good idea though.  If you did that with all
the command-line programs you download, PATH would be long, and you'd
need to keep changing it as you installed or replaced utilities.  Still,
it's possible.  See eg:

http://osxdaily.com/2014/08/14/add-new-path-to-path-command-line/



Or, having navigated to the directory that contains the sox executable
you should issue a command like:

   ./sox input.dat output.wav

That explicitly tells the OS to run the program it'll find at "./sox"
that is, in the current directory.  (Dot means 'current directory' so
"./abc" means file abc in the current directory.)


Some people, I think, explicitly set up PATH so the OS will always
look in the current directory (which obviously varies as you navigate
around), as well as fixed places (where system commands live), but
that also may not be a great idea.  It's discussed in

https://en.wikipedia.org/wiki/PATH_(variable)


Another possibility is that rather than navigating to the directory
which contains the sox executable, so you don't bother navigating
to it, but instead always say in the command you're issuing where
(in absolute/explicit terms) the sox executable is.   So instead of

   sox input...

you'd issue eg

   ~\Downloads\sox-14.4.2\sox input ...

(or something.  I'm not precisely sure of what the full path to a Mac
Downloads directory is).


There will be ways (in bash for example) of predefining a shorthand
'alias' for commands so you might be able eg to define 'mysox' as
'~\Downloads\sox-14.4.2\sox' and then issue

  mysox input...

from any terminal window without first navigating to the sox directory.
See eg:
https://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html



... so I wonder whether a "SoX guide for command-line beginners"
would be a welcome addition to the program documentation?

None of this is specific to sox; it applies to every command-line
program.

The approach you take wil depend on what you think suits you best,
for all command-line programs.



On Windows, I adopt the approach of always putting the full path to
sox (or any other utility program I use) into the command.  It means
I can have different versions of the command-line programs installed
and always know which one I'm using.

--
Jeremy Nicoll - my opinions are my own


_______________________________________________
Sox-users mailing list
Sox-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sox-users



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux