Batch convert Wav files to (or close to) zero size when minifying Kontakt Libraries?

Discussion in 'Kontakt' started by El Duderino, Jul 17, 2024.

  1. El Duderino

    El Duderino Newbie

    Joined:
    Oct 9, 2023
    Messages:
    37
    Likes Received:
    2
    Hey everyone.

    This question is in regards to minifying kontakt libraries.

    I have minified many libraries for over a year now and what I usually have done in the past when I wanted to remove one of the mic positions I deleted the samples and then in each instrument I manually "deleted all zones with missing samples" which seems to work fine for most instruments and libraries but it is very tedious work (especially if there are a huge amount of nki's) and also I've found that some libraries actually breaks for some reason when deleting missing these zones and doesn't play any sound once you do this.

    So now I'm thinking it migh be easier to convert the samples for the mics I want to remove into "zero size" samples so that kontakt will load the samples but there is no, or as close as possible to no audio information inside the samples.

    Does anyone have suggestions of how to batch convert wav-files this way? And does anyone know what limits Kontakt have for hz and bitrate? Perhaps it doesn't really that much for this purpose, as making say 1000 samples of 0,5 sec silence in 16bit 48khz format will probably not take up much more space than if they were 8bit 6khz format, but then Kontakt might not be able to read them, or they might not be able to be made into ncw and then put into a NKX. And might it cause problems in kontakt locating these samples if they have been tampered with this way. I'm not really sure what it is kontakt scan for when locating missing samples as sometimes it rejects a sample even if the name are correct.

    Does anyone have any experience and knowledge about this? Especially converting samples into minimally sized "functional" samples? But also what might be problematic in terms of these two different ways of "minifying"?

    One positive thing about making "zero sized" NKX for all the microphones would be that you could store all mics on an external HDD and then exchange them any way you wanted later on if you decided that you might need them.

    But there might be other advantages or disadvantages in one way or the other that I might not be aware of atm.

    Any insight or suggestion would be very helpful. And I'm not sure I've seen this explicitly discussed in any other thread. At least not that I'm aware of and have found.

    And one final question: Since a NKX file has a maximum capacity of 2GB, is there a way, in windows or some other software, to sort files into folders with a set size limit for each folder and once the limit is reached it automatically creates a new folder with the same name but and additional suffix? This would also be a massive time saver while minifying libraries.
     
  2.  
  3. xorome

    xorome Audiosexual

    Joined:
    Sep 28, 2021
    Messages:
    1,176
    Likes Received:
    860
    Kontakt doesn't seem to care about file format. You can substitute the original sample with an NCW, WAV or AIFF, so long as the file name (minus file extension) matches. The sample finder has a check box for this (Allow alternate file types or something).

    Kontakt doesn't seem to care about bitdepth or sample rate either (see minified 96kHz, 24bit -> 48kHz, 16bit releases).

    I've done both for a handful of libraries and had no problems so far.

    I've done a quick test replacing some samples with 0 length wavs and Kontakt didn't complain and the patch continued to work. This was on the simplest / smallest patch I had. Super complicated, scripted patches might be different, but you'll just have to try.

    For quickly replacing the original samples, I batch-copied the empty file over the original samples with fd.

    fd -ewav -x cp ../empty_2c.wav {}
     
  4. El Duderino

    El Duderino Newbie

    Joined:
    Oct 9, 2023
    Messages:
    37
    Likes Received:
    2
    [QUOTE="xorome

    For quickly replacing the original samples, I batch-copied the empty file over the original samples with fd.

    fd -ewav -x cp ../empty_2c.wav {}[/QUOTE]

    Cool. I will have to test it out. But would you be so kind as to explain a little about how to actually run FD?
    Perhaps I'm just too eager to try it out and I haven't looked at the help file for FD yet but will the line you typed above
    replace all wave files inside the folder you are inside running the program with the empty wav in the top folder? If that makes sense?
     
  5. xorome

    xorome Audiosexual

    Joined:
    Sep 28, 2021
    Messages:
    1,176
    Likes Received:
    860
    Yeah, exactly right :wink:

    fd runs inside a terminal (cmd.exe if you're on Windows)

    Quick break down:

    fd -ewav -x cp ../empty_2c.wav {}

    fd - run fd
    -ewav - find all files with the Extension 'WAV' in this folder and sub folders.
    -x - eXecute the following program on each of those files:

    cp - On Windows probably copy /B, also check /Y to stop copy from asking permission to overwrite.
    ../empty_2c.wav - copy the file from the parent folder, probably ..\empty_2c.wav on Windows
    {} - inserts the original file name of the sample here.


    in other words, it automatically turns into this ->

    cp ../empty_2c.wav sample_for_microphone1_vl1_rr0.wav
    cp ../empty_2c.wav sample_for_microphone2_vl7_rr1.wav
    cp ../empty_2c.wav sample_for_microphone1_vl3_rr5.wav
    cp ../empty_2c.wav sample_for_microphone3_vl4_rr3.wav

    and so on
     
    Last edited: Jul 17, 2024
  6. El Duderino

    El Duderino Newbie

    Joined:
    Oct 9, 2023
    Messages:
    37
    Likes Received:
    2
    Thanks. I'll have to experiment a bit but I have to check out the program a bit so I don't do something stupid and write over any other files :crazy:
     
  7. Xupito

    Xupito Audiosexual

    Joined:
    Jan 21, 2012
    Messages:
    7,292
    Likes Received:
    4,028
    Location:
    Europe
    @xorome 's method seems fine too, probably faster.

    This is what I do once I figured out the the nomenclature of the mics I wanna delete. In this case, the neck pickup of a Kontakt Virtual guitar that has also a bridge pickup mic which is the one I want to keep. Since, you know, neck samples in a metal guitar are for pussies.

    dir /S /B "D:\VS\KT\ISWorks_Hydra\Samples\Samples_Neck_*.ncw" > empty_those_samples.bat
    The empty_those_samples.bat will look like:
    Code:
    D:\VS\KT\ISWorks_Hydra\Samples\Samples_Neck_sustain_01_rr01.ncw
    D:\VS\KT\ISWorks_Hydra\Samples\Samples_Neck_sustain_01_rr02.ncw
    ...
    D:\VS\KT\ISWorks_Hydra\Samples\Samples_Neck_palmmute_01_rr02.ncw
    ...
    
    Then you replace '.ncw' with '.ncw"'
    The you replace 'D:\' with 'copy /Y "empty.ncw" "D:\'
    Save
    The empty_those_samples.bat now will look like:
    Code:
    copy /Y "empty.ncw" "D:\VS\KT\ISWorks_Hydra\Samples\Samples_Neck_sustain_01_rr01.ncw"
    copy /Y "empty.ncw" "D:\VS\KT\ISWorks_Hydra\Samples\Samples_Neck_sustain_01_rr02.ncw"
    ...
    copy /Y "empty.ncw" "D:\VS\KT\ISWorks_Hydra\Samples\Samples_Neck_palmmute_01_rr02.ncw"
    ...
    
    Execute "empty_those_samples.bat"
     
    Last edited: Jul 17, 2024
  8. El Duderino

    El Duderino Newbie

    Joined:
    Oct 9, 2023
    Messages:
    37
    Likes Received:
    2
    I've tried out FD but I can't get it to copy over the original wav files with the empty one. I can get FD to list the original samples but when I add

    "-x copy ../empty_2c.wav {}"
    or
    "-x copy empty_2c.wav {}"

    it just gives me "Invalid parameter" or "Invalid number of parameters".

    I've got the FD.exe and the empty wave file in the same folder and inside that folder I have the samples folder named simply "Samples".

    Could anyone write out the exact line I would need for this to work in windows?
     
  9. El Duderino

    El Duderino Newbie

    Joined:
    Oct 9, 2023
    Messages:
    37
    Likes Received:
    2
    Oh. And what software do you guys use to recode samples to 16 bit? And what dither settings?
     
  10. xorome

    xorome Audiosexual

    Joined:
    Sep 28, 2021
    Messages:
    1,176
    Likes Received:
    860
    I use r8brain inside Reaper's batch converter for sample rate conversion and bitdepth reduction with Dither and Noise shaping on. r8brain free/pro, iZotope, SoX, dBPowerAmp are all great.

    Would need to see the full command line you used for fd.

    Quick example that I tried in Windows and that works for me:

    C:
    cd "\Libs\Brass - Trombone - Carpenter\"
    C:\Downloads\fd.exe -e wav -x xcopy /y C:\Downloads\empty_2c.wav "{}"


    My fd.exe is in C:\Downloads, so is my empty_2c.wav. My Kontakt libs are in C:\Libs. Note I'm using xcopy.

    For your example, something like:

    cd folder_where_you_put_fd_and_empty_sample\
    cd Samples\
    ..\fd.exe -e wav -x xcopy /y ..\empty_2c.wav "{}"
     
  11. El Duderino

    El Duderino Newbie

    Joined:
    Oct 9, 2023
    Messages:
    37
    Likes Received:
    2
    I just tried to run two different attempts with your example from the cmd prompt whilst being inside the sample folder as I thought it might have something to do with my previous attempts was running the prompt in the FD folder. But doing so resulted in this:

    H:\FD\Samples>H:\FD\fd.exe -e wav -x xcopy /y ..\empty_2c.wav "{}"

    Invalid switch - /CDT_Guitar_LongAcoustic_mp_B2_RR1_mx01.wav
    Invalid switch - /CDT_Guitar_LongAcoustic_mp_C#3_RR1_mx01.wav
    Invalid switch - /CDT_Guitar_LongAcoustic_mp_A2_RR1_mx01.wav
    Invalid switch - /CDT_Guitar_LongAcoustic_mp_A#0_RR1_mx01.wav
    Invalid switch - /CDT_Guitar_LongAcoustic_mp_A#1_RR1_mx01.wav
    Invalid switch - /CDT_Guitar_LongAcoustic_mp_A3_RR1_mx01.wav

    H:\FD\Samples>..\fd.exe -e wav -x xcopy /y ..\empty_2c.wav "{}"

    Invalid switch - /CDT_Guitar_LongAcoustic_mp_A#1_RR1_mx01.wav
    Invalid switch - /CDT_Guitar_LongAcoustic_mp_C#3_RR1_mx01.wav
    Invalid switch - /CDT_Guitar_LongAcoustic_mp_A#0_RR1_mx01.wav
    Invalid switch - /CDT_Guitar_LongAcoustic_mp_A2_RR1_mx01.wav
    Invalid switch - /CDT_Guitar_LongAcoustic_mp_B2_RR1_mx01.wav
    Invalid switch - /CDT_Guitar_LongAcoustic_mp_A3_RR1_mx01.wav

    I'm sure I am missing something here :dunno:
     
  12. xorome

    xorome Audiosexual

    Joined:
    Sep 28, 2021
    Messages:
    1,176
    Likes Received:
    860
    Really weird. I don't think you're missing anything. Maybe it's because of / vs \ for whatever reason.

    You're using the exe from fd-v10.1.0-x86_64-pc-windows-msvc and not fd-v10.1.0-x86_64-pc-windows-gnu, yeah?
    I'd try using the msvc exe first - I'm just guessing at this point.

    Still no go?
    You're in cmd.exe, yes (not PowerShell or WSL)? On English Windows?

    Still no go?
    What does it look like when you just input fd -e wav?

    1)
    limiter-test-24bit-1.wav
    somefolder\limiter-test-24bit-2.wav

    2)
    /limiter-test-24bit-1.wav
    somefolder/limiter-test-24bit-2.wav

    3)
    \limiter-test-24bit-1.wav
    somefolder\limiter-test-24bit-2.wav


    It looks like 1) for me.
     
  13. El Duderino

    El Duderino Newbie

    Joined:
    Oct 9, 2023
    Messages:
    37
    Likes Received:
    2
    I did have the GNU one but have downloaded the MSVC version but still the same.

    This is what I get with "FD -e wav"


    H:\FD msvc>fd -e wav
    Samples\CDT_Guitar_LongAcoustic_mp_A#0_RR1_mx01.wav
    Samples\CDT_Guitar_LongAcoustic_mp_A#1_RR1_mx01.wav
    Samples\CDT_Guitar_LongAcoustic_mp_A2_RR1_mx01.wav
    Samples\CDT_Guitar_LongAcoustic_mp_A3_RR1_mx01.wav
    Samples\CDT_Guitar_LongAcoustic_mp_B2_RR1_mx01.wav
    Samples\CDT_Guitar_LongAcoustic_mp_C#3_RR1_mx01.wav
    empty_2c.wav
     
  14. xorome

    xorome Audiosexual

    Joined:
    Sep 28, 2021
    Messages:
    1,176
    Likes Received:
    860
    No idea then. Your input (fd -e wav -x xcopy /y ..\empty_2c.wav "{}") works fine for me on Windows btw.
     
Loading...
Similar Threads - Batch convert files Forum Date
Batch converting ncw files to 16bit? Kontakt Sep 7, 2021
Need a batch converter for wav files Win - HELP! Software Sep 24, 2016
MIDI to Audio Batch Converter (Mac) Working with Sound Nov 11, 2024
MIDI to MP3 (or WAV) Batch Converter? Working with Sound Aug 16, 2023
Batch audio converter Software Mar 19, 2023
Loading...