Skip to content
Lua bindings for the JACK Audio Connection Kit
C Lua Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Rebuilt doc Jul 10, 2019
examples gui_thru2 example without a separate client thread, gui is running in… Apr 15, 2018
luajack Added luajack.shell utils Jul 12, 2016
src Fix for issue #8 Jul 10, 2019
thirdparty First commit Jul 27, 2015
.gitignore Changes in Makefile Jun 15, 2016
LICENSE First commit Jul 27, 2015
Makefile Doc redrafting Dec 1, 2016
README.md Fixing bugs in README May 20, 2018

README.md

LuaJack: Lua bindings for the JACK Audio Connection Kit

LuaJack is a Lua binding library for the JACK Audio Connection Kit.

It runs on GNU/Linux and requires Lua (>=5.3) and JACK (API >= v0.124.1).

Authored by: Stefano Trettel

Lua logo

License

MIT/X11 license (same as Lua). See LICENSE.

Documentation

See the Reference Manual.

Getting and installing (Ubuntu)

Setup the build environment as described here, then:

$ git clone https://github.com/stetre/luajack
$ cd luajack
luajack$ make
luajack$ sudo make install

Example

The example below creates a JACK client that simply copies samples from an input port to an output port. Other examples can be found in the examples/ directory contained in the release package.

-- Script: example.lua
jack = require("luajack")

-- Open a JACK client:
c = jack.client_open("myclient")

-- Create two ports:
p_in = jack.input_audio_port(c, "port_in")
p_out = jack.output_audio_port(c, "port_out")

-- Load the 'process' chunk:
jack.process_load(c, [[
c, p_in, p_out = table.unpack(arg)

function process(nframes)
   -- Copy the samples from the input port to the output port:
   jack.get_buffer(p_in)
   jack.get_buffer(p_out)
   jack.copy(p_out, p_in) 
end

-- Register the (rt) process callback:
jack.process_callback(c, process)
]], c, p_in, p_out)

-- Register a non-rt callback:
jack.shutdown_callback(c, function() error("shutdown from server") end)

-- Activate the client:
jack.activate(c)

-- Sleep, waiting for JACK to call back: 
jack.sleep()

The script can be executed at the shell prompt with the standard Lua interpreter:

$ lua example.lua

See also

You can’t perform that action at this time.