sox-users@lists.sourceforge.net unofficial mirror
 help / color / Atom feed
* What´s wrong with my batch script?
@ 2017-09-22 23:26 AE Photos02
  2017-09-23 14:10 ` Jeremy Nicoll - ml sox users
  0 siblings, 1 reply; 6+ messages in thread
From: AE Photos02 @ 2017-09-22 23:26 UTC (permalink / raw)
  To: sox-users

[-- Attachment #1.1: Type: text/plain, Size: 1117 bytes --]

Hello everyone.

I am making a script that is supposed to mix together 2 separate versions
of the same files. So far so good. Now it has to be able to do this in a
batch of all files in one folder, to an output file, a mixed file.

The idea is to have samples called *sweep1.wav be combined with the files
called *sweep2.wav. So far my script is combining *only* one specific *"sweep1"
file*, the last in my list *(which is number 3)*, with one the correct
"sweep2" file.


*Here´s the script so far:*

-------------------------

for file in ./*sweep1*

do

for file2 in ./*sweep2*

    do

        out=COMBINED

        sox -V4 -m -v 1 $file -v 1 $file2 $file-$out.wav

    done

done

--------------------------


As you may see I have put -v 1 in front of both of the files. If I do not,
the two files will be mixed with a linear gain of 0.5, I guess half of its
linear gain value.

Hope someone can see my error here. The output should be the combination of
the two first files with the same file name tokens. The method is "mix",
-m.


-- 
Best regards
Kristopher

[-- Attachment #1.2: Type: text/html, Size: 2168 bytes --]

<div dir="ltr">Hello everyone. <div><br></div><div>I am making a script that is supposed to mix together 2 separate versions of the same files. So far so good. Now it has to be able to do this in a batch of all files in one folder, to an output file, a mixed file. </div><div><br></div><div>The idea is to have samples called *sweep1.wav be combined with the files called *sweep2.wav. So far my script is combining <b>only</b> one specific <b>&quot;sweep1&quot; file</b>, the last in my list <i>(which is number 3)</i>, with one the correct &quot;sweep2&quot; file. <br><br></div><div><br></div><div><b><u>Here´s the script so far:</u></b></div><div><br></div><div>-------------------------</div><div>







<p class="gmail-p1"><span class="gmail-s1">for file in ./*sweep1*</span></p>
<p class="gmail-p1"><span class="gmail-s1">do</span></p>
<p class="gmail-p1"><span class="gmail-s1"><span class="gmail-Apple-tab-span">	</span>for file2 in ./*sweep2*</span></p>
<p class="gmail-p1"><span class="gmail-s1"><span class="gmail-Apple-converted-space">    </span>do</span></p>
<p class="gmail-p1"><span class="gmail-s1"><span class="gmail-Apple-converted-space">        </span>out=COMBINED</span></p>
<p class="gmail-p1"><span class="gmail-s1"><span class="gmail-Apple-converted-space">        </span>sox -V4 -m -v 1 $file -v 1 $file2 $file-$out.wav</span></p>
<p class="gmail-p1"><span class="gmail-s1"><span class="gmail-Apple-converted-space">    </span>done</span></p>
<p class="gmail-p1"><span class="gmail-s1">done</span></p><p class="gmail-p1">--------------------------</p><p class="gmail-p1"><br>As you may see I have put -v 1 in front of both of the files. If I do not, the two files will be mixed with a linear gain of 0.5, I guess half of its linear gain value. <br></p><p class="gmail-p1">Hope someone can see my error here. The output should be the combination of the two first files with the same file name tokens. The method is &quot;mix&quot;, -m. </p><p class="gmail-p1"><br></p></div><div>-- <br><div class="gmail_signature"><div dir="ltr">Best regards<br>Kristopher</div><div dir="ltr"><br></div></div>
</div></div>

[-- Attachment #2: Type: text/plain, Size: 202 bytes --]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: What´s wrong with my batch script?
  2017-09-22 23:26 What´s wrong with my batch script? AE Photos02
@ 2017-09-23 14:10 ` Jeremy Nicoll - ml sox users
  2017-09-23 14:27   ` Jan Stary
  0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Nicoll - ml sox users @ 2017-09-23 14:10 UTC (permalink / raw)
  To: sox-users

On 2017-09-23 00:26, AE Photos02 wrote:
> Hello everyone.
> 
> I am making a script that is supposed to mix together 2 separate 
> versions
> of the same files. So far so good. Now it has to be able to do this in 
> a
> batch of all files in one folder, to an output file, a mixed file.
> 
> The idea is to have samples called *sweep1.wav be combined with the 
> files
> called *sweep2.wav. So far my script is combining *only* one specific 
> *"sweep1"
> file*, the last in my list *(which is number 3)*, with one the correct
> "sweep2" file.
> 
> 
> *Here´s the script so far:*
> 
> -------------------------
> 
> for file in ./*sweep1*
> 
> do
> 
> for file2 in ./*sweep2*
> 
>     do
> 
>         out=COMBINED
> 
>         sox -V4 -m -v 1 $file -v 1 $file2 $file-$out.wav
> 
>     done
> 
> done
> 
> --------------------------
> 
> 
> As you may see I have put -v 1 in front of both of the files. If I do 
> not,
> the two files will be mixed with a linear gain of 0.5, I guess half of 
> its
> linear gain value.
> 
> Hope someone can see my error here. The output should be the 
> combination of
> the two first files with the same file name tokens. The method is 
> "mix",
> -m.

Change the script so that instead of

    sox -V4 -m -v 1 $file -v 1 $file2 $file-$out.wav

it issues

    echo sox -V4 -m -v 1 $file -v 1 $file2 $file-$out.wav

(if that's appropriate for the script language concerned) and find out 
what the
set of sox commands it actually issues are.  If it only issues one 
command then
you need to fix the script - not a sox problem.

Is it by any chance seeing the combined file (whose name will start with 
$file)
as one of the files seen by the outer loop?  Maybe it would be better to 
put the
new files in a different folder.


-- 
Jeremy Nicoll - my opinions are my own

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: What´s wrong with my batch script?
  2017-09-23 14:10 ` Jeremy Nicoll - ml sox users
@ 2017-09-23 14:27   ` Jan Stary
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Stary @ 2017-09-23 14:27 UTC (permalink / raw)
  To: sox-users

On Sep 23 15:10:34, jn.ml.sxu.88@wingsandbeaks.org.uk wrote:
> On 2017-09-23 00:26, AE Photos02 wrote:
> > Hello everyone.
> > 
> > I am making a script that is supposed to mix together 2 separate
> > versions
> > of the same files. So far so good. Now it has to be able to do this in a
> > batch of all files in one folder, to an output file, a mixed file.
> > 
> > The idea is to have samples called *sweep1.wav be combined with the
> > files
> > called *sweep2.wav. So far my script is combining *only* one specific
> > *"sweep1"
> > file*, the last in my list *(which is number 3)*, with one the correct
> > "sweep2" file.
> > 
> > 
> > *Here´s the script so far:*
> > 
> > -------------------------
> > 
> > for file in ./*sweep1*
> > 
> > do
> > 
> > for file2 in ./*sweep2*
> > 
> >     do
> > 
> >         out=COMBINED
> > 
> >         sox -V4 -m -v 1 $file -v 1 $file2 $file-$out.wav
> > 
> >     done
> > 
> > done
> > 
> > --------------------------

This is most probably a shell scripting problem
which has nothing to do with SoX.

> > for file in ./*sweep1*
> > do
> > for file2 in ./*sweep2*

You are combining every *sweep1* file with every *sweep2* file,
overwriting the output over and over again. Of course the last wins.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: What´s wrong with my batch script?
  2017-09-24 19:04 ` Jeremy Nicoll - ml sox users
