* Help with --combine merge
@ 2023-10-15 13:27 Ulf A. S. Holbrook via Sox-users
2023-10-15 20:39 ` Jeremy Nicoll - ml sox users
2023-10-16 10:44 ` Jan Stary
0 siblings, 2 replies; 7+ messages in thread
From: Ulf A. S. Holbrook via Sox-users @ 2023-10-15 13:27 UTC (permalink / raw)
To: sox-users; +Cc: Ulf A. S. Holbrook
Hello!
I'm trying to combine a large amount of files into one single file and
wondered if someone could lend a hand. I have individual folders of 90
1-minute files in .wav and want to merge them into one 90-channel file.
I'm running
for file in /dir
do
sox --combine merge *.WAV >> merged.wav
done
I'm getting some unexpected behaviour, it creates the file "merged.wav"
but does not write anything into it. It is the last file in the list
where all the files are combined, overwriting the contents of that file,
as it becomes a 89 channel file and not 90.
Could anyone help me shed some light on what I'm doing wrong?
/u.
--
/*
Ulf A. S. Holbrook
post@u-l-v.org
http://www.u-l-v.org/
+47 99569230
*/
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help with --combine merge
2023-10-15 13:27 Help with --combine merge Ulf A. S. Holbrook via Sox-users
@ 2023-10-15 20:39 ` Jeremy Nicoll - ml sox users
2023-10-16 11:10 ` Ulf A. S. Holbrook via Sox-users
2023-10-16 10:44 ` Jan Stary
1 sibling, 1 reply; 7+ messages in thread
From: Jeremy Nicoll - ml sox users @ 2023-10-15 20:39 UTC (permalink / raw)
To: sox-users
On 2023-10-15 14:27, Ulf A. S. Holbrook via Sox-users wrote:
> Hello!
>
> I'm trying to combine a large amount of files into one single file and
> wondered if someone could lend a hand. I have individual folders of 90
> 1-minute files in .wav and want to merge them into one 90-channel file.
> I'm running
>
> for file in /dir
>
> do
>
> sox --combine merge *.WAV >> merged.wav
>
> done
I am guessing here ... and if that's a linux shell command I don't know
if
it evaluates *.WAV just once or more than once. It's also not clear to
me
if you delete merged.wav between experiments.
I've never seen an example sox command that uses redirection to place
output
in a result file, so wonder if what's (not) being written there is
progress
or error messages rather than audio data? Perhaps
sox --combine merge *.WAV merged.wav
or
sox --combine merge *.WAV \anotherdir\merged.wav
would work better.
It looks to me as if your code runs sox many times. Why not run it just
once reading all the input files in one operation?
If multiple runs ARE needed, does it work when the source directory only
contains one file? Or two files? Can you make a copy of the generated
file each time - NOT in the same directory, so there's no risk of it
being
matched by the "*.WAV" if that pattern is matched multiple times? - and
examine each run's output to see what it actually contains (eg with the
stats effect)?
--
Jeremy Nicoll - my opinions are my own
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help with --combine merge
2023-10-15 13:27 Help with --combine merge Ulf A. S. Holbrook via Sox-users
2023-10-15 20:39 ` Jeremy Nicoll - ml sox users
@ 2023-10-16 10:44 ` Jan Stary
2023-10-16 11:28 ` Ulf A. S. Holbrook via Sox-users
1 sibling, 1 reply; 7+ messages in thread
From: Jan Stary @ 2023-10-16 10:44 UTC (permalink / raw)
To: sox-users
On Oct 15 15:27:56, sox-users@lists.sourceforge.net wrote:
> I'm trying to combine a large amount of files into one single file and
> wondered if someone could lend a hand. I have individual folders of 90
> 1-minute files in .wav and want to merge them into one 90-channel file.
sox -M *.wav out.wav
> for file in /dir
> do
> sox --combine merge *.WAV >> merged.wav
> done
That doesn't make any sense.
> I'm getting some unexpected behaviour, it creates the file "merged.wav" but
> does not write anything into it. It is the last file in the list where all
> the files are combined, overwriting the contents of that file, as it becomes
> a 89 channel file and not 90.
Of course: sox --combine merge *.WAV
merges all the given files (arguments) into the last argument.
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help with --combine merge
2023-10-15 20:39 ` Jeremy Nicoll - ml sox users
@ 2023-10-16 11:10 ` Ulf A. S. Holbrook via Sox-users
2023-10-17 12:14 ` Jan Stary
0 siblings, 1 reply; 7+ messages in thread
From: Ulf A. S. Holbrook via Sox-users @ 2023-10-16 11:10 UTC (permalink / raw)
To: sox-users; +Cc: Ulf A. S. Holbrook
[-- Attachment #1.1: Type: text/plain, Size: 2307 bytes --]
I think you'd be on to something! The for-loop probably calls sox at
each loop and causes some issues.
However, if I run
sox --combine merge *.WAV merged.wav
or write to a different directory, it still merged everything into the
last file in the list /and /it creates a new file.
So, I have files labelled 1.wav ... 90.wav Each are 1 minute long. When
running the merge command, the last file in the list becomes the one
everything is merged into, and ends up having 89 channels and not 90.
The new merged.wav ends up being 8 seconds long, yet have 178 channels,
ie 89 x2. So somewhere along the line the loop is doubled, and I cannot
understand how.
/*
Ulf A. S. Holbrook
post@u-l-v.org
http://www.u-l-v.org/
+47 99569230
*/
On 15/10/2023 22:39, Jeremy Nicoll - ml sox users wrote:
> On 2023-10-15 14:27, Ulf A. S. Holbrook via Sox-users wrote:
>> Hello!
>>
>> I'm trying to combine a large amount of files into one single file
>> and wondered if someone could lend a hand. I have individual folders
>> of 90 1-minute files in .wav and want to merge them into one
>> 90-channel file. I'm running
>>
>> for file in /dir
>>
>> do
>>
>> sox --combine merge *.WAV >> merged.wav
>>
>> done
>
>
> I am guessing here ... and if that's a linux shell command I don't
> know if
> it evaluates *.WAV just once or more than once. It's also not clear
> to me
> if you delete merged.wav between experiments.
>
>
> I've never seen an example sox command that uses redirection to place
> output
> in a result file, so wonder if what's (not) being written there is
> progress
> or error messages rather than audio data? Perhaps
>
> sox --combine merge *.WAV merged.wav
>
> or
>
> sox --combine merge *.WAV \anotherdir\merged.wav
>
> would work better.
>
>
> It looks to me as if your code runs sox many times. Why not run it just
> once reading all the input files in one operation?
>
> If multiple runs ARE needed, does it work when the source directory only
> contains one file? Or two files? Can you make a copy of the generated
> file each time - NOT in the same directory, so there's no risk of it
> being
> matched by the "*.WAV" if that pattern is matched multiple times? - and
> examine each run's output to see what it actually contains (eg with the
> stats effect)?
>
>
>
[-- Attachment #1.2: Type: text/html, Size: 3617 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
[-- 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] 7+ messages in thread
* Re: Help with --combine merge
2023-10-16 10:44 ` Jan Stary
@ 2023-10-16 11:28 ` Ulf A. S. Holbrook via Sox-users
2023-10-17 12:05 ` Jan Stary
0 siblings, 1 reply; 7+ messages in thread
From: Ulf A. S. Holbrook via Sox-users @ 2023-10-16 11:28 UTC (permalink / raw)
To: sox-users; +Cc: Ulf A. S. Holbrook
You are correct.
But I can't understand why
sox -M *.WAV out.wav
would work when
sox --combine merge *.WAV merged.wav
won't?
/*
Ulf A. S. Holbrook
post@u-l-v.org
http://www.u-l-v.org/
+47 99569230
*/
On 16/10/2023 12:44, Jan Stary wrote:
> On Oct 15 15:27:56, sox-users@lists.sourceforge.net wrote:
>> I'm trying to combine a large amount of files into one single file and
>> wondered if someone could lend a hand. I have individual folders of 90
>> 1-minute files in .wav and want to merge them into one 90-channel file.
> sox -M *.wav out.wav
>
>> for file in /dir
>> do
>> sox --combine merge *.WAV >> merged.wav
>> done
> That doesn't make any sense.
>
>> I'm getting some unexpected behaviour, it creates the file "merged.wav" but
>> does not write anything into it. It is the last file in the list where all
>> the files are combined, overwriting the contents of that file, as it becomes
>> a 89 channel file and not 90.
> Of course: sox --combine merge *.WAV
> merges all the given files (arguments) into the last argument.
>
>
>
> _______________________________________________
> Sox-users mailing list
> Sox-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-users
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help with --combine merge
2023-10-16 11:28 ` Ulf A. S. Holbrook via Sox-users
@ 2023-10-17 12:05 ` Jan Stary
0 siblings, 0 replies; 7+ messages in thread
From: Jan Stary @ 2023-10-17 12:05 UTC (permalink / raw)
To: Ulf A. S. Holbrook via Sox-users
On Oct 16 13:28:13, sox-users@lists.sourceforge.net wrote:
> You are correct.
> But I can't understand why
> sox -M *.WAV out.wav
> would work when
> sox --combine merge *.WAV merged.wav
> won't?
But that's not what you are doing:
sox --combine merge *.WAV >> merged.wav
> On 16/10/2023 12:44, Jan Stary wrote:
> > On Oct 15 15:27:56, sox-users@lists.sourceforge.net wrote:
> > > I'm trying to combine a large amount of files into one single file and
> > > wondered if someone could lend a hand. I have individual folders of 90
> > > 1-minute files in .wav and want to merge them into one 90-channel file.
> > sox -M *.wav out.wav
> >
> > > for file in /dir
> > > do
> > > sox --combine merge *.WAV >> merged.wav
> > > done
> > That doesn't make any sense.
> >
> > > I'm getting some unexpected behaviour, it creates the file "merged.wav" but
> > > does not write anything into it. It is the last file in the list where all
> > > the files are combined, overwriting the contents of that file, as it becomes
> > > a 89 channel file and not 90.
> > Of course: sox --combine merge *.WAV
> > merges all the given files (arguments) into the last argument.
> >
> >
> >
> > _______________________________________________
> > Sox-users mailing list
> > Sox-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/sox-users
>
>
> _______________________________________________
> Sox-users mailing list
> Sox-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-users
>
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help with --combine merge
2023-10-16 11:10 ` Ulf A. S. Holbrook via Sox-users
@ 2023-10-17 12:14 ` Jan Stary
0 siblings, 0 replies; 7+ messages in thread
From: Jan Stary @ 2023-10-17 12:14 UTC (permalink / raw)
To: Ulf A. S. Holbrook via Sox-users
On Oct 16 13:10:07, sox-users@lists.sourceforge.net wrote:
> I think you'd be on to something! The for-loop probably calls sox at each
> loop and causes some issues.
You don't need any loop.
> However, if I run
> sox --combine merge *.WAV merged.wav
> or write to a different directory, it still merged everything into the last
> file in the list /and /it creates a new file.
I don't belive that's what happens.
I believe you run
sox --combine merge *.WAV >> merged.wav
instead, which would be consistent with such behaviour.
> So, I have files labelled 1.wav ... 90.wav Each are 1 minute long. When
> running the merge command, the last file in the list becomes the one
> everything is merged into, and ends up having 89 channels and not 90. The
> new merged.wav ends up being 8 seconds long, yet have 178 channels, ie 89
> x2. So somewhere along the line the loop is doubled, and I cannot understand
> how.
If my suspition is correct, SoX never touched the merged.wav;
it got written with the >> output redirection, so it now contains
the textual output of the SoX command.
cd /tmp
for i in 1 2 3 4 ; do sox -n file$i.wav synth 10 sin $(($i * 100)) ; done
sox -M file*wav out.wav
soxi out.wav
sox -M file*wav >> out.wav
soxi out.wav
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-10-17 12:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-15 13:27 Help with --combine merge Ulf A. S. Holbrook via Sox-users
2023-10-15 20:39 ` Jeremy Nicoll - ml sox users
2023-10-16 11:10 ` Ulf A. S. Holbrook via Sox-users
2023-10-17 12:14 ` Jan Stary
2023-10-16 10:44 ` Jan Stary
2023-10-16 11:28 ` Ulf A. S. Holbrook via Sox-users
2023-10-17 12:05 ` Jan Stary
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/sox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).