Login / Register  0 items | $0.00 New#KVRDeals
User avatar
Alpha Trion
KVRer
 
6 posts since 1 May, 2017, from Franklin, TN.

Postby Alpha Trion; Tue May 02, 2017 10:56 am Mixbus Scripting Engine (Lua)

I'm a pretty recent lurker here at the KVR forums, and only just today found out about the "development" section, as it were, so I hope I don't step on anybody's toes or come off as a total noob.

First let me introduce myself: My name is Nik, I am a recent Audio Production graduate and a hobbyist programmer to boot. Now that's out of the way let's talk about plugin development.

In experimenting with audio programming since the new year, I've found quite a nasty barrier-to-entry. Dealing with buffers, audio interfaces, speaker set-ups, the GUI and the DSP itself can be really challenging. At least starting out.

Enter: Mixbus. A DAW that, personally, I had never heard of until I started looking at my post-graduation choices in Tennessee. Researching the software proved it to be a very capable DAW, built on top of an open source foundation (Ardour) with an emphasis on mixing. I thought this looked really neat, but not exactly revolutionary, and decided to get on their mailing list rather than purchasing.

Then, sometime in April, an update to their software was rolled out, and with it came an entire scripting engine.

This thing is really rad. In addition to being able to control nearly every aspect of the DAW, you can write your own DSP plugins in Lua and have Mixbus host them with a generic GUI. It has a super extensive library of Lua bindings for interacting with the sowftware and, because it Ardour is open source, adding new bindings is relatively simple. You can even add inline displays on mixer strips to display waveforms, or to read out parameters.

Reducing the barrier-to-entry for me instrumental in getting my ideas for plugins out of my head and into a tangible medium. I'll share a Sine wave generator I wrote in it for you all to check out (there is a demo available http://harrisonconsoles.com/site/mixbus32c.html) Here's what the code for it looks like:

Code: Select all
ardour {
   ["type"]    = "dsp",
   name        = "SinGen",
   category    = "Instrument",
   license     = "MIT",
   author      = "Nik",
   description = [[Sine Wave Generator (v-1.2)]]
}

function dsp_params ()
   return
   {
      { ["type"] = "input", name = "Frequency", min = 20, max = 20000, default = 1000, unit="Hz", logarithmic = true },
      { ["type"] = "input", name = "Gain", min = -90, max = 0, default = -18, unit="dB" },
   }
end

function dsp_ioconfig ()
   return { [1] = { audio_in = -1, audio_out = -1}, }
end

function dsp_init (rate)
   r = rate
   lpf  = 2048 / rate
end

function low_pass_filter_param(old, new, limit)
   if math.abs (old - new) < limit  then
      return new
   else
      return old + lpf * (new - old)
   end
end

local p  = 0
local fo = 0
local ao = 0

function dsp_run (ins, outs, n_samples)
   local ctrl = CtrlPorts:array() --call parameters
   
   local a = {} --init array
   local f = ctrl[1] or 1000
   local amp =  low_pass_filter_param(ao, ARDOUR.DSP.dB_to_coefficient(ctrl[2]), 0.02)
   local inc = f / r

   for s = 1, n_samples do --fill table with fragments of a sine wave
      p = p + inc
      a[s] = amp * math.sin(p * (2 * math.pi))
   end
   
   for c = 1,#outs do
      outs[c]:set_table(a, n_samples) --passes array into buffer
   end
   
   if f ~= fo then
      self:queue_draw()
   end
   fo = f
   ao = amp
end

function render_inline (ctx, w, max_h) --inline display
   local ctrl = CtrlPorts:array()
   h = 30
   p = 0
   inc = 1/w
   f = ctrl[1] / 1000
   
   if f < 0.5 then f = 0.5 end
   if f > 8 then f  = 8 end
   
   --draw rectangle
   ctx:rectangle(0, 0, w, h)
   ctx:set_source_rgba(0, 0, 0, 1.0)
   ctx:fill()
   ctx:set_line_width(1.5)
   ctx:set_source_rgba(0.8, 0.8, 0.8, 1.0)
   
   l_x = 0
   l_y = 0
   for x = 0,w do
      y = math.sin(f * (2 * math.pi * (p)))
      yc = 0.5 * h + ((-0.5 * h) * y)
      ctx:move_to (x, yc + 3)
      ctx:line_to (l_x, l_y + 3)
      l_x = x
      l_y = yc
      ctx:stroke()
      p = p + inc
   end
   return {w, h + 6}