@ 2017-09-25 21:14   ` AE Photos02
  0 siblings, 0 replies; 6+ messages in thread
From: AE Photos02 @ 2017-09-25 21:14 UTC (permalink / raw)
  To: Sox-Users

[-- Attachment #1.1: Type: text/plain, Size: 1456 bytes --]

Thanks for your help. I looked into sox now but the issue seems to be in
the for loop in bash. I am getting help on stackexchange for that, lots of
folks to help out.

Thanks again!

On Sun, Sep 24, 2017 at 9:04 PM, Jeremy Nicoll - ml sox users <
jn.ml.sxu.88@wingsandbeaks.org.uk> wrote:

> On 2017-09-24 18:21, AE Photos02 wrote:
>
>> Okay. I see. I'm doing it on a Mac with bash in terminal. Do I need to
>> do a "for each" and an "echo" or something? Or perhaps specify the
>> thing more? I'm new to bash and Sox.
>>
>
> You need to find out what commands the script is issuing. Using echo
> might help.
>
> I have never used bash so I have no idea precisely what is happening.
>
> Maybe just one sox command is being issued, processing all the files at
> once.
>
> Maybe multiple sox commands are being issued but are also processing as
> input the files produced by previous sox commands.  I can't tell.  But
> a good start would be to see what the for loops are actually doing.
>
> --
> Jeremy Nicoll - my opinions are my own
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Sox-users mailing list
> Sox-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-users
>



-- 
Best regards
Kristopher
AE Photos

[-- Attachment #1.2: Type: text/html, Size: 2521 bytes --]

<div dir="ltr">Thanks for your help. I looked into sox now but the issue seems to be in the for loop in bash. I am getting help on stackexchange for that, lots of folks to help out. <div><br></div><div>Thanks again!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Sep 24, 2017 at 9:04 PM, Jeremy Nicoll - ml sox users <span dir="ltr">&lt;<a href="mailto:jn.ml.sxu.88@wingsandbeaks.org.uk" target="_blank">jn.ml.sxu.88@wingsandbeaks.org.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 2017-09-24 18:21, AE Photos02 wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Okay. I see. I&#39;m doing it on a Mac with bash in terminal. Do I need to<br>
do a &quot;for each&quot; and an &quot;echo&quot; or something? Or perhaps specify the<br>
thing more? I&#39;m new to bash and Sox.<br>
</blockquote>
<br></span>
You need to find out what commands the script is issuing. Using echo<br>
might help.<br>
<br>
I have never used bash so I have no idea precisely what is happening.<br>
<br>
Maybe just one sox command is being issued, processing all the files at<br>
once.<br>
<br>
Maybe multiple sox commands are being issued but are also processing as<br>
input the files produced by previous sox commands.  I can&#39;t tell.  But<br>
a good start would be to see what the for loops are actually doing.<span class="im HOEnZb"><br>
<br>
-- <br>
Jeremy Nicoll - my opinions are my own<br>
<br></span><div class="HOEnZb"><div class="h5">
------------------------------<wbr>------------------------------<wbr>------------------<br>
Check out the vibrant tech community on one of the world&#39;s most<br>
engaging tech sites, Slashdot.org! <a href="http://sdm.link/slashdot" rel="noreferrer" target="_blank">http://sdm.link/slashdot</a><br>
______________________________<wbr>_________________<br>
Sox-users mailing list<br>
<a href="mailto:Sox-users@lists.sourceforge.net" target="_blank">Sox-users@lists.sourceforge.ne<wbr>t</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/sox-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/<wbr>lists/listinfo/sox-users</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Best regards<br>Kristopher<br>AE Photos<br></div></div>
</div>

[-- Attachment #2: Type: text/plain, Size: 202 bytes --]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: What´s wrong with my batch script?
  2017-09-24 17:21 AE Photos02
@ 2017-09-24 19:04 ` Jeremy Nicoll - ml sox users
  2017-09-25 21:14   ` AE Photos02
  0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Nicoll - ml sox users @ 2017-09-24 19:04 UTC (permalink / raw)
  To: sox-users

On 2017-09-24 18:21, AE Photos02 wrote:
> Okay. I see. I'm doing it on a Mac with bash in terminal. Do I need to
> do a "for each" and an "echo" or something? Or perhaps specify the
> thing more? I'm new to bash and Sox.

You need to find out what commands the script is issuing. Using echo
might help.

I have never used bash so I have no idea precisely what is happening.

Maybe just one sox command is being issued, processing all the files at
once.

Maybe multiple sox commands are being issued but are also processing as
input the files produced by previous sox commands.  I can't tell.  But
a good start would be to see what the for loops are actually doing.

-- 
Jeremy Nicoll - my opinions are my own

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: What´s wrong with my batch script?
@ 2017-09-24 17:21 AE Photos02
  2017-09-24 19:04 ` Jeremy Nicoll - ml sox users
  0 siblings, 1 reply; 6+ messages in thread
From: AE Photos02 @ 2017-09-24 17:21 UTC (permalink / raw)
  To: Sox-Users

