KVR :: Instruments » VST LUA beta -- midi scripting VST [View Original Topic]
There are 219 posts in this topic. Page: 1 2 3


tzec - Mon Nov 05, 2007 10:13 am
Being frustrated with the number of small utility VSTs that are often needed to do simple midi tasks, I decided to write a simple, clean VST which could easily script MIDI manipulation. And, thus, VSTLUA was born. The lovely language Lua is used for simple and efficient scripting.

This allows you to quickly develop scripts to mangle midi events and test them without the pain of VST development. It has a basic custom GUI system, so GUI controls can be scripted from Lua.

Here's an example script (in its entirety):

--simple keytracking for synths that respond to CC74
function midiEventCb(event)
    if event.type==midi.noteOn then
        mevent = setCC(74, event.byte2/2, event.channel)
        mevent.delta = event.delta
        sendMidi(mevent)
    end   
    --remember to send the original event!
    sendMidi(event)       
end


Download it here: http://t-zec.org/vstlua/

[img] http://t-zec.org/vstlua/screen1.gif [/img]

Remember, this is beta and chances are, it won't work for you. Let me know what happens and I'll try and fix it. And post your scripts so I can include in future releases!
Dewdman42 - Mon Nov 05, 2007 10:19 am
Love

OMG, this has been on my todo list for years. Looking forward to checking this out. thanks.
whyterabbyt - Mon Nov 05, 2007 10:25 am
many thanks indeed. Very Happy Very Happy
robenestobenz - Mon Nov 05, 2007 10:37 am
Incredible stuff. Something like this has been needed for ages and it's going to get a lot of use here.
shamann - Mon Nov 05, 2007 10:54 am
Neat. Looking forward to trying it.
Dozius - Mon Nov 05, 2007 11:01 am
hyper
pljones - Mon Nov 05, 2007 11:53 am
Have to add to the "well done" sayers! This could save tons of problems.
koolkeys - Mon Nov 05, 2007 11:57 am
Wow, this sounds extremely useful. I've been intrigued by the KSP language and all it can do, and so this also gets my attention. I really think this will become immensely popular around here.

Many thanks!

Brent
mauseoleum - Mon Nov 05, 2007 12:03 pm
Hmm why don't you hack the SciTE source to do lua midi mangling stuff as well Razz

j/k
foosnark - Mon Nov 05, 2007 12:11 pm
Brilliant. Party!
Dewdman42 - Mon Nov 05, 2007 12:20 pm
What is SciTE?
rl - Mon Nov 05, 2007 1:05 pm
looks great, but...
how is it supposed to work? e.g. print_notes.lua shows incoming notes, but it doesn't seem to send midi. When loaded in ext2 it does not show a midi out connection
tzec - Mon Nov 05, 2007 1:13 pm
err, it should show a midi out connection. I must have missed something out in the VST initialization that eXT expects. Try drummachine.lua -- that definitely should produce output.
runagate - Mon Nov 05, 2007 1:21 pm
tzec, that looks immensely useful

tagging this thread for when I have time to learn to understand it Cool
marce - Mon Nov 05, 2007 1:24 pm
Very Intersting!

I use Harmony Assistant, a Notation and music editor, that use scripts for all kind of tasks (enhance notation, filter midi things, etc) and it use the LUA language. It has made Harmony very powerfull, since users can make their own features and add to the program. If it can make something similar to the midi processing in this VST, i guess your VST will be a succes.
tzec - Mon Nov 05, 2007 1:35 pm
Ah, whoops missed an "s" in the plugin canDo's. Works ok in energyXT now.
RunBeerRun - Mon Nov 05, 2007 3:04 pm
Very cool, reminds me of Hypercyclic. I like the arpeggiator, the rhythmic patch, and drum machine is cool to have in the background as I play a lead over it w/the same synth.

Tested to work in Reaper 1.888. Sort of worked in Savihost thru MidiYoke, drum machine didn't work I think, might need a "running" host even though Savihost should be running, some plugs are like that.
Chris Walton - Mon Nov 05, 2007 3:08 pm
Oi, this is GREAT! Thanks Very Happy
Meffy - Mon Nov 05, 2007 3:28 pm
Oh, great. Now I'll need to learn yet another language. :-}

Very good idea, tzec.
gsoto - Mon Nov 05, 2007 4:28 pm
Great!! Many thanks.

Doesn't show any midi outputs on Maize Studio. I'm not sure if it's the plugin or the host.
disturb - Mon Nov 05, 2007 4:37 pm
i get no midi out port in energyxt 1.4, and in live6 it doesn't seem to output anything ..?
deastman - Mon Nov 05, 2007 4:40 pm
That is so cool! Thank you for making this. Smile
mn - Mon Nov 05, 2007 4:47 pm
Looks interesting, thanks. I'll be checking it out after work. Smile
blurk - Mon Nov 05, 2007 5:42 pm
Nice one. My first question was going to be is this Windows-only or is there a Mac OS version as well, but I see you have open-sourced this, so that's a good move. I've not programmed plugins at all, but it looks like there isn't too much non-portable Windowsy stuff in there and the build process looks nice and portable.

Thanks for this!
Dewdman42 - Mon Nov 05, 2007 8:23 pm
Thanks for sh aring the source. I may try to make an MFX version for Sonar. Speaking of which, I tried it in Sonar7, pulled up one of the scripts, played around on my midi keyboard for a few seconds..the midi monitor worked. When I closed the Window, it crashed sonar.
tzec - Tue Nov 06, 2007 2:58 am
If you downloaded before and found it produced no output/had no midi out port in eXT, redownload it now, it should be fixed. I'm not sure about Live, I remember there being some trickery with MIDI processing VST's. I'll test it later and see. I'm not sure what could have caused the crash in Sonar, I'll look into it.

The scripts included which have timing (drummachine, rhythmic) need to have the host playing in order to sync, so if you don't get anything, check that.
disturb - Tue Nov 06, 2007 4:27 am
tzec wrote:
If you downloaded before and found it produced no output/had no midi out port in eXT, redownload it now, it should be fixed. I'm not sure about Live, I remember there being some trickery with MIDI processing VST's. I'll test it later and see. I'm not sure what could have caused the crash in Sonar, I'll look into it.

The scripts included which have timing (drummachine, rhythmic) need to have the host playing in order to sync, so if you don't get anything, check that.

works now, thanks
Dewdman42 - Tue Nov 06, 2007 9:26 am
Specifically, the crash in sonar happened when I closed the window.
contrast - Tue Nov 06, 2007 1:11 pm
Awesome. I think I posted a request for something like this on some forum here a while back. I'm glad to see someone has finally gotten something like this going.

If you add OSC support you'll really be my hero... Smile
stanlea - Tue Nov 06, 2007 1:20 pm
bump
gsoto - Tue Nov 06, 2007 3:25 pm
MIDI output appears on Maize Studio now. Thumbs Up!
But the load button does nothing Sad. I suspect it may be a host issue though.
Loading works in Cubase LE. Strange thing: the load dialog shows a mini player there (play/stop buttons and volume control), is that intentional?
tzec - Tue Nov 06, 2007 3:30 pm
The plugin uses the host file selector to open things (or the default VSTGUI one if it can't find one). I think that's what creates the play/etc. icons. I guess Maize studio doesn't support that quite right yet...
gsoto - Tue Nov 06, 2007 3:36 pm
Makes sense. Sad
tzec - Wed Nov 07, 2007 3:31 pm
le update!

I've redone the GUI a bit and added some additional GUI features to the scripting itself. A bit more stable (I hope) too.

http://t-zec.org/vstlua/

[img] http://t-zec.org/vstlua/screen2.png [/img]

Changelog:
Ver 0.02

shinier gui
gui component sizes are passed to controls
xypad added (slightly useless, as drag doesn't work yet, only click)
text control added
file selector added
now threadsafe!
menus can be hierarchical

simple scheduler added (see init.lua)
less crashing
fixed midi out not showing in eXT
added getCycle and getBarStart functions
added saveProgramCb and loadProgramCb functions when just before/just after programs changed

compiled in luasockets so network access is possible (maybe we will see OSC sometime soon Smile )
code cleaned up, windows specific stuff moved to separate file as far as possible, other stuff ifdef'd appropriately
photoshop file for the gui is now in the source distribution
contrast - Wed Nov 07, 2007 9:47 pm
Awesome again, thank you for considering OSC support... Smile Maybe it would save quite some work to use oscpack? Just in case you don't already know about it. http://www.audiomulch.com/~rossb/code/oscpack/

I will try to submit some scripts this weekend.
chuck death - Thu Nov 08, 2007 7:48 am
Ooh now this looks interesting. Cheers for this tzec, I'm off to play! Smile
Dewdman42 - Thu Nov 08, 2007 8:07 pm
FYI - This version does not even open in Sonar at all now. If I try to load the VST into a sonar slot, crashes Sonar.
tzec - Fri Nov 09, 2007 1:41 am
Hmmm, that's bad. Dewdman42, are you running a dual-core/multi-core machine? I don't have Sonar to test, but it seems to work in the hosts I've tried (eXT/Reaper/Live), so I suspect it could be hardware difference.
Dewdman42 - Fri Nov 09, 2007 9:37 am
tzec wrote:
Hmmm, that's bad. Dewdman42, are you running a dual-core/multi-core machine? I don't have Sonar to test, but it seems to work in the hosts I've tried (eXT/Reaper/Live), so I suspect it could be hardware difference.


No, not dual or quad. Its a P4.

let me correct the specifics. When Sonar7 starts up it scans for new plugins and does some kind of boot strapping. VSTLua fails during this step. The first version did not fail, the new one does. I have the option to disable it. If I don't disable it and try to run it, that's when it crashes sonar(duh). Anyway, doesn't work.
spacedad - Fri Nov 09, 2007 1:13 pm
it crashes xt1.4.1 .i could copy the error box if it'll help.
WinXP Home.SP2.C-Media Wave Device.NVIDIA GeForce 6200.AMD Athlon 3000+.CPU Speed 2002 mhz.RAM 1024.ASIO4ALL.EnergyXT1.4.1.
Markleford - Fri Nov 09, 2007 1:17 pm
tzec wrote:
I don't have Sonar to test

You could contact Cakewalk and ask for an NFR copy to help debug.

Alternately, you could send me source and I could debug under SONAR. I hesitate to say that, given my extreme lack of free time and energy, but there it is. Mind, the bug could be in SONAR's MIDI bridge/bus, so no guarantees.

- m
Dewdman42 - Fri Nov 09, 2007 1:24 pm
Markleford, the source is already up online at the same webpage where you can download the plugin.
Markleford - Fri Nov 09, 2007 1:25 pm
Dewdman42 wrote:
Markleford, the source is already up online at the same webpage where you can download the plugin.

You're not supposed to tell me this: now I have no excuse for not getting it done! Razz

- m
Dewdman42 - Fri Nov 09, 2007 1:27 pm
Cool
tzec - Fri Nov 09, 2007 1:32 pm
spacedad wrote:
it crashes xt1.4.1 .i could copy the error box if it'll help.
WinXP Home.SP2.C-Media Wave Device.NVIDIA GeForce 6200.AMD Athlon 3000+.CPU Speed 2002 mhz.RAM 1024.ASIO4ALL.EnergyXT1.4.1.


Yes, please copy the error box here, it might give me a clue... Markleford, if you'd like to have a go at debugging it, be my guest!
scuzzphut - Fri Nov 09, 2007 1:35 pm
what a great idea - congrats tzec Smile
Markleford - Fri Nov 09, 2007 1:53 pm
tzec wrote:
Markleford, if you'd like to have a go at debugging it, be my guest!

Now my excuse is wrangling more recent versions of VSTSDK/VSTGUI and cobbling together a MSVC++ project. HiHi

- m
spacedad - Fri Nov 09, 2007 2:01 pm

actually it doesn't crash,just refuses to load the plugin.i presume it is a windows vst plugin?sorry i'm very tired....
WinXP Home.SP2.C-Media Wave Device.NVIDIA GeForce 6200.AMD Athlon 3000+.CPU Speed 2002 mhz.RAM 1024.ASIO4ALL.EnergyXT1.4.1.
tzec - Sat Nov 10, 2007 2:38 pm
Thanks spacedad! It is a windows VST, so it _should_ be working Smile

v0.03 http://t-zec.org/vstlua/vstlua-0.03.zip

Fixed a couple of serious memory issues. These might have been causing the crashing problem, I'm not sure. Also in this release, there's full OSC support. See scripts/netosc for some examples. I just tested it against the OscPack test utilities, as I don't have supercollider or in fact any OSC-enabled app on this machine. Let me know if it works.
contrast - Sat Nov 10, 2007 4:47 pm
Thank you so much! It seems to work great from my initial tests with a Lemur.
RunBeerRun - Sat Nov 10, 2007 7:52 pm
Version 3 doesn't load in Reaper, I went back to version 2 and there it is.
amiga909 - Mon Nov 12, 2007 3:50 pm
I think I already love this thing... I surely love you tzec for your brilliant work. I was praying for a thing like that since kontakts script engine came up. there was also another midi script vst, dam, forgot the name, looked alike the cubase input transformer. also quite powerful but commercial, no freehand scripting and no custom gui's.

some things i'd like to know about vstlua:
- as far as I can see paramter automation is not possible yet. would be very very important. or am I wrong and you can automate/remote-control vst params somehow? (I've read only about parameter saves for presets)
- prolly this is not planned: more user customized midi-vst's. I am heading here in another direction I guess... tho I'd prefer to have my own midi vst dll files. precompiled, a little faster and more control over the GUI (eg window size). just the way you can make GUI's with synthedit. maybe I am talking about 2 versions of vstlua: one version as the existing where you can load scripts on the fly and another standalone version where you have a save-as-vst option and synthedit-alike GUI-making.
- related to the last question. I think the concept of having 1 plug to realize all midi tasks is kewl. still i'd wish to have the ability to cascade multiple lua scripts? you could load multiple scripts into one vstlua instance and have eg. tabs to switch the gui's.

thank you.
austinfx - Tue Nov 13, 2007 2:03 am
I've just whipped up a Visual Studio 2005 project that compiles the VSTLua code, and it appears to work. I did have to do some creative coding (certain types and functions don't exist in Win32), but I'd be glad to share what I've done if you'd like.

It may be just what Markleford needs to get debugging Wink

By the way, I've only known about VSTLua for about.. oh.. 7 hours now. I was at work, and decided to search for "midi scripting", and found this discussion on KVR. I raced home in Seattle traffic to start working with it.

I'm going to automate so much crap with this. Tzec, your plug-in is awesome.

Sean
Markleford - Tue Nov 13, 2007 4:55 am
Now if only I had VS2005 at home! HiHi Does it work with 'Express'?

(And yes, the project file building for MSVC++6 officially kicked my ass and left me dead in the water...)

- m
tzec - Tue Nov 13, 2007 9:27 am
Only very limited net access atm, so some quick replies.

(austinfx) Please feel free to share your compile. You might want to use the latest 0.04 release code at http://t-zec.org/vstlua/vstlua-0.04

(amiga909)
(a) Parameter automation should be there (see the setParameterCb callback and the setVSTParameter/getVSTParameter functions). It might not be working, let me know if it's broken.

(b) I can certainly make a version which compiles dlls, but all this will do is wrap up the script. There's not a lot I can do for efficiency, but I don't think that's a problem at the moment. Some gui flexibility could be added in (like the window size), but I'm keen to keep it relatively simple. It's a good idea though, I'll see if I can get something basic and clean going.

(c) I plan to add cascading. At the moment you can just add a bunch of vstlua instances and chain them together.
austinfx - Tue Nov 13, 2007 2:12 pm
Markleford wrote:
Now if only I had VS2005 at home! HiHi Does it work with 'Express'?

(And yes, the project file building for MSVC++6 officially kicked my ass and left me dead in the water...)

- m


I believe it should work with Express. I'm running Professional, but I don't see anything under Express that should keep this from compiling. Here's a list of things Express doesn't have..

http://msdn2.microsoft.com/en-us/vstudio/aa700921.aspx

It's currently compiling version 0.4. I'm going to try to clean up some folder paths, write a readme, and rip out the VST SDK (want to abide by the somewhat vague VST license concerning distribution). But I'll make it very easy to integrate it back in. I expect I can get this done tonight.

Sean
RunBeerRun - Tue Nov 13, 2007 3:16 pm
The latest release shows up again in Reaper, appreciate the new presets.

Random notes is awesome.
austinfx - Tue Nov 13, 2007 10:43 pm
Ok, have at it.

Check out the README.txt under VS2005. If things don't work, email at
the address there.

http://www.theexplosivebolts.com/VSTLua/VSTLua_VS2005_20071113.zip
Sean
austinfx - Tue Nov 13, 2007 10:45 pm
test
austinfx - Tue Nov 13, 2007 10:45 pm
test2
Alien Leg - Wed Nov 14, 2007 8:03 am
Does it work in Live?
maki - Wed Nov 14, 2007 9:21 am
Any tutorials about Lua language?
Any tutorials about midi functions and classes in Lua?
dougsyo - Wed Nov 14, 2007 10:01 am
maki wrote:
Any tutorials about Lua language?
Any tutorials about midi functions and classes in Lua?

Lua Home Page: http://www.lua.org/
Documentation: http://www.lua.org/docs.html (some downloadable)

I assume the MIDI function documentation comes with VSTLua

Doug
maki - Wed Nov 14, 2007 12:02 pm
http://t-zec.org/vstlua/VstLuaApi.html
-I can see some functions but are there any more examples and ideas how we could use those functions.
-I opened Lua scripts in a text editor and it looks like C and looks very nice. But how can we make new scripts? I have some basic idea about programming but it would be nice with some strightforward descriptions about "how to make something".
-is it possible to define an array of midi events here?Midi buffers?
-how can other functions be implemented in vstLua?
-any timer functions? Examples on how to use it? tutorials?
-it would be nice if t-zec could tell us what text in "Beginning
Lua Programming" and "Lua 5.1 Reference Manual" should be understood best in order to make learning curve easy. This program looks so promissing and it would be sad if lack of such guidlines lead to lack of motivation among all potential users and I see that every computer musician is a potential user.
thanks
Dewdman42 - Wed Nov 14, 2007 11:12 pm
Getting better. Latest version does not crash sonar. However, it also does not enable midi outs.
SuperNashwan - Thu Nov 15, 2007 8:01 am
This looks ace, if lua is easy to learn? I've had an idea I've wanted to realise for a while for generating pitch "sloppiness" in midi to humanise the perfectly regular intonation you get from synths and samples. If this can randomly generate small offsets in midi pitch bend I might finally get round to actually doing it...
austinfx - Thu Nov 15, 2007 11:48 am
SuperNashwan wrote:
This looks ace, if lua is easy to learn? I've had an idea I've wanted to realise for a while for generating pitch "sloppiness" in midi to humanise the perfectly regular intonation you get from synths and samples. If this can randomly generate small offsets in midi pitch bend I might finally get round to actually doing it...


(Sorry in advance if this post is kind of pedantic.. I don't know how much you know about VST internals)

Check out the pitchdrift.lua script. The way VSTLua works is by calling specifically named functions for certain event types. For example, midiEventCb gets called for every midi event. onFrameCb gets called consistently every VSTFrameLength samples. VSTFrameLength is just a number determined by your host. If your sample rate is 48000 samples processed per second, then your host may break this up into 512 sample chunks. onFrameCb gets called once per chunk.

Getting back to pitchdrift.lua, here's what it's doing:


So.. Since you just want it to play with a small error in frequency, you can simplify this and make your own pretty easily. You can get rid of the onFrameCb, because you don't need a continuous effect. I'm not going to test this, but here's my best shot (just put this into a file and load it.. if it doesn't work, then you can start learning Lua Very Happy ):

--START
--bendWidth is the max amount of possible bend - change as needed, or
--learn how to put in a GUI control
bendWidth = 100
function midiEventCb(midiEvent)
    if midiEvent.type==midi.noteOn then
        --math.random() returns a number between 0 and 1
        bendValue = (math.random()-0.5)*bendWidth
        --use the same channel as the event that was input
        eventToSend = pitchBend( bendValue , midiEvent.channel )
        sendMidi( eventToSend )
    end
    --send the original event you played, whatever it may be
    --if it was a noteOn, then at least you've already set the pitch bend
    --amount!
    sendMidi(midiEvent)
end
--END

austinfx - Thu Nov 15, 2007 12:01 pm
Dewdman42 wrote:
Getting better. Latest version does not crash sonar. However, it also does not enable midi outs.


I've never been able to use VST midi-out effects with Sonar. Is that supported directly, or do you need an MFX/DirectX wrapper?

Sean
robenestobenz - Thu Nov 15, 2007 12:32 pm
SuperNashwan wrote:
This looks ace, if lua is easy to learn? I've had an idea I've wanted to realise for a while for generating pitch "sloppiness" in midi to humanise the perfectly regular intonation you get from synths and samples. If this can randomly generate small offsets in midi pitch bend I might finally get round to actually doing it...
It'll have to be monophonic though, or the effect'll be ruined by all notes playing will be shifted by the same amount.

Does anyone know if OSC lets you get round this MIDI limitation?
contrast - Thu Nov 15, 2007 12:59 pm
Short answer is no (or "yes but not really in your typical daw situation"... most daws don't support OSC and I don't think there is currently a standard for sending midi-type data).

You have other options... If the instrument you are sending MIDI to supports it, you could assign polypressure to some pitch modulation and send polypressure instead.

The most general solution is to split the notes up on to 16 different midi channels and send them all to one instrument. Pitchbend is separate for each channel. You can also enforce alternate tunings and whatnot with any instrument (that supports pitchbend) in this manner.
Dewdman42 - Thu Nov 15, 2007 3:52 pm
austinfx wrote:
Dewdman42 wrote:
Getting better. Latest version does not crash sonar. However, it also does not enable midi outs.


I've never been able to use VST midi-out effects with Sonar. Is that supported directly, or do you need an MFX/DirectX wrapper?

Sean


No you don't need any wrapper. But its not straight forward either. You have to put the VST midi plugin into the synth rack and then enable midi outs when you do. (VSTLua is not responding to this option). Once you have a VST midi plugin in the synth rack with the midi outs enabled, then your sonar midi tracks will have that plugin listed as an available midi port to receive midi from.

There is one other thing you have to do to get it to work. You have to take at least one audio track and enable the Vst midi plugin as the audio input for that audio track (even though it is not outputting any audio). For whatever the reason, this is needed for it to function properly.

once you do that, they work fine. I have tried many VST midi plugins this way in sonar and they all work fine.

VST Lua worked also for the first version...it enabled the midi outs...but it crashed. Now it doesn't seem to crash, but the midi outs are not enabled.
kevink - Thu Nov 15, 2007 5:57 pm
Dewdman42 wrote:
austinfx wrote:

I've never been able to use VST midi-out effects with Sonar. Is that supported directly, or do you need an MFX/DirectX wrapper?

No you don't need any wrapper. But its not straight forward either. You have to put the VST midi plugin into the synth rack and then enable midi outs when you do. (VSTLua is not responding to this option). Once you have a VST midi plugin in the synth rack with the midi outs enabled, then your sonar midi tracks will have that plugin listed as an available midi port to receive midi from.

There is one other thing you have to do to get it to work. You have to take at least one audio track and enable the Vst midi plugin as the audio input for that audio track (even though it is not outputting any audio). For whatever the reason, this is needed for it to function properly.

once you do that, they work fine. I have tried many VST midi plugins this way in sonar and they all work fine.

Does that include Tobybear's Arpimides? I was trying to figure out how to use VST MIDI fx instead of MFX, and picked Arpimides at random as my test subject, but even with your trick of having an audio track select its output (given the general way that VSTi plugs work in Sonar, I should have thought of that, but hadn't), it seems like all I can get is a "pass through" function with no transformation (in this case, no arpeggiation).
Dewdman42 - Thu Nov 15, 2007 6:17 pm
put the plugin into synth rack. When adding it, there is an option in the dialog to enable midi outs. Enable them. Once its in the synth rack, go to the midi track where you want to use it and select this plugin as the synth. Then go to another midi track and select this plugin as the midi input. Then go to an audio track and enable this plugin as the audio input(even though there is no audio). Then it should work.

Having said that. sonar will not play forward without some midi or audio data on the track. So if the plugin requires sonar to be PLAYING in order to do something, then arm a track for record and hit record. It should all work. It has worked for every other midi plugin I ever tried except for vstlua
Dewdman42 - Thu Nov 15, 2007 6:19 pm
and yes its a royal pain that you have to use 3 tracks in sonar in order to use a midi plugin, but tell it to cakewalk. Maybe in the future they will make it possible to use these directly inline in a midi track, as is possible with MFX.

but at least it works
tzec - Fri Nov 16, 2007 3:45 am
Thanks, austinfx and dewdman42. Dewdman42, do you mind if I incorporate those instructions into the next manual, since that'll make it bit easier for Sonar folks to get going? I'm adding a bit more documentation to the package, that seems to be a bit of stumbling block right now. I'll try and work out why Sonar doesn't see the midi out as well...
Caco - Fri Nov 16, 2007 4:27 am
tzec wrote:
Thanks, austinfx and dewdman42. Dewdman42, do you mind if I incorporate those instructions into the next manual, since that'll make it bit easier for Sonar folks to get going? I'm adding a bit more documentation to the package, that seems to be a bit of stumbling block right now. I'll try and work out why Sonar doesn't see the midi out as well...


It may need dummy audio outputs if it doesn't have them. Some hosts, e.g. Cubase, can get a bit confused if a plugin has no audio out.
Dewdman42 - Fri Nov 16, 2007 10:42 am
Yep, I would probably agree with the dummy audio outs assessment, which goes hand in hand with the requirement that an audio track has to be enabled for the plugin to work in Sonar at all.

I don't mind if you include my instructions, but it could probably be worded a lot better.

Here are a couple examples from another vst midi plugin that provided Sonar instructions:

http://www.chordspace.com/Playa/SonarInstall.htm

http://www.mucoder.net/tonespace/tonespace_user_manual.htm#_Toc150632292
bulletPip - Fri Nov 16, 2007 1:44 pm
Just started playing with this, but the onFrameCb doesn't seem to be getting called. Using XT2. My test script looks like this:

skip=0
function onFrameCb(frameData)

skip=skip+1

--don't send every frame, keep the messages reasonable
if skip==4 then
hosttime = getHostTime()
vprint(hosttime.tempo.."\n")
end

end

Am I doing something wrong, or is this an XT2 problem?

Doggit
tzec - Fri Nov 16, 2007 3:07 pm
You might want to have skip=0 before the first end, otherwise it will only be called once, but otherwise it looks fine. Might be an XT2 problem, I'll hopefully sort that when I fix the problems with Sonar...
kevink - Fri Nov 16, 2007 3:14 pm
Thanks again to Dewdman42. There's something about the Tobybear arpeggiator that's not compatible with Sonar's VST handling: I can check the "MIDI output" box, but it doesn't really have an output. I tried xoxos' "talent" instead, using the procedures described, and it did work. This is very good news, because it means that one of these days, I really can rework my MFX plugs (http://www.paralogos.com/music/) to be usable outside both inside and outside the Cakewalk universe.
tzec - Sat Nov 17, 2007 10:46 am
OK, another update at http://t-zec.org/vstlua/vstlua-0.05.zip

The changes:

GUI resizing is now possible.
A bunch of bug fixes (of course, I probably added more than I removed...)
Better docs, including a quick guide to Lua.
Key handling.
Drag-n-drop support.
Vu meters.
GUI bitmaps can be overriden by user.
More complex microtuning example script included.

I've enabled audio outputs. However, if you still have problems, the file config.lua specifies exactly what configuration the plugin will have when it is loaded, so you can try disabling inputs/outputs at will.

As for previous requests:

DLL compiling is going to be a real pain, because it'll need to access a whole filesystem (so things like the Lua package search works right). I don't think I'm going get this done anytime soon.
raintalk - Sat Nov 17, 2007 3:38 pm
Thank you Tzec!

This is one seriously interesting plugin. Very nice.

One feature request: support audioMasterSetTime callback - for the hosts that support it.

PS - I can't seem to get to your latest update.
contrast - Sat Nov 17, 2007 3:46 pm
Here is the correct link:

http://t-zec.org/vstlua/vstlua-0.05.zip
Dewdman42 - Sat Nov 17, 2007 8:29 pm
Note - midi output ports still not enabled in Sonar
mbncp - Sun Nov 18, 2007 2:47 am
Dewdman42 wrote:
Note - midi output ports still not enabled in Sonar

lua\config.lua

numInputs = 0
numOutputs = 0
isSynth = 1
tzec - Sun Nov 18, 2007 3:44 am
mbncp wrote:
Dewdman42 wrote:
Note - midi output ports still not enabled in Sonar

lua\config.lua

numInputs = 0
numOutputs = 0
isSynth = 1


Thank you! I knew there must be some combination that would work!
SuperNashwan - Sun Nov 18, 2007 5:26 am
austinfx wrote:

Check out the pitchdrift.lua script. The way VSTLua works is by calling specifically named functions for certain event types...

That looks exceptionally helpful, thanks for taking the time to write all that Smile
Dewdman42 - Sun Nov 18, 2007 9:56 am
sorry, I don't understand. My config.lua looks looked like this:

numInputs = 2
numOutputs = 2
isSynth = 0

I tried changing isSynth to 1, but it made no difference. No midi output ports are appearing in sonar.
tzec - Sun Nov 18, 2007 10:04 am
Dewdman42 wrote:
sorry, I don't understand. My config.lua looks looked like this:

numInputs = 2
numOutputs = 2
isSynth = 0

I tried changing isSynth to 1, but it made no difference. No midi output ports are appearing in sonar.


I think mbncp is suggesting setting both numInputs and numOutputs to 0 and setting isSynth to 1; I guess he's tested that with Sonar?
Dewdman42 - Sun Nov 18, 2007 10:17 am
Setting the outs to 0 and synth to 1, still does not enable midi outputs in Sonar.
mbncp - Sun Nov 18, 2007 10:26 am
Dewdman42 wrote:
Setting the outs to 0 and synth to 1, still does not enable midi outputs in Sonar.


It works here, maybe you need to rescan your VST folder.

Anyway, the bad news is that Sonar's vst-midi is a total disaster, the main problem being that all MIDI events loose their timestamp in the operation.
But as most users don't notice it, I guess it's ok. Rolling Eyes
Dewdman42 - Sun Nov 18, 2007 10:29 am
I will try to rescan.

So please comment further about losing their timestamp. That should not be the case for Sonar in general otherwise nearly all virtual synths in Sonar would have blatantly terrible timing that would get worse with large audio buffers.

???
mbncp - Sun Nov 18, 2007 10:35 am
Dewdman42 wrote:
I will try to rescan.

So please comment further about losing their timestamp. That should not be the case for Sonar in general otherwise nearly all virtual synths in Sonar would have blatantly terrible timing that would get worse with large audio buffers.

???

It's not the same situation, as the midi is sent back to the input in this case. Then it behaves like live midi input, the delta is always 0.
You can check with this:
function midiEventCb(midiEvent)
 if midiEvent.type==midi.noteOn then
        vprint(midiEvent.delta.."  Note on "..numberToNote(midiEvent.byte2).." "..midiEvent.byte3.."\n")
    end
   sendMidi(midiEvent)
end

Dewdman42 - Sun Nov 18, 2007 10:39 am
I would if I could, but vstlua still not working for me here.
mbncp - Sun Nov 18, 2007 10:47 am
Dewdman42 wrote:
I would if I could, but vstlua still not working for me here.

Try to re-start Sonar.
Btw which version do you have (7 here).
Can you check enable midi out now ?
Sometimes Sonar needs to play for the vst-midi to work.
Dewdman42 - Sun Nov 18, 2007 10:55 am
I got it working by removing the pluging from my vstplugins folder, startingand stopping sonar and then putting it back again. (shrug).

it works!

The timestamping issue is a curious one and we should try to get to the absolute bottom of it and then talk to cakewalk if there is something they need to change. But my understanding from recent conversations with Noel, is that the midi events are timestamped when coming into any vst snth for the vst synth to be able to figure out where in time they are supposed to land in the audio buffer. So they should be received by VSTLua with timestamps absolutely. I can't see why they would not, unless VSTLua is eating the timestamps in some way.

Also, I am not sure what is supposed to happen on midi OUTPUT, since there is no rendering to an audio buffer, presumably the midi output must also be timestamped in someway that can be passed on down the midi pipeline, but its an interesting question....is Sonar the one eating that timestamp or is VSTLua?
mbncp - Sun Nov 18, 2007 11:36 am
The problem is with Sonar. The reason is that there is no proper midi routing like in vsthost or ext when sending midi from plug to plug.
Sonar will put the output of a vst midi in the input queue. As it can't deal with it within the same buffer call, it will try to deliver the midi as fast as possible in the next buffer, thus setting the timestamp to 0.
So the next plug in the line receives the event from 1 sample to a full buffer late.
Example, using my vstspy plug, these events should play at the same time, but the one that makes it thru the plug is late.
current time in msec, buffer call, timestamp, midi data
9237593   35197   0368   90   048   108
9237609   35198   0000   90   048   108

As we see the second event is about 16 msec late (not pure science), is not in the same buffer call and the time stamp is 0.

So as my buffer in this case is 1024 samples, the events is delayed by 1024-368 = 656 samples in this case, but could be anything between 1-1023 samples.
Dewdman42 - Sun Nov 18, 2007 11:43 am
Yet something else to complain about Sonar's crappy midi plugin handling.

This situation I guess does not exist for MFX plugins presumably because they are inline in the midi track handling...as opposed to the way we have to use VST midi plugins where the midi output has to appear as a "midi port"...which like you said...just queues up the event as if someone is playing it.

Still, that doesn't explain to me why the midi event coming into VSTLua would have a 0 timestamp. Your explanation does explain why the midi OUTPUT would eat anytimestamps though.
mbncp - Sun Nov 18, 2007 12:17 pm
>>Still, that doesn't explain to me why the midi event coming into VSTLua would have a 0 timestamp

Sorry I didn't make that clear, but it doesn't in the first instance, only in the second one or when playing live in the first one.

Track -> plug is ok
Track -> plug -> plug is bad timing

>>This situation I guess does not exist for MFX plugins presumably because they are inline in the midi track handling...

There are also a couple of problems with mfx, but it's globaly better and doestn't have THAT timing issue.
mbncp - Sun Nov 18, 2007 12:32 pm
Btw, in Sonar, if you chain vst-midi plugs, after each plug the events are delayed by 1 buffer.

Great for a strumming fx, just change the asio buffer size to have a different strumming interval Laughing

There are 219 posts in this topic.
Page: 1 2 3