sox-users@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
From: Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk>
To: sox-users@lists.sourceforge.net
Subject: Re: Basic questions on SoX for Mac OS
Date: Tue, 24 Dec 2019 12:51:09 +0000	[thread overview]
Message-ID: <e15b72ac97032afdcbc3c9744f4ee7ce@wingsandbeaks.org.uk> (raw)
In-Reply-To: <CADOF_p_vuNZuwtCXEmogDcgD1q88gbrHmAkHo=3dLT-kuW_+sA@mail.gmail.com>

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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

  parent reply	other threads:[~2019-12-24 12:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-23 16:29 Basic questions on SoX for Mac OS Matthew Mitcheltree
2019-12-23 16:45 ` Graff, David E
2019-12-24 12:51 ` Jeremy Nicoll - ml sox users [this message]
2019-12-27 21:45   ` Matt Mitcheltree

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-users

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e15b72ac97032afdcbc3c9744f4ee7ce@wingsandbeaks.org.uk \
    --to=sox-users@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).