VST LUA beta -- midi scripting VST
-
- KVRist
- 206 posts since 24 Jun, 2003
hello, can this VST LUA plugin re-harmonize incoming midinotes and chords to match another stream of notes ? Im using Flstudio 7 and i want to "force-match"
one pianroll to another. Also could VST LUA do generative rhythms ??
one pianroll to another. Also could VST LUA do generative rhythms ??
-
- KVRist
- Topic Starter
- 50 posts since 30 Mar, 2006 from Glasgow, UK
I'm not sure what you mean by force-match? It could force things to a scale or key, and derive that from an incoming stream on another channel I suppose. I have a forcetoscale script, I've pasted it below, might give a starting point.Timbre wrote:hello, can this VST LUA plugin re-harmonize incoming midinotes and chords to match another stream of notes ? Im using Flstudio 7 and i want to "force-match"
one pianroll to another. Also could VST LUA do generative rhythms ??
It can certainly do generative rhythms, see scripts/rhythmic.lua for the very simplest possible example.
Code: Select all
vprint("Force to scale. Choose scales in the GUI panel\n")
scale_list = {}
--get the lists of modes (these are defined in the init scripts)
for k,v in pairs(modes) do
table.insert(scale_list, k)
end
--initialise
curscale = modes[scale_list[1]]
--create the gui
function openCb()
scalemenu = guiAddControl({x=20, y=90, type=GUITypes.menu, label="Scale Types", menu = scale_list})
end
function midiEventCb(midiEvent)
--repitch incoming notes
if midiEvent.type==midi.noteOn or midiEvent.type==midi.noteOff then
note = midiEvent.byte2
--de-octave
note = note % 12
octave = midiEvent.byte2 - note
minNote = 100
bestNote = note
--find best matching note
for i,v in ipairs(curscale) do
n = v % 12
if math.abs(n-note)<minNote then
minNote = math.abs(n-note)
bestNote = n
end
end
--send back new note with right octave
midiEvent.byte2 = bestNote + octave
sendMidi(midiEvent)
end
end
--respond to gui events
function valueChangedCb(tag, value, text)
if tag==scalemenu then
curscale = modes[scale_list[value+1]]
end
end
-
- KVRist
- 487 posts since 19 Jan, 2003
I didn't have a chance to investigate that last night before I had to get some sleep, normally I always open them in pairs (one to and one from the osc device).tzec wrote: Contrast: does this happen with sending, or only with receiving? I only have receiving problems here.
I'll check it out when I get home from work but I would guess it's the same on my end.
-
- KVRian
- 514 posts since 2 May, 2004
This exists already...Timbre wrote:hello, can this VST LUA plugin re-harmonize incoming midinotes and chords to match another stream of notes ? Im using Flstudio 7 and i want to "force-match"
one pianroll to another. Also could VST LUA do generative rhythms ??
What we could use is a script where incoming midi notes coming from a midfile player or a looper get forced to chords played from the midi controller.
-
- KVRian
- 514 posts since 2 May, 2004
Geat!tzec wrote:Yes, I'll try and get one out this weekend. Network bug is fixed, along with many others. A few new features too; makes it a bit simpler to use.
I have been trying to make some code. I realy need more help files or more lua scripts that actualy work. It would be perfect if examples had more comments. I assume that Vstlua should be used by many thousends of users ,not just those who are already very good in programming. More examples with comments would be enough for almost anybody who read "Beginning Programming For Dummies" and http://www.borg.com/~jglatt/tutr/miditutr.htm
http://lua-users.org/wiki/TutorialDirectory
How about simple midi buffer code or midi looper code?
Thanks gain for a great plugin!!!!!!
-
- KVRist
- Topic Starter
- 50 posts since 30 Mar, 2006 from Glasgow, UK
0.06 is here. I expect the usual slew of bugs. It at least works in eXT, Reaper, saviHost, FL Studio 7 and Buzz here; I haven't tested Live.
http://t-zec.org/vstlua/vstlua-0.06.zip
New things:
The documentation now actually documents all the functions.
Many Lua extensions compiled in (bitwise operators, binary structs, better random numbers, true coroutines)
Networking works again.
SysEx support (not very useful atm, as virtually no hosts support VST sysex, except for VSTHost).
Infinite loop trapping added, along with partial execution support.
Persistent storage of data between sessions (either globally or inside presets)
Fast interprocess messaging via shared memory, so multiple instances of VstLua can talk with minimum latency.
setHostTime added (for Bidule users).
much simplified GUI access.
Easier to do midi mapping with the new addMidiFilter() function.
Console window, so commands can be run and executed immediately
Scripts are associated with presets (i.e. loading a preset loads the associated script too). (thanks for the idea austinfx!)
There's a midi looper script too, maki In fact, check out the script list at http://t-zec.org/vstlua/scripts.html
I'll try and add some simple, commented scripts so that people can get going with things.
http://t-zec.org/vstlua/vstlua-0.06.zip
New things:
The documentation now actually documents all the functions.
Many Lua extensions compiled in (bitwise operators, binary structs, better random numbers, true coroutines)
Networking works again.
SysEx support (not very useful atm, as virtually no hosts support VST sysex, except for VSTHost).
Infinite loop trapping added, along with partial execution support.
Persistent storage of data between sessions (either globally or inside presets)
Fast interprocess messaging via shared memory, so multiple instances of VstLua can talk with minimum latency.
setHostTime added (for Bidule users).
much simplified GUI access.
Easier to do midi mapping with the new addMidiFilter() function.
Console window, so commands can be run and executed immediately
Scripts are associated with presets (i.e. loading a preset loads the associated script too). (thanks for the idea austinfx!)
There's a midi looper script too, maki In fact, check out the script list at http://t-zec.org/vstlua/scripts.html
I'll try and add some simple, commented scripts so that people can get going with things.