Automating HARK input with Batch Process

HARK FORUM Automating HARK input with Batch Process

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1493
    Avatarriyas2894
    Participant

    Hello
    I am trying to preprocess my HARK audio files. I have more than 100 audio files so is there any way that I can Automate the inputof audio file to HARK instead of selecting each file manually. Please let me know if there is a way to do it. I am using HARK on Ubuntu.
    Thank you
    Riya.

    #1497

    Thank you for your inquiry.

    First, create a network file for file input using AudioStreamFromWave . This is a normal network file that takes one WAV file as input. Please refer to Cookbook and Samples for how to create a network file.
    Next, change the parameter type of the Constant node that is inputting the file name from string to subnet_param , and change the parameter value to ARG1 or string:ARG1 . Please refer here for the meaning of ARG<number> .
    With this change, you can change the file name arbitrarily with the argument, so you can execute as follows.

    If you want a network file named network.n to process a WAV file named input.wav:

    
    harkmw ./network.n ./input.wav
    

    After that, just write the loop of the file name as follows with shell script.

    If you have a file list:

    
    for f in <code>cat filelist.txt</code>; do
      harkmw ./network.n ${f};
    done
    

    Of course, you can also do the following.

    
    for f in your_path/*.wav; do
      harkmw ./network.n ${f};
    done
    

    Note:
    Generally, you should also change the output file. If you forget your changes, they will be overwritten during the loop. Do the same with parameters that set the output filename (or parameters that affect the output filename) for SaveWavePCM or Save...(your save node name)... in a similar way to the input file. The difference is that it uses ARG2 which means the second argument.

    Best regards,
    HARK support team

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.