Re: Fwd: Re: merging mono files
"Dr. Mark Bugeja MD" <[email protected]>
| Newsgroups | gmane.comp.audio.sox |
|---|---|
| Message-ID | <[email protected]> |
Should files in subfolders be handled in the same way as those in the
main folders, by running the script, then it might be even better to
separate the L folders from the R folders:
Recit Organ > Left > Bourdon16L
> BassoonHautbois8L
> Cor-De-Buit8L
> etc etc
> Right > Bourdon16R
> BassoonHautbois8R
> Cor-De-Buit8R
> etc etc
NB: each folder has a list of files + 3 folders, each with its own list
of files. Structure and names of L folders correspond to R folders.
__________________
Then modifying the script to:
pathDir = "E:\"
' a sample name, without a trailing L or R
sampname = "Recit Organ"
leftDir = pathDir & sampname & "L\"
rightDir = pathDir & sampname & "R\"
stereoDir = pathDir & sampname
__________________
.... also, Stereo files could be placed directly into folders without
the "S"
Whilst bearing in mind that files have no L or R in their file names,
lefts and rights being only denoted in the folder names, would this
alteration to the script be expected to create folders and files under
the E:\Recit Organ folder with subfolders being created accordingly?
Files names must not be altered.
Mark
On 12/12/2016 11:41, Dr. Mark Bugeja MD wrote:
>
> This is what I got so far.
>
> ' combine.vbs - Combine audio files from different directories.
>
> Option Explicit
>
> Dim exec
> Dim file
> Dim fileName
> Dim fso
> Dim leftDir
> Dim leftFolder
> Dim rightDir
> Dim shell
> Dim soxCommand
> Dim stereoDir
> Dim subFolder
> Dim subName
>
> soxCommand = "C:\Program Files (x86)\sox-14-4-2\sox.exe"
>
> Dim pathDir
> Dim sampname
>
> pathDir = "E:\Recit-Organ\"
>
> ' a sample name, without a trailing L or R
> sampname = "Basson16"
>
> leftDir = pathDir & sampname & "L\"
> rightDir = pathDir & sampname & "R\"
> stereoDir = pathDir & sampname & "S\"
>
> ' Use standard Windows objects.
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set shell = CreateObject("WScript.Shell")
>
> ' Create a directory, if it does not exist.
> Sub CreateDir(name)
> If Not fso.FolderExists(name) Then
> fso.CreateFolder(name)
> End If
> End Sub
>
> ' Create a directory for the combined stereo files.
> CreateDir(stereoDir)
>
> ' Loop through all of the subdirectories in the Left directory.
> Set leftFolder = fso.GetFolder(leftDir)
> For Each subFolder in leftFolder.SubFolders
> ' Create a corresponding subdirectory for the combined files.
> subName = subFolder.name
> CreateDir(stereoDir & subFolder.name)
>
> ' Loop through all of the the files in the subdirectory.
> For Each file in subFolder.Files
> ' Execute the sox command for each file.
> fileName = file.Name
> Set exec = shell.Exec(soxCommand & " -M " & _
> leftDir & subName & "\" & fileName
> & " " & _
> rightDir & subName & "\" &
> fileName & " " & _
> stereoDir & subName & "\" &
> fileName & " remix 1 4")
>
> WScript.Echo stereoDir & subName & "\" & fileName
> Next
> Next
>
> WScript.Echo "Done."
>
> Would I be correct in saying that this will handle files in subfolders
> in the same way?
>
> Mark
>
> On 11/12/2016 22:48, Jeremy Nicoll - ml sox users wrote:
>> On 2016-12-11 20:39, Dr. Mark Bugeja MD wrote:
>>> So before I run the attached vbs file, is it ok?
>> It looks ok, but you're going to have to edit this file each time you
>> want to
>> merge a different set of samples, and you'll have to change three lines
>> in the
>> right way, each time.
>>
>> You would be better to replace the lines that say:
>>
>> leftDir = "C:\Program Files
>> (x86)\sox-14-4-2\input\Recit-Organ\Basson16L\"
>> rightDir = "C:\Program Files
>> (x86)\sox-14-4-2\input\Recit-Organ\Basson16R\"
>> stereoDir = "C:\Program Files
>> (x86)\sox-14-4-2\input\Recit-Organ\Basson16S\"
>>
>> with
>>
>> Dim pathDir
>> Dim sampname
>>
>> pathDir = "C:\Program Files (x86)\sox-14-4-2\input\Recit-Organ\"
>>
>> sampname = "Basson16" ' a sample name, without a trailing L or R
>>
>> leftDir = pathDir & sampname & "L\"
>> rightDir = pathDir & sampname & "R\"
>> stereoDir = pathDir & sampname & "S\"
>>
>>
>> then when you edit the file to process a different set of samples, you
>> will only
>> need to change one line, this one:
>>
>> sampname = "Basson16" ' a sample name, without a trailing L or
>> R
>>
>> each time.
>>
>>
>> And, as I said before, the actual sox command that Kevin's program
>> issues is
>> essentially
>>
>> sox -M leftfile ritefile stereofile
>>
>> but someone-else pointed out that because your input files are NOT mono
>> files (ie
>> not files with only a single channel in them), you really need to issue
>>
>> sox -M leftfile ritefile stereofile remix 1 4
>>
>> and to achieve that you need to find the line that says
>>
>> stereoDir & subName & "\" & fileName)
>>
>> and change it to
>>
>> stereoDir & subName & "\" & filename & " remix 1 4")
>>
>>
>> For these two changes just copy & paste the text out of this email into
>> your
>> combine.vbs file.
>>
>>
>> There might be another problem though, depending on which version of
>> Windows you
>> are using, and whether you have UAC turned on (the thing that in W7, W8,
>> W8.1 &
>> W10 asks for your administrator's password when you do things that need
>> extra
>> authority). You've apparently placed your sample files in
>>
>> C:\Program Files (x86)\sox-14-4-2\input\Recit-Organ\...
>>
>> which is a folder, as the name "C:\Program Files (x86)" implies, which
>> is meant
>> to contain programs and other parts of applications, not sample data.
>> Normally
>> on W7 (perhaps) & definitely on W8, W8.1 and W10, Windows will not let a
>> running
>> program create or alter any data files in subfolders of that folder.
>>
>> It disallows this so that malware cannot write files into C:\Program
>> Files... or
>> make malicious alterations to files that are correctly installed there.
>> Now while
>> you are just reading audio samples from there, it will work ok, but when
>> you run a
>> sox command that tries to create a stereo file there, Windows should
>> either prevent
>> it, or ask for your admin password EVERY TIME.
>>
>> The best solution would be for you to move all the audio samples out of
>> C:\Program
>> Files... and put them in a normal place for user data, eg your Documents
>> folder, or
>> a folder on your Desktop.
>>
>> If you do move them then in your combine.vbs file that you sent, you
>> need to change
>> all three lines that say where the L & R files are and the S file be
>> written, or, if
>> you adopt the code I suggested, you will need to change this line:
>>
>> pathDir = "C:\Program Files (x86)\sox-14-4-2\input\Recit-Organ\"
>>
>> so that it points at the place you moved the sample files to.
>>
>>
>>
>>> (please rename to rar as the file would not send)
>> There's no need to attach a file; just copy & paste the contents
>> straight into your
>> email.
>>
>>
>>
>
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
_______________________________________________
Sox-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sox-users