This is more of a discovery than a bug and for OSX 10.12.x, maybe earlier but I don't have them now.
Consider this code:-
# Auto-find the correct path and "sox" file, but it WILL take a very long time...
# NOTE: It searches from YOUR HOME directory structure only, just modify to suit your machine if 'SOX' is elsewhere.
capturepath=$(find "$HOME" -name 'sox' 2>/dev/null)
This works perfectly with a virgin install of SOX, (in this case inside my $HOME directory).
I decided to install the latest version of SOX 14.4.2.
I then placed the original into the "Trash", that is "$HOME"/.Trash/ directory.
Next I launched "./AudioScope.sh" and as expected DEMO worked perfectly.
THEN; I decided to run the SOX command inside the code and the code literally crashed out.
The error report pointed to "$HOME/.Trash/sox-14.4.0/sox" so it looks as though the 'find' command searches the "$HOME"/.Trash/ directory also.
Unlike the AMIGA, OSX cannot run code from inside its Trashcan hence the total crashout.
So let this be a warning to others if you have a previous version of something in the Trashcan and another version elsewhere and you intend to find it using the 'find' command then EXPECT a bug as "$HOME"/.Trash/ is searched early in the scan.