sox unable to capture audio when running the command from a binary

Matias Montenegro <[email protected]> Thu, 9 Dec 2021 11:32:36 -0300
Newsgroups gmane.comp.audio.sox
Message-ID <CAK6vHTBD_ngsVK=TfEcy_ffz0NLvT3u6b+yViHW7d19SYgqsXA@mail.gmail.com>
Hey there!

I'm having an issue, I'm using sox to capture audio from "Soundflower
(2ch)" , calling the sox command from node.js using child_process.
See the code in this repository:
https://github.com/matiasmm/test-audio/blob/main/main.js#L36-L39

It works fine if I run `yarn start`, which runs the app in develop mode.
The audio gets captured correctly.

The problem is when I build the app `yarn package`.  This command,
will make the app installable, It creates a `.dmg` file, which I can
install, bundling node.js inside... after installing it and running the
app, I can see sox executing with no errors. outputting data, but this data
is empty.  The audio is totally empty.
I've been playing a bit with it, to make sure AUDIODEV variable was getting
set correctly (which it is, since I could print it).

In other words, the sox command I use is the same in both environments, but
one produces a correct audio output while the other an empty audio output.

```
AUDIODEV="Soundflower (2ch)" /usr/local/bin/sox  --default-device
--no-show-progress --rate 16000 --channels 1 --encoding signed-integer
--bits 16 --type wav -
```

I've really made sure it's using the same env variables, at least AUDIODEV.
There must be something else I'm missing, that is different for each
environment. I really don't know sox internals, so what could it be?  or
how can I debug this?

Thanks!

I'm working on MAC,
installed sox through homebrew.



-- 
Matias M. Montenegro ツ

_______________________________________________
Sox-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sox-users