this is totally prealpha-OMG-IT'S-FULL-OFF-FAIL-state..

https://github.com/fps/jiss

requirements: SWIG, libjack-dev and liblua5.1-dev on ubuntu..

compile with make (if it fails, you're on your own. it's a simple makefile though). then run in the build dir:

lua wicked.lua

if you have jass running with a piano sample on midi channel 0, a bass drum on channel 1 and a hihat on 2 you should get a rather weird interpretation of "stella by starlight", a jazz standard..

something like this (some effects added with jack-rack):

http://shirkhan.dyndns.org/~tapas/stella.ogg

(wicked.lua code here with some omission of some chords at the start and some remarks in comments added):

-- some stuff :D
require "jiss"
require "jissing"

-- create engine in stopped state
e = jiss.engine()

-- setup some state that the sequences later use
-- e:run can only be used when the engine is stopped..
-- as this is executed in non-RT context it's ok to
-- create some variables and tables here..
e:run([[
    bar = 0;
    min = 20;
    max = 80;
    stella = {
        range(min, 80, min7b5(E(4))),
        range(min, 80, min7b5(E(4))),

        -- cut away quite a bit here (see wicked.lua in git clone) :D

        range(min, 80, maj7s11(B(4)-1)),
        range(min, 80, maj7s11(B(4)-1))
    }
]])

-- this sequence can control the others since it's processed before
-- the others in the engine
-- events string is newline sensitive. in this case the events
-- on consecutive lines are spaced 1 second apart..
-- also: loop back to 0 at time t = 8 sec
tune = seq(e, "tune", loop_events(8, events_string(1, [[
drums1:relocate(0.0); drums1:start_(); notes:relocate(0.0); notes:start_()




    drums1:stop_();

]])))

-- manually start this sequence and add to the engine
tune:start()

-- note that a copy is appended to the engine
e:append(tune)


-- a sequence that controls the global variable bar to advance through the song
play(e, seq(e, "control", loop_events(1, events_string(1, [[
    bar = bar + 1; bar = (bar % #stella);
]]))))


-- events at fixed times. loop at t = 0.75 sec
play(e, seq(e, "notes",
loop_events(0.75, {
{ 0.125, [[ for i = 1,4 do note_on(0, 24 + stella[bar][math.random(#stella[bar])], 30 + math.random()*64) end ]] }, { 0.5, [[ for i = 1,2 do note_on(0, 24 + stella[bar][math.random(#stella[bar])], 10 + math.random()*34) end ]] }
})))

-- a drum pattern
drums = [[
    note_on(1, 64, 127); note_on(2, 64, 127)
    note_on(2, 64, 127)
    note_on(2, 64, math.random(127))
    note_on(2, 64, math.random(127))
    note_on(2, 42, 110)
    note_on(2, 64, 127)
    note_on(2, 64, math.random(127))
    note_on(1, 64, 127); note_on(2, 64, 127)
    note_on(2, 64, math.random(127))
]]

play(e, seq(e, "drums1", loop_events(1, events_string(0.125/2, drums))))



-- connect all sequence outputs to jass:in
connect(e,"jass:in")

-- run the whole thing
e:start()

-- wait for the user to press enter
io.stdin:read'*l'


Have fun,

Flo
_______________________________________________
Linux-audio-dev mailing list
[email protected]
http://lists.linuxaudio.org/listinfo/linux-audio-dev

Reply via email to