Info tool for sfs files

Post your feature requests for future versions of Orion, Hydra, Scorpion or Plucked String. (Please do not expect a reply from the developers)

Moderators: Christophe, Mark

Re: Info tool for sfs files

Postby BMS » Thu Jul 13, 2023 1:47 pm

This version of the first script I posted, pretty much same warnings provided as is, with no warranties, if you mess up your stuff that's on you blah blah.

Little bit different this script in that it is a bit more reusable, it does almost the same as the first script I posted in the last post.

This time you have to have Orionology in "C:\Program Files\Orionology" and the script will make a copy of it and put it in the folder you enter when prompted "Enter the directory of your .sfs file/s you want to make .LOG\s of?" then afterwards it will delete the orionology.exe when finished, leaving the one in \Program Files\ untouched.
in case you want to run it again in future

I wrapped the script in a function so that you run the script again in the powershell session by calling

MakeOrionSongFileLogs

and it will ask you again to enter the directory with the sfs files in

I didn't make it recurse (though possible*) through lots of subfolders so it only gets the sfs in the folder you specify and that's where it makes the logs, I personally just made a copy of every sfs file on my drive and put it into one folder and ran this on them creating all the logs files and manually deleted the sfs'es making sure my originals were still in place and untouched.

--- OLD --- Make Orion Song File LOGS with orionology.exe v 2.0 -- OLD (see bottom of post for updated version) ---

Code: Select all

<#

Title: Make Orion Song File LOGS with orionology.exe v 2.0
Author: Stockwell
Tags: Music, Production, ORION, Powershell

Description: This script generates multiple .log files by copying the orionology.exe into a specified folder that contains ORION .sfs files. It reads the .sfs files and produces corresponding log files based on their contents. Once the process is complete, the script removes the orionology.exe from the designated folder.

Requires orionology.exe by Jouni Airaksinen https://gitlab.com/stardrivestudio/orionology to be present in "C:\Program Files\Orionology\" for script to run.

Note: flags are set to maximum verbosity -vvv in this version

#>

function MakeOrionSongFileLogs {
   
   Clear-Host
   Write-Host "`nMake Orion Song File LOGS with orionology.exe v 2.0`n`n"
   
    $targetPath = Read-Host "Enter the directory of your .sfs file/s you want to make .LOG/s of"
   $orionologyPath = "C:\Program Files\Orionology"

    Set-Location $targetPath

    Copy-Item -Path "$orionologyPath\orionology.exe" -Destination $targetPath

    $allFiles = Get-ChildItem "*.sfs"
      foreach ($sfs_file in $allFiles) {
         $toProcess = $sfs_file.Name
         $textName = $sfs_file.BaseName
         .\orionology.exe "$toProcess" -vvv 2> "$textName.LOG"
    }

   Remove-Item -Path "$targetPath\orionology.exe"
   
   Write-Host "`norionology.exe sucessfully deleted from `"$targetPath`"`n"
   Write-Host "Process Complete, your .LOG file/s are located in `"$targetPath`"`n"
}

MakeOrionSongFileLogs

[/s]

This outputs the same thing as the first script I posted, but it's a little more reusable. You then can run the 2nd, "Make a list of samples..." script on the previous page to do that once you have the .log files. I'll follow at some point with a sample mover script and update it all in one post with less explanations if anyone is interested. which will basically be

1. automate making the logs with orionology
2. make sample lists automatically from the logs
3. use sample lists to create subfolders automatically containing the samples in the lists

Any questions, bugs or ideas then I'll see if I can set up a thread notification.

*edit, I made a 3rd version that looks through all the subfolders of a top level folder you specify and also checks it is a valid path, as I;ve started realising there's a lot more you need to think about when posting a script for others to use. I didn't delete the older versions but I've marked them as OLD so I didn't just delete them or change something if anyone has already read these posts, but I've been using this version instead.

NEW Make Orionology ORION Song File LOGS 3.0 (searches subfolders and checks user input if a valid folder is given)

Code: Select all
<#

Title: Make Orionology ORION Song File LOGS 3.1
Author: Stockwell
Tags: Music, Production, ORION, Powershell, orionology

