audio language based on Lua, inspired by ChucK
C++ C Objective-C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ckvaudio
ckvmidi
ex
rtaudio
rtmidi
.gitignore
CMakeLists.txt
LICENSE
Makefile
README
ckv.c
ckv.h
ckvm.c
ckvm.h
configure
luabaselite.c
pq.c
pq.h
rtaudio_wrapper.cpp
rtmidi_wrapper.cpp

README

--
--    ckv
--
--  an audio language based on Lua,
--       inspired by ChucK
--
--      http://ckvlang.org/
--
--   Primary Author:
--      Tom Lieber tom@alltom.com
--
--
-- INSTALL:
--
--   detailed installation instructions are in the tutorial:
--     http://ckvlang.org/tutorial.html
--
--   but for advanced users, this is all you need to know:
--
--   Dependencies:
--    LUA: download, build, and "make install"
--      http://www.lua.org/
--
--    FFMPEG: download, build, and "make install"
--      http://ffmpeg.org/
--
--   ckv:
--     $ make
--     $ ./ckv -h
--     $ ./ckv README    # this file is an executable example!
--     $ ./ckv ex/01.ckv
--     $ ./ckv ex/02.ckv
--     $ ./ckv ex/03.ckv ex/03a.ckv ex/03b.ckv
--     $ ./ckv ex/04.ckv

-- EXECUTABLE SUMMARY (run this file)

-- create audio generators in ckv!
-- OOP in Lua is kind of weird, but simple:
--   http://lua-users.org/wiki/ObjectOrientedProgramming
function Noise(gain)
  return {
    gain = gain or 1.0,
    tick = function(self)
      self.last = (math.random() * 2.0 - 1.0) * self.gain;
    end
  }
end

ev = Event:new();

function waiter(name)
  while yield(ev) do
    print("take that, " .. name .. string.rep("!", math.random(1, 10)))
  end
end

-- fork(function, arg1, arg2, ...)
fork(waiter, "user");

-- fork an anonymous function
fork(function()
  while yield(ev) do
    local ugens = { "Noise()", "SinOsc()" };
    local which = ugens[math.random(1, 2)];
    
    -- fork_eval code in a string!
    fork_eval("local n = " .. which .. ";"
           .. "connect(n, speaker);"
           .. "yield(second / 2);"
           .. "disconnect(n, speaker);");
  end
end)

global.nb = "to share between script files, put stuff in global!";
print(global.nb .. " and try \"ckv -h\" sometime!");

while true do
  yield(math.random() * second * 4 + 1);
  ev:broadcast();
end