(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
Linux-audio-dev(a)lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev