Skip to content

osch/lua-ljack

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
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 

LJACK

Licence build status Install

Lua binding for the JACK Audio Connection Kit.

This binding enables Lua scripting code to registrate ports and to manage port connections and Lua audio processor objects for the JACK Audio Connection Kit. Realtime audio processing of Lua processor objects has to be implemented in native C code.

Further reading:

First Example

  • This example lists all JACK ports and connects the first MIDI OUT port with the first MIDI IN port if these are available:

    local ljack = require("ljack")
    
    local client = ljack.client_open("example01.lua")
    
    local function listPorts(type, direction)
        local list = client:get_ports(".*", type, direction)
        print("Ports", type, direction)
        for _, p in ipairs(list) do
            print("     ", p)
        end
        print()
        return list
    end
    
    local audioOutList = listPorts("AUDIO", "OUT")
    local audioInList  = listPorts("AUDIO", "IN")
    
    local midiOutList = listPorts("MIDI", "OUT")
    local midiInList  = listPorts("MIDI", "IN")
    
    if #midiInList > 0 and #midiOutList > 0 then
        local p1, p2 = midiOutList[1], midiInList[1]
        print(string.format("Connecting %q\n"..
                            "      with %q...", p1, p2))
        client:connect(p1, p2)
    end