Commit c6009a59 authored by jhammen's avatar jhammen
Browse files

initial import scripts

parent 47c1d748
patches <- [
"AD1 Big Mono",
"AD1 Popsticks",
"AD1 Splitsticks",
"AD1 Rockstock",
"AD1 Rockstock AAX Cymbals", // 4
"AD1 Rockstock Low Toms",
"AD1 Rockstock Chad Smith",
"AD1 Rockstock Gretsch Gene Krupa",
"AD1 Rockstock Ludwig Maple", // 8
"AD1 Rockstock Mapex Brass Master",
"AD1 Rockstock Orange County Maple",
"AD1 Rockstock Mapex Black Panther",
"AD1 Rockstock Pearl Free-Floating", // 12
"AD1 Rockstock Pearl Masters 12",
"AD1 Rockstock Pearl Masters 14",
"AD1 Rockstock Pearl Piccolo",
"AD1 Rockstock Premier 10" // 16
]
local handrumr2 = Lv2.Plugin("http://j2page.org/lv2/handrumr2", patches[0])
midiin <- Midi.Input("midiin", regex("a2j:E-MU XMidi.*"))
midiin.onProgramChange(function(pc, m) {
local prog = pc.program
if(prog < patches.len()) {
println("loading program " + patches[prog])
handrumr2.preset(patches[prog])
} else {
println("error: no preset at program " + prog)
}
})
// TODO: add limiter to chain?
midiin => handrumr2 => Audio.StereoOutput("out", true)
Script.stayAlive()
local presets = [
"AD1 Rockstock",
"AD1 Rockstock Chad Smith",
"AD1 Rockstock Gretsch Gene Krupa",
"AD1 Rockstock Ludwig Maple",
"AD1 Rockstock Mapex Brass Master",
"AD1 Rockstock Mapex Black Panther",
"AD1 Rockstock Orange County Maple",
"AD1 Rockstock Pearl Free-Floating",
"AD1 Rockstock Pearl Masters 12",
"AD1 Rockstock Pearl Masters 14",
"AD1 Rockstock Pearl Piccolo",
"AD1 Rockstock Premier 10"
]
local handrumr2 = Lv2.Plugin("http://j2page.org/lv2/handrumr2", presets[0])
local out = Audio.StereoOutput("out", true)
//function testpattern(start, pitch) {
// local note = Midi.Note(pitch, 127, 0.25)
// for(local i = 0; i < 4; i++) {
// handrumr2.schedule(note, start + i * 0.25)
// }
//}
local midi = Midi.File("checkgains.mid").track[0]
function testpattern(start, pitch) {
handrumr2.schedule(midi, start)
}
local start = 1.5
local index = 1
local sec = 10.5
function test(goal) {
handrumr2.grab(sec, function(clip) {
local lufs = clip.lufs()
println(presets[index-1] + ": " + lufs)
out.play(clip)
if(index < presets.len()) {
handrumr2.preset(presets[index++])
Time.def.restart()
}
}, start)
}
testpattern(start, 38)
test(-28)
//handrumr2.onWorkResponse(@(m) Time.def.start())
Time.def.start()
// check that all HDR configs are used in a preset
map <- {}
local ttldir = IO.Folder("..")
foreach(child in ttldir.children()) {
if(child.name.endsWith(".ttl")) {
local body = child.readAll()
foreach(line in body.split("\n")) {
local results = regex("[a-z,0-9]+\\.hdr").find(line)
if(results.len()) {
local inst = regex(@".*instrument""\s*:\s*""([^""]+).*").match(line)
local key = results[0].match + ":" + inst[1]
map[key] <- child.name
}
}
}
}
hdir <- IO.Folder("../hdr")
local lost = 0
local counter = 0
foreach(child in hdir.children()) {
json <- IO.Json().read(child)
foreach(i in json.instruments) {
local key = child.name + ":" + i.iname
if(key in map) {
// println(key + " -> " + map[key])
counter++
} else {
println(key + " NOT MAPPED")
lost++
}
}
}
println("mapped: " + counter)
println("NOT mapped: " + lost)
local fpath = "/usr/share/sounds/handrumr/AD-TapeSeriesOneBundle.zip"
map <- {}
// read hdr
hdir <- IO.Folder("../hdr")
foreach(child in hdir.children()) {
json <- IO.Json().read(child)
foreach(i in json.instruments) {
foreach(l in i.layers) {
foreach(s in l.samples) {
map[s.file] <- child.name
}
}
}
}
// read zip
zip <- IO.Zip(fpath)
local lost = 0
local counter = 0
foreach(entry in zip) {
local name = entry.name
if(name.endsWith(".wav") // filter wav files
&& name.find("Spec") == -1 // ignore "special" snares
&& name.find(" ") == -1 // spaces in the name = duplicate
) {
if(name in map) {
// println(name + " -> " + map[name])
counter++
} else {
print(name + " ")
println("NOT MAPPED")
lost++
}
}
}
println("mapped: " + counter)
println("NOT mapped: " + lost)
This diff is collapsed.
//preset <- "AD1 Big Mono"
preset <- "AD1 Popsticks"
//preset <- "AD1 Splitsticks"
plugin <- Lv2.Plugin("http://j2page.org/lv2/handrumr16", preset)
Midi.Input("input")
=> plugin
=> Audio.Mixer(16, 2)
=> Audio.StereoOutput("out", true)
Script.stayAlive()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment