Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>No idea without getting more familiar than I'd prefer with your SoX...</p> <p>However, I'd try this:</p> <p>As a test, use a single .wav file</p> <pre><code>for /r %%n in (justone.wav) do ( START "Left" C:\sox\sox.exe %%n -c 1 %%n.left.flac remix 1 START "Right" C:\sox\sox.exe %%n -c 2 %%n.right.flac remix 2) </code></pre> <p>And perhaps it'll run two instances simultaneously on a multi-processor machine. (Window title is "Left" or "Right")</p> <p>Now - if this works, then try</p> <pre><code>@ECHO OFF SETLOCAL for /r %%n in (*.wav) do CALL :runsox "%%n" GOTO :eof :runsox CALL :wait START "%~1.left" C:\sox\sox.exe %~1 -c 1 %~1.left.flac remix 1 CALL :wait START "%~1.right" C:\sox\sox.exe %~1 -c 2 %~1.right.flac remix 2 GOTO :eof :wait FOR /f %%c IN ('tasklist^|find /i /c "sox.exe"') DO SET running=%%c IF %running% GEQ 6 timeout /t 5 &gt;nul&amp;GOTO wait GOTO :eof </code></pre> <p>What this will do is execute the <code>:runsox</code> procedure for each <code>.wav</code> encountered, passing the .wav` name.</p> <p>The <code>runsox</code> procedure will call the <code>wait</code> procedure - which I'll come to. When the <code>WAIT</code> is finished, it'll put on the left sox, then wait again and put on the right, then return for the next filename until all's done. The <code>%~1</code> in the names means 'the first parameter given to this routine, minus any enclosing quotes` - and that's the filename (%%n) provided by the CALL.</p> <p>the <code>wait</code> procedure finds out how many <code>SOX.EXE</code> instances are running by passing a list of tasks from <code>tasklist</code> through a <code>find</code> filter to find the string <code>sox.exe</code> <code>/i</code> means regardless of case and <code>/c</code> means output a count.</p> <p><code>Running</code> therefore acquires a count of the instances of <code>SOX</code> in progress. If that is greater than or equal to 6 (an arbitrary number - choose it to suit yourself. Best to leave one or two processors for other tasks, so 6 id good for an 8-processor machine) then a timeout of 5 seconds is executed and after 5 seconds the tasklist is examined again. When there are fewer than 6 instances, the <code>wait</code> procedure exits and the next task is started.</p> <p>So - the <code>WAIT</code> procedure waits until there are fewer than 6 SOX instances.</p> <p>Change the 6 to suit your machinery and the 5 your aesthetics.</p> <p>Edit: remove legacy closing-parenthesis</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload