On Mon, Jan 13, 2014 at 4:02 PM, Ron S. <lists / ruby-forum.com> wrote:
> This may seem crazy, but I am hoping to use Ruby as the source of a
> rather long chain of tools. I want to use Ruby to generate a shell
> script to run a long (LONG) series of commands for SoX. SoX is a general
> purpose command line audio manipulation tool with some awesome, powerful
> features. The chain would be:
>
> Ruby > shell script > SoX
>
> Come to think of it... I might be able to dispense with the shell script
> step, right? Ruby can sort of pop out and run a command in the shell and
> then pop back in. Sorry for the technical terms... Ha!
>
> SoX has all kinds of commands like:
>
>     $ sox -n output.wav synth 9600s sine 123.471 fade 48s 9600s 9552s
>
> What this does is generate an audio sine wave (the note is a B) and run
> it through a fade, which is a little envelope generator (a volume
> control). If all you want to do is have something very simple like that,
> then it's easy enough to run off the command line. But of course, to
> make music, one needs to generate hundreds, or even thousands or tens of
> thousands of these commands and then mix them and move them and combine
> them. SoX can do all of this, but it gets ridiculous.
>
> I want to generate the SoX commands in Ruby. This is a thing that people
> do, right? The shell simply doesn't have the capability to handle all
> the variables easily (and no interesting stuff like random numbers, and
> so on). I think Ruby is appropriate for this.

I'm not sure what your question is, but yes, Ruby can be used to
generate and drive the execution of arbitrary commands, or to generate
intermediate shell scripts or everything in between. There might even
be a gem for using SoX from Ruby [... google, google, google...].
Here:

https://github.com/afhbl/rsox

If you have any specific question, let us know.

Jesus.