[-- Attachment #1.1: Type: text/plain, Size: 2092 bytes --]

  
  

 Okay. I see. I'm doing it on a Mac with bash in terminal. Do I need to do a "for each" and an "echo" or something? Or perhaps specify the thing more? I'm new to bash and Sox.   
  

  
Thanks for any help!   
  

  
  

  
  
>   
> On Sep 23, 2017 at 4:27 PM,  <Jan Stary (mailto:hans@stare.cz)>  wrote:
>   
>   
>   
>  On Sep 23 15:10:34, jn.ml.sxu.88@wingsandbeaks.org.uk wrote:  >  On 2017-09-23 00:26, AE Photos02 wrote:  >   >  Hello everyone.  >   >   >   >  I am making a script that is supposed to mix together 2 separate  >   >  versions  >   >  of the same files. So far so good. Now it has to be able to do this in a  >   >  batch of all files in one folder, to an output file, a mixed file.  >   >   >   >  The idea is to have samples called *sweep1.wav be combined with the  >   >  files  >   >  called *sweep2.wav. So far my script is combining *only* one specific  >   >  *"sweep1"  >   >  file*, the last in my list *(which is number 3)*, with one the correct  >   >  "sweep2" file.  >   >   >   >   >   >  *Here´s the script so far:*  >   >   >   >  -------------------------  >   >   >   >  for file in ./*sweep1*  >   >   >   >  do  >   >   >   >  for file2 in ./*sweep2*  >   >   >   >  do  >   >   >   >  out=COMBINED  >   >   >   >  sox -V4 -m -v 1 $file -v 1 $file2 $file-$out.wav  >   >   >   >  done  >   >   >   >  done  >   >   >   >  -------------------------- This is most probably a shell scripting problem which has nothing to do with SoX.  >   >  for file in ./*sweep1*  >   >  do  >   >  for file2 in ./*sweep2* You are combining every *sweep1* file with every *sweep2* file, overwriting the output over and over again. Of course the last wins. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Sox-users mailing list Sox-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sox-users  
>
>   
  
  
 

[-- Attachment #1.2: Type: text/html, Size: 2554 bytes --]

<html><body><div id="edo-message"><div></div>Okay. I see. I'm doing it on a Mac with bash in terminal. Do I need to do a "for each" and an "echo" or something? Or perhaps specify the thing more? I'm new to bash and Sox.&nbsp;</div><div id="edo-message"><br></div><div id="edo-message">Thanks for any help!&nbsp;</div><div id="edo-meta"></div><div id="edo-original"><div><br><br><blockquote type="cite" style="margin:1ex 0 0 0;border-left:1px #ccc solid;padding-left:0.5ex;"><div>On Sep 23, 2017 at 4:27 PM, &lt;<a href="mailto:hans@stare.cz">Jan Stary</a>&gt; wrote:<br><br></div><div><pre>On Sep 23 15:10:34, jn.ml.sxu.88@wingsandbeaks.org.uk wrote:
&gt; On 2017-09-23 00:26, AE Photos02 wrote:
&gt; &gt; Hello everyone.
&gt; &gt;  
&gt; &gt; I am making a script that is supposed to mix together 2 separate
&gt; &gt; versions
&gt; &gt; of the same files. So far so good. Now it has to be able to do this in a
&gt; &gt; batch of all files in one folder, to an output file, a mixed file.
&gt; &gt;  
&gt; &gt; The idea is to have samples called *sweep1.wav be combined with the
&gt; &gt; files
&gt; &gt; called *sweep2.wav. So far my script is combining *only* one specific
&gt; &gt; *"sweep1"
&gt; &gt; file*, the last in my list *(which is number 3)*, with one the correct
&gt; &gt; "sweep2" file.
&gt; &gt;  
&gt; &gt;  
&gt; &gt; *Here´s the script so far:*
&gt; &gt;  
&gt; &gt; -------------------------
&gt; &gt;  
&gt; &gt; for file in ./*sweep1*
&gt; &gt;  
&gt; &gt; do
&gt; &gt;  
&gt; &gt; for file2 in ./*sweep2*
&gt; &gt;  
&gt; &gt;     do
&gt; &gt;  
&gt; &gt;         out=COMBINED
&gt; &gt;  
&gt; &gt;         sox -V4 -m -v 1 $file -v 1 $file2 $file-$out.wav
&gt; &gt;  
&gt; &gt;     done
&gt; &gt;  
&gt; &gt; done
&gt; &gt;  
&gt; &gt; --------------------------

This is most probably a shell scripting problem
which has nothing to do with SoX.

&gt; &gt; for file in ./*sweep1*
&gt; &gt; do
&gt; &gt; for file2 in ./*sweep2*

You are combining every *sweep1* file with every *sweep2* file,
overwriting the output over and over again. Of course the last wins.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users
</pre></div></blockquote></div></div></body></html>

[-- Attachment #2: Type: text/plain, Size: 202 bytes --]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-22 23:26 What´s wrong with my batch script? AE Photos02
2017-09-23 14:10 ` Jeremy Nicoll - ml sox users
2017-09-23 14:27   ` Jan Stary
2017-09-24 17:21 AE Photos02
2017-09-24 19:04 ` Jeremy Nicoll - ml sox users
2017-09-25 21:14   ` AE Photos02

sox-users@lists.sourceforge.net unofficial mirror

Archives are clonable: git clone --mirror https://public-inbox.org/sox-users

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.sox
	nntp://ou63pmih66umazou.onion/inbox.comp.audio.sox
	nntp://news.gmane.org/gmane.comp.audio.sox

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox