Saturday 2 September 2017

HALion Script File listing tool

Just wrote a little Ruby script to solve a few problems I encountered in HALion while trying to select and load samples from a directory using a macropage dropdown. 

First of all the problem it solves:
Problem 1: HALion
-I wanted to switch samples of a zone using a dropdown on my macropage. But I did not want to load layers or change presets or anything that could potentially contain the path information.
- The workarround is using a table with filename/path pairs. Like this:

sampleSearchPath = "/Users/myUser/Documents/Steinberg/HALion/Recordings/"

builtInSamples = {
    { name = "Growlar-A#5.wav", path = sampleSearchPath.."Growlar-A#5.wav"},
    { name = "Growlar-A#5.wav", path = sampleSearchPath.."Growlar-A#5.wav"},
    { name = "Growlar-A5.wav", path = sampleSearchPath.."Growlar-A5.wav"},
    { name = "Growlar-F#5.wav", path = sampleSearchPath.."Growlar-F#5.wav"},
    { name = "Growlar-G#5.wav", path = sampleSearchPath.."Growlar-G#5.wav"},
    { name = "Growlar-G5.wav", path = sampleSearchPath.."Growlar-G5.wav"},
}

- Creating such a table is time intensive, so I created a dumb little script to do that for me. 
Problem 2: LUA
Halion script is restricted to halion. I could not find a way to access the filesystem because io and os are not available.
I used ruby because io and os are bitches to use for what I do and ruby is perfect for file and text stuff. Also i did not want to use popen because ls is not available on windows per default(unless you use linux subsystem to run lua).

The tool is available here:
https://github.com/tekkzoo/halion-script-collection/blob/master/HALionFileListCreator.rb

I only tested this on mac because ruby is preinstalled here. If you have ruby installed on windows it should work there as well, please let me know.

usage: 
 ruby HALionFileListCreator.rb "[path of directory with samples]" "[outputfilename.lua]" 
 example: 
 ruby HALionFileListCreator.rb "/user/Documents/Steinberg/HALion/Recordings/" "/user/myBuiltinSamples.lua"

No comments:

Post a Comment