Skip to content

stetre/luajack

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
doc
July 10, 2019 19:52
July 12, 2016 10:13
src
February 6, 2022 13:24
July 27, 2015 08:21
June 15, 2016 09:03
July 27, 2015 08:21
December 1, 2016 18:44
May 20, 2018 22:48

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

About

Lua bindings for the JACK Audio Connection Kit

Resources

License

Stars

Watchers

Forks

Packages

No packages published