Description: This script generates .LOG files by copying the orionology.exe into each subfolder that contains a ORION .sfs file. It reads the .sfs files and produces corresponding log files based on their contents, it also makes the log files last modified date the same as the .sfs files last modified date.

Requires orionology.exe by Jouni Airaksinen https://gitlab.com/stardrivestudio/orionology to be present in "C:\Program Files\Orionology\" for script to run.

Note: flags are set to maximum verbosity -vvv in this version

#>

function Validate-FolderPath {
    param(
        [string]$path
    )

    if (-not (Test-Path -Path $path -PathType Container)) {
        Write-Host "`nInvalid folder path: `"$path`". Please provide a valid folder path.`n" -ForegroundColor Red
        return $false
    }

    $sfsFiles = Get-ChildItem -Path $path -Filter "*.sfs" -Recurse
    if ($sfsFiles.Count -eq 0) {
        Write-Host "`nNo .sfs files found in the specified folder or its subfolders.`n" -ForegroundColor Yellow
        return $false
    }

    return $true
}

function MakeOrionSongFileLogs {
    param(
        [string]$rootFolderPath
    )

    Clear-Host
   
    Write-Host "`nMake Orion Song File LOGS with orionology.exe v 3.1`n`n"
   
   $rootFolderPath = Read-Host "Enter the root folder path that contains subfolders with .sfs files in"

    $orionologyPath = "C:\Program Files\Orionology"
    $orionologyExePath = Join-Path $orionologyPath "orionology.exe"

    while (-not (Validate-FolderPath -path $rootFolderPath)) {
        $rootFolderPath = Read-Host "Enter the root folder path that contains subfolders with .sfs files in"
    }

    $sfsFiles = Get-ChildItem -Path $rootFolderPath -Filter "*.sfs" -Recurse

    foreach ($sfsFile in $sfsFiles) {
        $folderPath = $sfsFile.Directory.FullName

        Copy-Item -Path $orionologyExePath -Destination $folderPath -Force

        $toProcess = $sfsFile.Name
        $textName = $sfsFile.BaseName + ".LOG"

        Set-Location $folderPath
        .\orionology.exe "$toProcess" -vvv 2> $textName

        $lastModified = $sfsFile.LastWriteTime

        $logFile = Get-Item $textName
        $logFile.LastWriteTime = $lastModified
        $logFile.CreationTime = $lastModified

        # Remove orionology.exe from the current folder
        Remove-Item -Path (Join-Path $folderPath "orionology.exe") -Force

        Write-Host "`norionology.exe successfully deleted from `"$folderPath`"`n"
    }

    Write-Host "Process Complete. Your .LOG file/s are located in `"$rootFolderPath`"`n"
}


MakeOrionSongFileLogs -rootFolderPath $rootFolderPath


Log Files V 3.PNG


learning as i go really
You do not have the required permissions to view the files attached to this post.
Last edited by BMS on Mon Jul 17, 2023 7:34 pm, edited 10 times in total.
BMS
Regular
 
Posts: 125
Joined: Wed Oct 28, 2009 12:05 am

Re: Info tool for sfs files

Postby BMS » Thu Jul 13, 2023 6:26 pm

Posting this for anyone who is interested too, might be a little off topic and "old" now

Been toying with some other scripts to "sanitise" and make friendly some of the data but not finalised them for anyone elses use, they involve various 'cludges' which probably aren't best practise but seemed to work for me, things like text matching, regexes, word replacement snip...

Some background

Aside from using orionology to pull lists of samples from the logs, then processing those logs to give me a list of samples for each tune. I have a few sampler programs I wanted to read the knob data from.

Now in ORION the knobs are in percentages, and trying to get things like the WAVE START position from a knob that says 62% and calculating that didn't seem to work when I translated it to actual samples. probably because the divisor was wrong the way I was working it out (v. jankily)

In the orionology logs, the wave start knob for the sampler is control #32 so I look it up and realise the mapping is from a scale of 0-128 (so 129 positions) and 62% in the ORION gui is actually 80 in real data, which is more like 62.5% when you work it out backwards. (it is 62% of 101 positions (129 x 0.62 = 79.98) rather than 100 and I was working it out sillyly.)

so yeah, using the 0-128 scale as the divisor because it was easier to work out , I've been pulling them out the logs.