end


(pastebin: https://pastebin.com/VHHFq4Gp)

As you can see, writing a DSP plugin in this engine is incredibly simple, and best of all I don't have to worry about a GUI or retrofitting my outputs to somebody's 30 year old sound card. I even wrote a dynamic inline display that changes based on the frequency!

I'd love to know what the KVR dev forum thinks about this scripting interface. Do you think this will help people get into making plugins like it did for me?

Also if you'd like to know more about how the script works or the Lua interface, drop me a line in this thread and I'll try to get back to you asap.
Brick is no longer jickable.
VariKusBrainZ
KVRAF
 
6923 posts since 16 Dec, 2002

Postby VariKusBrainZ; Tue May 02, 2017 11:06 am Re: Mixbus Scripting Engine (Lua)

Check out VSTforx, its modular, crazy cheap and does a bunch of really cool stuff.
But, for this thread Ill just point out that it also features LUA programming

https://www.vstforx.de/
The future is yesterday
Ivan_C
KVRian
 
1021 posts since 11 Aug, 2004, from Marcoussis, France

Postby Ivan_C; Tue May 02, 2017 11:19 am Re: Mixbus Scripting Engine (Lua)

Reaper and JSFX are very cool to do the same thing also, and you can find a lot of examples on the Cockos forums
User avatar
Alpha Trion
KVRer
 
6 posts since 1 May, 2017, from Franklin, TN.

Postby Alpha Trion; Tue May 02, 2017 11:37 am Re: Mixbus Scripting Engine (Lua)

Ivan_C wrote:Reaper and JSFX are very cool to do the same thing also, and you can find a lot of examples on the Cockos forums


I tried out Reaper's and it was solid, definitely, but I felt some features were missing that ardour/mixbus provided healthy support for.

VariKusBrainZ wrote:Check out VSTforx, its modular, crazy cheap and does a bunch of really cool stuff.
But, for this thread Ill just point out that it also features LUA programming

https://www.vstforx.de/


This is really neat! I'll have to check this out, if not for the Lua definitely for the plugin host.
Brick is no longer jickable.
Dozius
KVRian
 
829 posts since 26 Oct, 2005, from Canada City

Postby Dozius; Tue May 02, 2017 2:43 pm Re: Mixbus Scripting Engine (Lua)

If you like Lua, Protoplug is also pretty interesting.

https://github.com/pac-dev/protoplug
User avatar
Alpha Trion
KVRer
 
6 posts since 1 May, 2017, from Franklin, TN.

Postby Alpha Trion; Wed May 03, 2017 5:55 am Re: Mixbus Scripting Engine (Lua)

Dozius wrote:If you like Lua, Protoplug is also pretty interesting.

https://github.com/pac-dev/protoplug


I actually hadn't heard of Protoplug until now. Seems like exactly the kind of thing I'd be interested in. How does it handle GUI's?

Also the project seems more or less like it's not actively being updated, does it still work in newer DAWs?
Brick is no longer jickable.
Miles1981
KVRian
 
1272 posts since 26 Apr, 2004, from UK

Postby Miles1981; Wed May 03, 2017 6:41 am Re: Mixbus Scripting Engine (Lua)

The code seems to be based on JUCE, so should be easy to compile with JUCE 5 and Lua 5.1 (or greater?).
It seems to be quite simple enough to be adapted with other JITs or even interpreters, nice.
Chrisboy2000
KVRist
 
31 posts since 21 Apr, 2008, from Germany

Postby Chrisboy2000; Wed May 03, 2017 7:42 am Re: Mixbus Scripting Engine (Lua)

Protoplug does not support 64 bit on OSX though...
VariKusBrainZ
KVRAF
 
6923 posts since 16 Dec, 2002

Postby VariKusBrainZ; Wed May 03, 2017 8:37 am Re: Mixbus Scripting Engine (Lua)

Another one, though not cheap is
Plug n Script from Blue Cat Audio.
No Lua though it does support a few programming languages

https://www.bluecataudio.com/Products/P ... ugNScript/
The future is yesterday
Dozius
KVRian
 
829 posts since 26 Oct, 2005, from Canada City

Postby Dozius; Wed May 03, 2017 12:09 pm Re: Mixbus Scripting Engine (Lua)

Alpha Trion wrote:I actually hadn't heard of Protoplug until now. Seems like exactly the kind of thing I'd be interested in. How does it handle GUI's?

Also the project seems more or less like it's not actively being updated, does it still work in newer DAWs?


I haven't used it in awhile, just have it bookmarked because it seems neat. If I recall parameters are available as generic sliders on one page and then you can do custom drawing on another page if you need a better GUI.

I don't see any reason for it to not work in newer DAWs. VST 2.x interface hasn't changed in forever.

Chrisboy2000 wrote:Protoplug does not support 64 bit on OSX though...


Is this explicitly stated somewhere? I don't see it. nevermind, I see it in the issues. Looks like the problem is with LuaJIT itself. Wonder if it's been fixed?
Mayae
KVRian
 
520 posts since 1 Jan, 2013, from Denmark

Postby Mayae; Wed May 03, 2017 1:50 pm Re: Mixbus Scripting Engine (Lua)

I'd love to know what the KVR dev forum thinks about this scripting interface. Do you think this will help people get into making plugins like it did for me?
I think it's fantastic and as you say - even for experienced audio programmers - it is instrumental to have a rapid prototyping environment.

I'll also shamelessly promote my own plugin here (the audio programming environment one in my signature); mainly because I was having pretty much the same experience as you have. Seeing as I will be taking a look at it soon I wouldn't mind hearing what would make it greater.

OTOH, I'll also add that you can script ableton through a python layer, and bitwig studio should also have extensive daw scripting support
VariKusBrainZ
KVRAF
 
6923 posts since 16 Dec, 2002

Postby VariKusBrainZ; Wed May 03, 2017 1:57 pm Re: Mixbus Scripting Engine (Lua)

I suppose Cabbage deserves a mention too, the excellent environment for creating Vst plugins with Csound.

It's worth downloading just to compile and export all the examples, which literally only takes a few minutes.
The future is yesterday
Groundhog #31684
KVRist
 
113 posts since 23 Jun, 2015

Postby Groundhog #31684; Thu May 04, 2017 7:00 am Re: Mixbus Scripting Engine (Lua)

Alpha Trion wrote:
Ivan_C wrote:Reaper and JSFX are very cool to do the same thing also, and you can find a lot of examples on the Cockos forums


I tried out Reaper's and it was solid, definitely, but I felt some features were missing that ardour/mixbus provided healthy support for.

Could you give an example of a missing feature?
BenLoftis
KVRist
 
81 posts since 13 Oct, 2009, from Nashville, TN

Postby BenLoftis; Thu May 04, 2017 9:00 am Re: Mixbus Scripting Engine (Lua)

Groundhog #31684 wrote:Could you give an example of a missing feature?


The script (by the OP) draws a plugin GUI in the channelstrip. It looks like this:
Image
Does Reaper allow that?

I guess the fundamental difference is that Reaper gives you access to a (very rich) API. Whereas Ardour/Mixbus is actually open-source, so there's no line between what you can do, and what you can't.

-Ben at Harrison
User avatar
Alpha Trion
KVRer
 
6 posts since 1 May, 2017, from Franklin, TN.

Postby Alpha Trion; Thu May 04, 2017 11:04 am Re: Mixbus Scripting Engine (Lua)

Groundhog #31684 wrote:
Alpha Trion wrote:
Ivan_C wrote:Reaper and JSFX are very cool to do the same thing also, and you can find a lot of examples on the Cockos forums


I tried out Reaper's and it was solid, definitely, but I felt some features were missing that ardour/mixbus provided healthy support for.

Could you give an example of a missing feature?


Mainly things like being able to iterate through an array of all track/route names, midi events, regions, transients etc, writing your own inline displays as Ben said above, or being able to write your own automation, I even found out today you can side chain routes to one another.

Really just small differences, and I'm not sure to what extent these have been 'solved', as it were. I just found these things to be incredibly easy to do in Ardour/Mixbus, whereas in ReaScript I had to find work-arounds. Still really cool, and I don't mean to downplay how incredible ReaScript really is.

Dozius wrote:I don't see any reason for it to not work in newer DAWs. VST 2.x interface hasn't changed in forever.


This is true, I don't think that VST support would ever be pulled from my favorites, but I'm finding some of my DAWS are slowly phasing it out, which is sad :(
Brick is no longer jickable.
Next

Moderator: Moderators (Main)

Return to DSP and Plug-in Development