Code: Select all
DEBUG orionology::synapse > **** Control #32: [ControlValue { i: 80, f: 0.000000000000000000000000000000000000000000112 }]


I'm guessing i: is the integer and f: is the float (I'm no programmer but seems like it would make sense.) anyway so I've been working on translating that into some useable data for me by "sanitising" the log and replacing stuff with matches/search/replace scripts to something like

Code: Select all
SAMPLER > WAVE START = 80 float 0.000000000000000000000000000000000000000000112


which makes it easier for me to see, although isn't nesc really once you know what to look for

Anyway, now I can do some back of cigarette packet calculations (or even write that as a script) to work out that if the total number of samples in my audio file = 3612084 and the knobs true position is at 80 (62%) then start position in samples is 2257552.5

(80 / 128) * 3612084 = 2257552.5 (lets just say approx. 2257553 samples, rounding up, but might work better rounding down)

interestingly ORION has a very bizarre way of working, it seems to have for midi velocity 129 positions from 0-128, when in a lot of other programs its 0-127 or 1-128, so there's an extra position and then mapped to a knob that has 101 positions itself 0-100%

for the VELOCITY MOD START I had to factor it over 129 rather than 128, which seemed a bit odd as its the same amount of positions but it didn't seem to work with 128, it was off by quite a bit, or I got something wrong

likewise control #33

Code: Select all
DEBUG orionology::synapse > **** Control #33: [ControlValue { i: 16, f: 0.000000000000000000000000000000000000000000022 }]


(16 / 129) * 3612084 = 448010.418604651 (or approx. 448010 samples)

seems to be my velocity start mod in samples.

knob-value-converter-script.PNG


I piped these values into Kontakt and it sounded like it nailed the "chop" of my sample the same. I was using the old velocity to sample start method and manipulating start times in the piano roll. so s.start and s.mod in kontakt map to the same functions and I get the same "walk through" of the sample. Kinda old school I know, but want to preserve those chops, and trying to do it manually was very tedious and almost a shot in the dark for some of my old sample chops (some 15 to 20 years old now in orion.)

Now my maths and logic are janky at best, I have no formal schooling and a really hard time with numbers so feel free to tell me I'm being a massive idoit or forgotten something or I'm just plain doing it wrong.It has seemed to get the sample points right though and playback is now indistinguishable to my ear between orions sample start and kontakt's so something must be working lol

Reverse tested the position of the sample that I worked out with the sum above with a blank wave file of the same length, but with a single click at exactly the amount of samples. Loaded a sampler in orion and set it to 62% and it started at approx the right point. As good as it gets I think there, don't think its ever going to be 100%.

As long as I arrive at the same point of so near I can't tell the difference by ear its's all good.

Will link a clip, which shows the sample which is chopped by velocity into 30 16ths, and the last 1 is an 8th note

bms-chops.PNG


its the ensemble orchestra sample, the first 2 bars are orions sampler chopping it, the 2nd two bars are kontakt with the formula I applied, then the same repeated without the drum pattern with an extra bar at the end for good luck.

Here's link to the test example http://sndup.net/fztj

Please don't watch the mix (it's not mixed and all effects are off anwyay) as this was from a rough sketch that I wanted to bring up to date. The pattern sounds pretty similar to me, so can move forward with that, then look at doing this with some other old projects (I tested it on 3 so far to see if it was a one off or not)

WOW this post got a lot longer and took a lot more time than I had anticipated, but hey if it helps even one more person, what the heck, plus I'll end up looking it up when I inevitably forget by next week what I was up to this week.

It would be really interesting to have some technical specifications for other things like the range on the ADSR though, as these are harder to map to anything without knowing the time element. (kontakt's attack goes to 15k ms apparently) Though again we could argue it would be quicker to recreate/approximate the sound of these things by ear, if we so desired, or not recreate them at all.

Still interesting looking into something I'd been using for years and still have installed!
You do not have the required permissions to view the files attached to this post.
Last edited by BMS on Sat Jul 15, 2023 4:24 am, edited 5 times in total.
BMS
Regular
 
Posts: 125
Joined: Wed Oct 28, 2009 12:05 am

Re: Info tool for sfs files

Postby BMS » Thu Jul 13, 2023 6:58 pm

Jouni wrote:No problem at all. Great to hear you've found it useful. Sure it's a bit technical, but in case you're up to doing mods to the tool, feel free.


You've helped me more than you would know. I could probably learn to mod it and make my life easier here, pulling only specific infos instead of "sanitising" the output. Would def be out of my comfort zone though, might try sometime to understand the underlying stuff a bit more, I did have a look at it but like anything new, its a big devotion of time and effort, and I'm a total noob, with a very means to an end mindset, so only want to learn what I need to, and when I need to. So a massive thanks for all your time and effort in making the program itself, sterling work.

Okay I'm stopping, I've done overly long 4 posts in a row now, with 8 times as many edits, and left this thread ina bit of a mess, all done for a while. :lol:
BMS
Regular
 
Posts: 125
Joined: Wed Oct 28, 2009 12:05 am

Re: Info tool for sfs files

Postby Jouni » Tue Jul 18, 2023 6:30 am

BMS wrote:In the orionology logs, the wave start knob for the sampler is control #32 so I look it up and realise the mapping is from a scale of 0-128 (so 129 positions) and 62% in the ORION gui is actually 80 in real data, which is more like 62.5% when you work it out backwards. (it is 62% of 101 positions (129 x 0.62 = 79.98) rather than 100 and I was working it out sillyly.)

so yeah, using the 0-128 scale as the divisor because it was easier to work out , I've been pulling them out the logs.

Code: Select all
DEBUG orionology::synapse > **** Control #32: [ControlValue { i: 80, f: 0.000000000000000000000000000000000000000000112 }]


The app right now just dumps the values as they are presented in the internal structure. There is a separate mapping data inside the Orion code, one for each parameter in each of the synths and effects. I just did not feel replicating this as it was a lot of mapping data I would have had to convert. It's mostly configuration how to display (what unit it is, min/max and if I recall also center point/default value) these and which one to use, the integer (usually stepped values) or the float value.
Jouni
Godlike
 
Posts: 3963
Joined: Sun Jan 11, 2004 10:21 pm
Location: Finland

Re: Info tool for sfs files

Postby BMS » Tue Jul 18, 2023 3:12 pm

Jouni wrote:
BMS wrote:In the orionology logs, the wave start knob for the sampler is control #32 so I look it up and realise the mapping is from a scale of 0-128 (so 129 positions) and 62% in the ORION gui is actually 80 in real data, which is more like 62.5% when you work it out backwards. (it is 62% of 101 positions (129 x 0.62 = 79.98) rather than 100 and I was working it out sillyly.)

so yeah, using the 0-128 scale as the divisor because it was easier to work out , I've been pulling them out the logs.

Code: Select all
DEBUG orionology::synapse > **** Control #32: [ControlValue { i: 80, f: 0.000000000000000000000000000000000000000000112 }]


The app right now just dumps the values as they are presented in the internal structure. There is a separate mapping data inside the Orion code, one for each parameter in each of the synths and effects. I just did not feel replicating this as it was a lot of mapping data I would have had to convert. It's mostly configuration how to display (what unit it is, min/max and if I recall also center point/default value) these and which one to use, the integer (usually stepped values) or the float value.


Aha, yes, thank you! The more I look at what comes out of that internal structure, the more I can see what a gargantuan task this would be! Seeing though the control number seems to reset to #0 for each generator/synth/effect, like you say a LOT of mapping data to work out. I can work out some of it by studying it and referring to the program itself, but some is still cryptic, huge task though.

aaah, I was thinking { i: 80, f: 0.000000000000000000000000000000000000000000112 } was a total value as in could be expressed like 80.000000000000000000000000000000000000000000112 (effectively still 80 I guess), I don't know enough computer science or maths to know what I'm talking about. :lol:

For my uses I wanted to convert just those sampler values at that point of time to a sample time (and seemed to get it even if the maths is shaky), but I did manage with some post processing on the log to grab everything from the start of the samplers chunk to the end (or just after where the sample is stored) and replace those entries in between to the actual knob names as there isn't much on the line to differentiate the control number, I could have worked out how to do it in chunks - though. like you I don't think I'd feel like doing it for every control as even the built in stuff is a massive task, I'd probably just read anything I needed. I suppose if I really wanted I could test the ASDRs with a tone or noise (although I have a sportsman's bet on it not being linear from the sound when tweaking it), but really I'm musing on a theoretical rather than a practical matter, by ear was good enough for me on my examples I've tested.

As an aside...

For me it became a little challenge to see what I could do rather than an utmost importance. making a set of sample collector scripts though has helped me be able to ditch a load of old samples I'd collected over the years but feared if I deleted the pool to move on, then some older projects wouldn't open. You could say this is hanging on to the past and I could just move on, but it was something I needed to get past as I used ORION as a sketchpad for ideas since around 21 years ago, and I still find myself, not wanting to rework, but revisit a thread I started and take it in a new direction and I want to archive the things that were finished/check back for anything had any licencing issues come up over the years. I guess in the great scheme of things it's not really that important though.

It's been interesting, since the 90s I've written/hacked html and php, and some lua scripts but had no idea about powershell. My friend now says I have a better grasp of powershell than some of his colleagues in IT, and I probably could get paid to code/script. I don't want to insult his intelligence though, my point to him was I'd probably never get an interview and I'm just making it all up as I go along and learning, and solving problems as they come, and this is just a means to an end for me. I wouldn't turn my nose up if he was hiring though :lol:

The sheer amount of things I started to think of when TimelessDNB requested I posted 'the' script though, dawned on me as soon as someone else needed to use something that I've been hacking away at myself and didn't even consider before.

I'm still working on slowly, time permitting, on a script to grab the samples from the songname_sample_list.txts I generated from the logs I got from orionology. I used powergrep for this before lifting paths from the binaries with regexes but I think It missed loads. I made a basic version in powershell but now I'm finding instead of running it multiple times I want to look in multiple locations and have it run through and match the contents of the generated lists then if it finds the samples, check if they exist already, copy/move them with confirmation, and what it doesn't find to have it write another file in each folder like songname_sample_list_missing_samples.txt.

Aside from just silently continuing when a conflict happens, I'm just solving the skip all problem when I have it checking for each line of content, each item in the loop is the "ALL" so to speak, so I'm thinking of tackling in another way, storing in a hash table and maybe checking against all of the items, I'll work something out I think, even if it is a little 'hacky'.

Going to have a sit down with that later today and see what I can come up with.
BMS
Regular
 
Posts: 125
Joined: Wed Oct 28, 2009 12:05 am

Re: Info tool for sfs files

Postby Timelessdnb » Sat Jul 22, 2023 1:07 am

I just want to say thank you for this tool and the power scripts, as it's made things so much easier for me to check my files, as they were scattered everywhere, and it would have taken me a lifetime without this!
Timelessdnb
Novice
 
Posts: 2
Joined: Sat Jul 08, 2023 6:19 pm

Re: Info tool for sfs files

Postby Jouni » Sat Jul 22, 2023 5:59 am

Great it has helped. The list of used external sample files and audiotrack files was the primary reason for me to create the app. Also I considered making feature to extract selected patterns/tracks as midi (completely doable) without use of Orion.
Jouni
Godlike
 
Posts: 3963
Joined: Sun Jan 11, 2004 10:21 pm
Location: Finland

Re: Info tool for sfs files

Postby BMS » Sun Jul 30, 2023 12:47 pm

Would be interesting to look into how to export midi patterns in such a way, doing it in orion always comes with some cruft I have to take out afterwards.

Been away for a bit, been messing with a thing to copy samples from a _sample_list.txt that is created from the logs in the previous script, it also generates a text file for any samples that it doesn't find in the same directory (_missing_samples.txt), I'd still test it small like anything as systems vary, it should work but like anything like this it assumes a few things.

I've noticed the previous script I posted to make sample_list.txt files will pull anything that looks like an url too from the orionology logs, so i found in those lists I had an url from the project information settings in ORION I'd saved say ( http : // www . bms . com for instance, made up ), as long as I'm aware of that I can ignore it and this one of course will not copy that as a sample from the pool but it will probably be written to the missing_samples.txt file. Hopefully that's not confusing but its only something that has become apparent to me over using the scripts myself. I can go back and alter the regex and exclusion in the previous script so it excludes anything that ends in com/uk or whatever.

I also need to make the previous script recursive so you can just set it on a root and it makes logs/sample list files in each folder (if I didn't already), I was making it one at a time before so didnt mess stuff up or was copying sfs files into one folder, then refoldering them, but with a lot of files that can be an unnesc hassle, would like to automate it a bit better, but wasnt really making these for anyone else's use

also these scripts assume a lot of stuff that I'm being careful with, the next script assumes you have things self contained, like

song 1/
song 1.sfs

and what we have generated

song 1.log (orionology log we created at first)
song 1_sample_list.txt (sample list we generated from the logs

this script copies the files to a subfolder called assets/audio rather than moves them, which is safer, cause sometimes we might have used the same sample twice, the script is still dumb i nthat if you have a sample pool with 2 samples with the same name (ie. kick1.wav) it juts copies the first one it comes across, so we have to be careful.

for my own uses its been able to consolidate a lot of stuff

Code: Select all
<#

Title: Sample List File Copier 3.2
Author: Stockwell
Tags: Music, Production, ORION, Samples

This script lets users select a path for sample list files, and multiple paths for sample pools. It copies the listed samples from the sample_list.txt files to specific subdirectories under each sample list file's parent directory. If a destination file already exists, it silently continues without overwriting.

Requires at least one sample_list.txt file generated from an orionology .LOG file.

Note: script is dumb in the sense it cannot determine if you have 2 different samples with the same name like Kick01.wav, in the sample pool, it will just grab the first one it finds in the sample pool so use with care.

#>

function Process-SampleListFiles {
    param (
        [string]$SampleListDir = $null,
        [string[]]$SamplePoolDirs = @()
    )

    Clear-Host

    Write-Host "`nSample List File Copier 3.2`n`n"

    $ValidSampleListDir = $false
    $ValidSamplePoolDirs = $false

    while (-not $ValidSampleListDir) {
        $SampleListDir = Read-Host -Prompt "Enter The Folder Where The Sample_List Files Are (Sub-Folders Will Be Scanned)"

        if ([string]::IsNullOrWhiteSpace($SampleListDir)) {
            Write-Host "`nPlease Enter A Valid Folder Path.`n" -ForegroundColor Red
        } elseif (Test-Path $SampleListDir -PathType 'Container') {
            if (-not (Get-ChildItem -Path $SampleListDir -Filter "*_Sample_List.txt" -Recurse)) {
                Write-Host "There's No Sample_List Files In '$SampleListDir' or any of its Sub Folders"
                $AlternateDir = Read-Host -Prompt "`nEnter A Folder That Has Sample_List Files Or A Folder That Has A Sub Folder With Sample_List Files."
                $SampleListDir = $AlternateDir
            }
            $ValidSampleListDir = $true
        } else {
            Write-Host "`nThis Didn't work, Please Re-Enter A Different Folder Path (eg C:\Tunes\)`n" -ForegroundColor Red
        }
    }

    while (-not $ValidSamplePoolDirs) {
        $SamplePoolDirs = Read-Host -Prompt "`nEnter The Folders Where Your Sample Pool is (sub-folders will be scanned) comma seperated ','"
        $SamplePoolDirs = $SamplePoolDirs -split ','

        $invalidDirs = $SamplePoolDirs | Where-Object { -not (Test-Path $_ -PathType 'Container') }
        if ($invalidDirs.Count -eq 0) {
            $ValidSamplePoolDirs = $true
        } else {
            Write-Host "`nThe following directories are invalid:`n"
            $invalidDirs | ForEach-Object { Write-Host "  $_" }
            Write-Host "`nPlease Re-Enter Valid Folder Paths (eg C:\Sample Drive 01,D:\Sample Drive 02)`n" -ForegroundColor Red
        }
    }

    Get-ChildItem -Path $SampleListDir -Filter "*_Sample_List.txt" -Recurse | ForEach-Object {
        $SampleListFile = $_.FullName
        Process-SampleListFile -SampleListFile $SampleListFile -SamplePoolDirs $SamplePoolDirs
    }
}

function Process-SampleListFile {
    param (
        [string]$SampleListFile,
        [string[]]$SamplePoolDirs
    )

    $SampleListDir = Split-Path -Path $SampleListFile -Parent
    $AudioDir = Join-Path -Path $SampleListDir -ChildPath "Assets\Audio"
    $MissingFiles = @()
    $FilesToCopy = @{}
   
    Get-Content -Path $SampleListFile | ForEach-Object {
        $Filename = $_.Trim()
        $FilePath = Find-FileInSamplePool -Filename $Filename -SamplePoolDirs $SamplePoolDirs
        if ($FilePath) {
            $FilesToCopy[$Filename] = $FilePath
        }
        else {
            $MissingFiles += $Filename
        }
    }

    if ($FilesToCopy.Count -gt 0) {
        New-Item -ItemType Directory -Path $AudioDir -ErrorAction Ignore | Out-Null
        foreach ($FileEntry in $FilesToCopy.GetEnumerator()) {
            $Filename = $FileEntry.Key
            $FilePath = $FileEntry.Value
            $DestPath = Join-Path -Path $AudioDir -ChildPath $Filename
            if (Test-Path $DestPath) {
            }
            Copy-Item -Path $FilePath -Destination $AudioDir -ErrorAction SilentlyContinue 
        }
    }

    if ($MissingFiles.Count -gt 0) {
        $MissingFileList = Join-Path -Path $SampleListDir -ChildPath "$([System.IO.Path]::GetFileNameWithoutExtension($SampleListFile))_Missing_Samples.txt"
        $MissingFiles | Out-File -FilePath $MissingFileList
        Write-Host "`n -----------------------------------------------------------------------`n`n The Following Files Were Not Found In Your Sample Pool`n"
        $MissingFiles | ForEach-Object { Write-Host " $_" }
        Write-Host "`n And are saved to `n`n '$MissingFileList'`n"
    }

    if ($MissingFiles.Count -eq 0) {
        $SampleListFileDir = Split-Path -Parent $SampleListFile
        if (-not (Get-ChildItem -Path $SampleListFileDir -Filter "*_Sample_List.txt" -Recurse)) {
        }
    }

    Write-Host " `n-----------------------------------------------------------------------`n`n All files In The Sample List File`n`n '$SampleListFile'`n`n Have Been Processed Successfully. `n`n -----------------------------------------------------------------------`n"
}

function Find-FileInSamplePool {
    param (
        [string]$Filename,
        [string[]]$SamplePoolDirs
    )

    foreach ($SamplePoolDir in $SamplePoolDirs) {
        $foundFile = Get-ChildItem -Path $SamplePoolDir -File -Recurse | Where-Object {
            $_.Name.ToLower() -eq $Filename.ToLower()
        } | Select-Object -ExpandProperty FullName -First 1

        if ($foundFile) {
            return $foundFile
        }
    }

    return $null
}

#to call the function
Process-SampleListFiles



run on a folder with a sample_list.txt in got me (though you could run it on a higher level folder and it will recurse, this script)

Code: Select all
+---020405 - High Spirits
|   |   020405 - High Spirits.LOG
|   |   020405 - High Spirits.sfs
|   |   020405 - High Spirits_Sample_List.txt
|   |   
|   \---Assets
|       +---Audio
|       |       3D003A.wav
|       |       BASS_Dirty_Reece_As_Pitchwheel.wav
|       |       Block Snap.wav
|       |       Heavy Hit 01.wav
|       |       Ja.wav
|       |       Ja2.wav
|       |       Kick_Hard Mono Cm 01.wav
|       |       Pshhhh.wav
|       |       Ride Open 02.wav
|       |       Tollabnoise.wav


filescopied.PNG


there were no missing samples here so it didnt generate a missing samples txt which it would have done had it not found any one of those.

This is what I got so far and has worked for me, what I really want to do is post something where its all consolidated into one set of things you run one after another to fulfil the whole process, of making the logs and sample lists, then copying the samples, but its a bit of work and debugging and thinking beyond my own means.

as before test small on backups, I am not responsible for even myself so I dread to think what anyone else could do under my direction :lol:
You do not have the required permissions to view the files attached to this post.
BMS
Regular
 
Posts: 125
Joined: Wed Oct 28, 2009 12:05 am

Previous

Return to Wishlist

Who is online

Users browsing this forum: No registered users and 449 guests

© 2017 Synapse Audio Software. All Rights Reserved.