├── README.md ├── study ├── study1.lua ├── study2.lua └── study3.lua ├── test ├── fourwaves-test.lua ├── param.lua ├── fonts.lua ├── softcut-buffers.lua ├── draw.lua ├── template.lua └── 16sliders.lua ├── lib ├── Engine_SimplePassThru.sc ├── Engine_PolyPerc.sc ├── karplus_rings.lua ├── fourwaves.lua ├── Engine_KarplusRings.sc ├── Engine_TestSine.sc ├── polysub.lua └── Engine_PolySub.sc ├── demos ├── ui.lua ├── scales.lua └── graph.lua └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # we 2 | norns/dust: collected and collaborative projects 3 | -------------------------------------------------------------------------------- /study/study1.lua: -------------------------------------------------------------------------------- 1 | -- many tomorrows 2 | -- norns study 1 3 | -- 4 | -- KEY 2 toggle sound on/off 5 | -- KEY 3 toggle octave 6 | -- ENC 2 randomize amplitude 7 | -- ENC 3 change frequency 8 | -- 9 | -- first turn on AUX reverb! 10 | 11 | engine.name = "TestSine" 12 | 13 | function init() 14 | sound = 1 15 | level = 1 16 | octave =1 17 | f = 100 18 | position = 0 19 | engine.hz(f) 20 | print("the end and the beginning they are the same.") 21 | end 22 | 23 | function key(n,z) 24 | if n == 2 then 25 | if z == 1 then 26 | -- trick below to toggle between 0 and 1 27 | sound = 1 - sound 28 | engine.amp(sound * level) 29 | end 30 | elseif n == 3 then 31 | octave = z + 1 32 | engine.hz(octave * f) 33 | end 34 | end 35 | 36 | function enc(n,d) 37 | if n == 2 then 38 | level = math.random(100) / 100 39 | engine.amp(sound * level) 40 | elseif n == 3 then 41 | position = (position + d) % 11 42 | f = 100 + position * 50 43 | engine.hz(octave * f) 44 | end 45 | end -------------------------------------------------------------------------------- /test/fourwaves-test.lua: -------------------------------------------------------------------------------- 1 | -- fourwaves example 2 | -- softcut sample player 3 | -- 4 | -- K2 make low note 5 | -- K3 make high note 6 | 7 | a = include('we/lib/fourwaves') 8 | 9 | m = metro.init() 10 | 11 | init = function() 12 | a.init() 13 | end 14 | 15 | key = function(n,z) 16 | if z==1 and n==3 then 17 | a.note(math.random(24)-6) 18 | redraw() 19 | elseif z==1 and n==2 then 20 | a.note(math.random(24)-18) 21 | redraw() 22 | end 23 | end 24 | 25 | redraw = function() 26 | screen.clear() 27 | screen.aa(1) 28 | screen.line_width(0.8) 29 | screen.move(64,32) 30 | screen.line_rel(math.random(20),math.random(20)-10) 31 | screen.line_rel(math.random(20),math.random(20)-10) 32 | screen.line_rel(math.random(20),math.random(20)-10) 33 | screen.move(64,32) 34 | screen.line_rel(-math.random(20),math.random(20)-10) 35 | screen.line_rel(-math.random(20),math.random(20)-10) 36 | screen.line_rel(-math.random(20),math.random(20)-10) 37 | screen.stroke() 38 | screen.update() 39 | end 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /test/param.lua: -------------------------------------------------------------------------------- 1 | -- param test 2 | -- see menu > parameters 3 | -- hold key1 inside menu to read/write 4 | 5 | engine.name = 'TestSine' 6 | 7 | function init() 8 | engine.amp(0.1) 9 | params:add_number("num", "num") 10 | params:add_option("output", "output", {"MIDI", "OSC", "SYNTH", "CV"}) 11 | params:add_control("something", "something",controlspec.UNIPOLAR) 12 | params:add_control("freq", "freq",controlspec.FREQ) 13 | params:set_action("freq",engine.hz) 14 | params:add_file("sample", "sample") 15 | 16 | params:read("ptest.pset") 17 | end 18 | 19 | function key(n,z) 20 | if z==1 then 21 | if n == 2 then 22 | params:read("ptest.pset") 23 | elseif n==3 then 24 | params:write("ptest.pset") 25 | end 26 | end 27 | redraw() 28 | end 29 | 30 | function enc(n,d) 31 | if n == 2 then 32 | params:delta("freq",d/10) 33 | elseif n==3 then 34 | params:delta("freq",d) 35 | end 36 | redraw() 37 | end 38 | 39 | function redraw() 40 | screen.clear() 41 | screen.move(0,10) 42 | screen.level(15) 43 | screen.text("freq: "..params:string("freq")) 44 | screen.update() 45 | end 46 | 47 | 48 | function cleanup() 49 | params:write("ptest.pset") 50 | end 51 | -------------------------------------------------------------------------------- /test/fonts.lua: -------------------------------------------------------------------------------- 1 | local font_face = 1 2 | local font_size = 6 3 | local num_fonts = 67 4 | local min_size = 4 5 | local max_size = 18 6 | local aa = 0 7 | 8 | function init() 9 | end 10 | 11 | function redraw() 12 | screen.clear() 13 | screen.aa(aa) 14 | screen.font_face(1) 15 | screen.font_size(8) 16 | screen.move(1, 8) 17 | screen.text("aa = "..aa) 18 | screen.font_face(font_face) 19 | screen.font_size(font_size) 20 | screen.move(1, 20) 21 | screen.text("font face= "..font_face) 22 | screen.move(1, 40) 23 | screen.text("font size= "..font_size) 24 | screen.move(1, 60) 25 | screen.text("quickbrownfox jumplazydog") 26 | screen.update() 27 | end 28 | 29 | function key(n,z) 30 | if n == 2 and z > 0 then 31 | if aa > 0 then aa = 0 else aa = 1 end 32 | redraw() 33 | end 34 | end 35 | 36 | function enc(n,z) 37 | if n == 2 then 38 | font_face = font_face + z 39 | if font_face > num_fonts then font_face = 1 end 40 | if font_face < 1 then font_face = num_fonts end 41 | redraw() 42 | end 43 | if n == 3 then 44 | font_size = font_size + z 45 | if font_size > max_size then font_size = min_size end 46 | if font_size < min_size then font_size = max_size end 47 | redraw() 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /test/softcut-buffers.lua: -------------------------------------------------------------------------------- 1 | -- softcut: buffer read/write test 2 | -- 3 | -- see REPL output 4 | 5 | file = _path.dust.."audio/dont_explain_48k.wav" 6 | ch, dur, sr = audio.file_info(file) 7 | d = dur / sr 8 | 9 | print(file, ch, d, sr) 10 | 11 | sc = softcut 12 | 13 | print("loading (stereo)...") 14 | sc.buffer_read_stereo(file, 0, 0, -1) 15 | 16 | sc.buffer_write_stereo(file..".copy.wav", 0, d) 17 | sc.buffer_write_mono(file..".L.wav", 0, d, 1) 18 | sc.buffer_write_mono(file..".R.wav", 0, d, 2) 19 | 20 | sc.buffer(1, 1) 21 | sc.pan(1, -1) 22 | 23 | sc.buffer(2, 2) 24 | sc.pan(2, 1) 25 | 26 | for i=1,2 do 27 | sc.level(i, 1) 28 | sc.loop(i, 1) 29 | sc.loop_start(i,0) 30 | sc.loop_end(i, d - 1.0) 31 | 32 | sc.play(i, 1) 33 | sc.rec(i, 0) 34 | sc.rate(i, 1) 35 | 36 | sc.position(i, 0) 37 | sc.enable(i, 1) 38 | end 39 | 40 | function key(n,z) 41 | if z == 0 then return end 42 | if n == 2 then 43 | print("loading (mono, reversed channels)...") 44 | sc.buffer_read_mono(file, 0, 0, -1, 1, 2) 45 | sc.buffer_read_mono(file, 0, 0, -1, 2, 1) 46 | end 47 | if n == 3 then 48 | print("reading back L, R mono output...") 49 | sc.buffer_read_mono(file..".L.wav", 0, 0, -1, 1, 1) 50 | sc.buffer_read_mono(file..".R.wav", 0, 0, -1, 2, 2) 51 | end 52 | 53 | end 54 | -------------------------------------------------------------------------------- /lib/Engine_SimplePassThru.sc: -------------------------------------------------------------------------------- 1 | Engine_SimplePassThru : CroneEngine { 2 | 3 | var amp=0; 4 | var "..numbers[i]) 74 | end 75 | 76 | -- show timer 77 | screen.move(0, 63) 78 | screen.text("> "..t) 79 | 80 | -- refresh screen 81 | screen.update() 82 | end 83 | 84 | -- called on script quit, release memory 85 | function cleanup () 86 | numbers = nil 87 | end 88 | -------------------------------------------------------------------------------- /test/16sliders.lua: -------------------------------------------------------------------------------- 1 | -- 16sliders 2 | -- 3 | -- step sequencing a mono sine 4 | -- 5 | -- enc 2 = select step 6 | -- enc 3 = tune step 7 | -- key 2 = random walk 8 | -- key 3 = mutate 9 | 10 | local sliders = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 11 | local edit = 1 12 | local accum = 1 13 | local step = 0 14 | 15 | engine.name = 'TestSine' 16 | 17 | local k = metro[1] 18 | k.count = -1 19 | k.time = 0.1 20 | k.event = function(stage) 21 | step = (step + 1) % 16 22 | engine.hz(2^(sliders[step+1]/12) * 80) 23 | redraw() 24 | end 25 | 26 | function init() 27 | print("16sliders: loaded engine") 28 | engine.hz(100) 29 | engine.amp(0.1) 30 | k:start() 31 | end 32 | 33 | function enc(n, delta) 34 | if n == 1 then 35 | params:delta("output_level", delta) 36 | elseif n == 2 then 37 | accum = (accum + delta) % 16 38 | edit = accum 39 | elseif n == 3 then 40 | sliders[edit+1] = sliders[edit+1] + delta 41 | if sliders[edit+1] > 32 then sliders[edit+1] = 32 end 42 | if sliders[edit+1] < 0 then sliders[edit+1] = 0 end 43 | end 44 | redraw() 45 | end 46 | 47 | function key(n, z) 48 | if n == 2 and z == 1 then 49 | sliders[1] = math.floor(math.random()*4) 50 | for i=2, 16 do 51 | sliders[i] = sliders[i-1]+math.floor(math.random()*9)-3 52 | end 53 | redraw() 54 | elseif n == 3 and z == 1 then 55 | for i=1, 16 do 56 | sliders[i] = sliders[i]+math.floor(math.random()*5)-2 57 | end 58 | redraw() 59 | end 60 | end 61 | 62 | function redraw() 63 | screen.aa(1) 64 | screen.line_width(1.0) 65 | screen.clear() 66 | 67 | for i=0, 15 do 68 | if i == edit then 69 | screen.level(15) 70 | else 71 | screen.level(2) 72 | end 73 | screen.move(32+i*4, 48) 74 | screen.line(32+i*4, 46-sliders[i+1]) 75 | screen.stroke() 76 | end 77 | 78 | screen.level(10) 79 | screen.move(32+step*4, 50) 80 | screen.line(32+step*4, 54) 81 | screen.stroke() 82 | 83 | screen.update() 84 | end 85 | -------------------------------------------------------------------------------- /lib/Engine_KarplusRings.sc: -------------------------------------------------------------------------------- 1 | // Pluck uGen workout. Shout me @burn on llllllll.co if you need any assistance. 2 | 3 | Engine_KarplusRings : CroneEngine { 4 | var pg; 5 | var amp=0.1; 6 | var freq = 440; 7 | var decay = 5; 8 | var coef = 0.1; 9 | var lpf_freq = 3000; 10 | var lpf_gain = 1; 11 | var bpf_freq = 2000; 12 | var bpf_res = 0.3; 13 | var pan = 0.0; 14 | 15 | *new { arg context, doneCallback; 16 | ^super.new(context, doneCallback); 17 | } 18 | 19 | alloc { 20 | pg = ParGroup.tail(context.xg); 21 | 22 | SynthDef("karplus_rings", {arg out, amp = amp, freq = freq, decay = decay, coef = coef, lpf_freq = lpf_freq, lpf_gain = lpf_gain, bpf_freq = bpf_freq, bpf_res = bpf_res, pan = pan; 23 | var env, snd; 24 | env = EnvGen.kr(Env.linen(0, decay, 0), doneAction: 2); 25 | snd = Pluck.ar( 26 | in: BPF.ar(in:WhiteNoise.ar(amp), freq: bpf_freq, rq: bpf_res), 27 | trig: Impulse.kr(0), 28 | 29 | maxdelaytime: 0.1, 30 | delaytime: freq.reciprocal, 31 | decaytime: decay, 32 | coef: coef); 33 | Out.ar(out, Pan2.ar(MoogFF.ar(in: snd, freq: lpf_freq, gain: lpf_gain), pos: pan)); 34 | }).play(args: [\out, context.out_b], target: pg); 35 | 36 | this.addCommand("hz", "f", { arg msg; 37 | var val = msg[1]; 38 | Synth("karplus_rings", [\out, context.out_b, \freq,val,\amp,amp,\decay,decay,\coef,coef,\lpf_freq,lpf_freq,\lpf_gain,lpf_gain,\bpf_freq,bpf_freq,\bpf_res,bpf_res,\pan,pan], target:pg); 39 | }); 40 | 41 | this.addCommand("amp", "f", { arg msg; 42 | amp = msg[1]; 43 | }); 44 | 45 | this.addCommand("decay", "f", { arg msg; 46 | decay = msg[1]; 47 | }); 48 | 49 | this.addCommand("coef", "f", { arg msg; 50 | coef = msg[1]; 51 | }); 52 | 53 | this.addCommand("lpf_freq", "f", { arg msg; 54 | lpf_freq = msg[1]; 55 | }); 56 | 57 | this.addCommand("lpf_gain", "f", { arg msg; 58 | lpf_gain = msg[1]; 59 | }); 60 | 61 | this.addCommand("bpf_freq", "f", { arg msg; 62 | bpf_freq = msg[1]; 63 | }); 64 | 65 | this.addCommand("bpf_res", "f", { arg msg; 66 | bpf_res = msg[1]; 67 | }); 68 | 69 | this.addCommand("pan", "f", { arg msg; 70 | pan = msg[1]; 71 | }); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /lib/Engine_TestSine.sc: -------------------------------------------------------------------------------- 1 | // CroneEngine_TestSine 2 | // dumbest possible test: a single, mono sinewave 3 | 4 | // Inherit methods from CroneEngine 5 | Engine_TestSine : CroneEngine { 6 | // Define a getter for the synth variable 7 | var = go to top note 17 | -- * = random note 18 | -- M = fast metro 19 | -- m = slow metro 20 | -- # = jump random position 21 | -- 22 | -- augment/change this script with 23 | -- new functions! 24 | 25 | engine.name = "PolyPerc" 26 | 27 | note = 40 28 | position = 1 29 | step = {1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1} 30 | STEPS = 16 31 | edit = 1 32 | 33 | function inc() note = util.clamp(note + 5, 40, 120) end 34 | function dec() note = util.clamp(note - 5, 40, 120) end 35 | function bottom() note = 40 end 36 | function top() note = 120 end 37 | function rand() note = math.random(80) + 40 end 38 | function metrofast() counter.time = 0.125 end 39 | function metroslow() counter.time = 0.25 end 40 | function positionrand() position = math.random(STEPS) end 41 | 42 | act = {inc, dec, bottom, top, rand, metrofast, metroslow, positionrand} 43 | COMMANDS = 8 44 | label = {"+", "-", "<", ">", "*", "M", "m", "#"} 45 | 46 | function init() 47 | params:add_control("cutoff", "cutoff", controlspec.new(50, 5000, 'exp', 0, 555, 'hz')) 48 | params:set_action("cutoff", function(x) engine.cutoff(x) end) 49 | counter = metro.init(count, 0.125, -1) 50 | counter:start() 51 | end 52 | 53 | function count() 54 | position = (position % STEPS) + 1 55 | act[step[position]]() 56 | engine.hz(midi_to_hz(note)) 57 | redraw() 58 | end 59 | 60 | function redraw() 61 | screen.clear() 62 | 63 | for i = 1,16 do 64 | screen.level((i == edit) and 15 or 2) 65 | screen.move(i*8-8,40) 66 | screen.text(label[step[i]]) 67 | if i == position then 68 | screen.move(i*8-8, 45) 69 | screen.line_rel(6,0) 70 | screen.stroke() 71 | end 72 | end 73 | 74 | screen.update() 75 | end 76 | 77 | function enc(n,d) 78 | if n == 1 then 79 | params:delta("cutoff", d) 80 | elseif n == 2 then 81 | edit = util.clamp(edit + d, 1, STEPS) 82 | elseif n ==3 then 83 | step[edit] = util.clamp(step[edit]+d, 1, COMMANDS) 84 | end 85 | redraw() 86 | end 87 | 88 | function key(n,z) 89 | if n == 3 and z == 1 then 90 | randomize_steps() 91 | end 92 | end 93 | 94 | function midi_to_hz(note) 95 | return (440/32) * (2 ^ ((note - 9) / 12)) 96 | end 97 | 98 | function randomize_steps() 99 | for i= 1,16 do 100 | step[i] = math.random(COMMANDS) 101 | end 102 | end 103 | -------------------------------------------------------------------------------- /lib/polysub.lua: -------------------------------------------------------------------------------- 1 | -- polysub 2 | 3 | local cs = require 'controlspec' 4 | 5 | local polysub = {} 6 | 7 | function polysub.params() 8 | -- synth 9 | params:add{type = "control", id = "shape", name = "shape", 10 | controlspec = cs.new(0, 1, "lin", 0, 0, ""), action = engine.shape} 11 | params:add{type = "control", id = "timbre", name = "timbre", 12 | controlspec = cs.new(0, 1, "lin", 0, 0.5, ""), action = engine.timbre} 13 | params:add{type = "control", id = "sub", name = "sub", 14 | controlspec = cs.new(0, 1, "lin", 0, 0, ""), action = engine.sub} 15 | params:add{type = "control", id = "noise", name = "noise", 16 | controlspec = cs.new(0, 1, "lin", 0, 0, ""), action = engine.noise} 17 | params:add{type = "control", id = "detune", name = "detune", 18 | controlspec = cs.new(0, 1, "lin", 0, 0, ""), action = engine.detune} 19 | params:add{type = "control", id = "width", name = "stereo width", 20 | controlspec = cs.new(0, 1, "lin", 0, 0.5, ""), action = engine.width} 21 | params:add{type = "control", id = "hzlag", name = "pitch lag", 22 | controlspec = cs.new(0, 1, "lin", 0, 0, ""), action = engine.hzLag} 23 | 24 | -- filter 25 | params:add{type = "control", id = "fgain", name = "filter gain", 26 | controlspec = cs.new(0, 6, "lin", 0, 0, ""), action = engine.fgain} 27 | params:add{type = "control", id = "cut", name = "cut", 28 | controlspec = cs.new(0, 32, "lin", 0, 8, ""), action = engine.cut} 29 | params:add{type = "control", id = "cutenvamt", name = "cut env amt", 30 | controlspec = cs.new(0, 1, "lin", 0, 0, ""), action = engine.cutEnvAmt} 31 | params:add{type = "control", id = "cutatk", name = "cut attack", 32 | controlspec = cs.new(0.01, 10, "lin", 0, 0.05, ""), action = engine.cutAtk} 33 | params:add{type = "control", id = "cutdec", name = "cut decay", 34 | controlspec = cs.new(0, 2, "lin", 0, 0.1, ""), action = engine.cutDec} 35 | params:add{type = "control", id = "cutsus", name = "cut sustain", 36 | controlspec = cs.new(0, 1, "lin", 0, 0.9, ""), action = engine.cutSus} 37 | params:add{type = "control", id = "cutrel", name = "cut release", 38 | controlspec = cs.new(0.01, 10, "lin", 0, 1, ""), action = engine.cutRel} 39 | 40 | -- amp 41 | params:add{type = "control", id = "level", name = "level", 42 | controlspec = cs.new(0, 1, "lin", 0, 0.15, ""), action = engine.level} 43 | params:add{type = "control", id = "ampatk", name = "amp attack", 44 | controlspec = cs.new(0.01, 10, "lin", 0, 0.05, ""), action = engine.ampAtk} 45 | params:add{type = "control", id = "ampdec", name = "amp decay", 46 | controlspec = cs.new(0, 2, "lin", 0, 0.1, ""), action = engine.ampDec} 47 | params:add{type = "control", id = "ampsus", name = "amp sustain", 48 | controlspec = cs.new(0, 1, "lin", 0, 0.9, ""), action = engine.ampSus} 49 | params:add{type = "control", id = "amprel", name = "amp release", 50 | controlspec = cs.new(0.01, 10, "lin", 0, 1, ""), action = engine.ampRel} 51 | end 52 | 53 | return polysub 54 | -------------------------------------------------------------------------------- /demos/ui.lua: -------------------------------------------------------------------------------- 1 | -- UI Demo 2 | -- 3 | -- UI widgets demo. 4 | -- 5 | -- E1/K2 : Change page 6 | -- K3 : Change tab 7 | -- E2/3 : Adjust controls 8 | -- 9 | -- v1.0.1 Mark Eats 10 | -- 11 | 12 | 13 | local UI = require "ui" 14 | 15 | local SCREEN_FRAMERATE = 15 16 | local screen_refresh_metro 17 | local screen_dirty = true 18 | 19 | local pages 20 | local tabs 21 | local dial_l 22 | local dial_r 23 | local slider_l 24 | local slider_r 25 | local scrolling_list 26 | local message 27 | 28 | local list_content = {"The Genesis", "N.Y. State of Mind", "Life's a Bitch", "The World Is Yours", "Halftime", "Memory Lane (Sittin' in...)", "One Love", "One Time 4 Your Mind", "Represent", "It Ain't Hard to Tell"} 29 | local message_result = "" 30 | 31 | 32 | -- Init 33 | function init() 34 | 35 | screen.aa(1) 36 | 37 | -- Init UI 38 | pages = UI.Pages.new(1, 3) 39 | tabs = UI.Tabs.new(1, {"Tab A", "Tab B"}) 40 | 41 | dial_l = UI.Dial.new(9, 19, 22, 25, 0, 100, 1) 42 | dial_r = UI.Dial.new(34.5, 34, 22, 0.3, -1, 1, 0.01, 0, {0}) 43 | 44 | slider_l = UI.Slider.new(86, 18, 3, 44, 0.25, 0, 1, {0.84}) 45 | slider_r = UI.Slider.new(102, 18, 3, 44, 0.25, 0, 1, {0.84}) 46 | slider_l.active = false 47 | slider_r.active = false 48 | 49 | scrolling_list = UI.ScrollingList.new(8, 8, 1, list_content) 50 | 51 | -- Start drawing to screen 52 | screen_refresh_metro = metro.init() 53 | screen_refresh_metro.event = function() 54 | if screen_dirty then 55 | screen_dirty = false 56 | redraw() 57 | end 58 | end 59 | screen_refresh_metro:start(1 / SCREEN_FRAMERATE) 60 | 61 | end 62 | 63 | 64 | -- Encoder input 65 | function enc(n, delta) 66 | 67 | if n == 1 then 68 | -- Page scroll 69 | pages:set_index_delta(util.clamp(delta, -1, 1), false) 70 | end 71 | 72 | if pages.index == 1 then 73 | if tabs.index == 1 then 74 | -- Tab A 75 | if n == 2 then 76 | dial_l:set_value_delta(delta * 2) 77 | elseif n == 3 then 78 | dial_r:set_value_delta(delta / 20) 79 | end 80 | else 81 | -- Tab B 82 | if n == 2 then 83 | slider_l:set_value_delta(delta / 20) 84 | elseif n == 3 then 85 | slider_r:set_value_delta(delta / 20) 86 | end 87 | end 88 | 89 | elseif pages.index == 2 then 90 | if n == 2 then 91 | scrolling_list:set_index_delta(util.clamp(delta, -1, 1)) 92 | end 93 | 94 | end 95 | 96 | screen_dirty = true 97 | end 98 | 99 | -- Key input 100 | function key(n, z) 101 | if z == 1 then 102 | 103 | if n == 2 then 104 | 105 | if message then 106 | message = nil 107 | message_result = "Cancelled." 108 | 109 | else 110 | pages:set_index_delta(1, true) 111 | end 112 | 113 | elseif n == 3 then 114 | 115 | if message then 116 | message = nil 117 | message_result = "Confirmed!" 118 | 119 | elseif pages.index == 1 then 120 | tabs:set_index_delta(1, true) 121 | dial_l.active = tabs.index == 1 122 | dial_r.active = tabs.index == 1 123 | slider_l.active = tabs.index == 2 124 | slider_r.active = tabs.index == 2 125 | 126 | elseif pages.index == 3 then 127 | message = UI.Message.new({"This is a message.", "", "KEY2 to cancel", "KEY3 to confirm"}) 128 | end 129 | 130 | end 131 | 132 | screen_dirty = true 133 | end 134 | end 135 | 136 | 137 | -- Redraw 138 | function redraw() 139 | screen.clear() 140 | 141 | if message then 142 | message:redraw() 143 | 144 | else 145 | 146 | pages:redraw() 147 | 148 | if pages.index == 1 then 149 | tabs:redraw() 150 | dial_l:redraw() 151 | dial_r:redraw() 152 | slider_l:redraw() 153 | slider_r:redraw() 154 | 155 | elseif pages.index == 2 then 156 | scrolling_list:redraw() 157 | 158 | elseif pages.index == 3 then 159 | screen.move(8, 24) 160 | screen.level(15) 161 | screen.text("Press KEY3 to") 162 | screen.move(8, 35) 163 | screen.text("display a message.") 164 | screen.move(8, 50) 165 | screen.level(3) 166 | screen.text(message_result) 167 | screen.fill() 168 | 169 | end 170 | 171 | end 172 | 173 | screen.update() 174 | end 175 | -------------------------------------------------------------------------------- /demos/scales.lua: -------------------------------------------------------------------------------- 1 | -- Scales Demo 2 | -- 3 | -- Example scale and chord 4 | -- generation using MusicUtil. 5 | -- 6 | -- E1 : Tempo 7 | -- E2 : Root note 8 | -- E3 : Scale or chord 9 | -- K2 : Play/Pause 10 | -- K3 : Mode 11 | -- 12 | -- v1.1.0 Mark Eats 13 | -- 14 | 15 | function unrequire(name) 16 | package.loaded[name] = nil 17 | _G[name] = nil 18 | end 19 | unrequire("musicutil") 20 | 21 | local MusicUtil = require "musicutil" 22 | 23 | local mode = 1 24 | local root_note = 48 25 | local scale_type = 1 26 | local chord_type = 1 27 | 28 | local notes = {} 29 | local note_names = {} 30 | local length = 0 31 | local SCALES_LEN = #MusicUtil.SCALES 32 | local CHORDS_LEN = #MusicUtil.CHORDS 33 | 34 | local tempo = 90 35 | local step = 1 36 | local step_increment = 1 37 | local step_metro 38 | 39 | engine.name = "PolyPerc" 40 | 41 | 42 | local function init_scale() 43 | notes = MusicUtil.generate_scale(root_note, scale_type, 1) 44 | end 45 | 46 | local function init_chord() 47 | notes = MusicUtil.generate_chord(root_note, chord_type) 48 | step = 0 49 | step_increment = 1 50 | end 51 | 52 | local function update_notes() 53 | if mode == 1 then 54 | init_scale() 55 | else 56 | init_chord() 57 | end 58 | note_names = MusicUtil.note_nums_to_names(notes) 59 | length = #notes 60 | end 61 | 62 | local function play_notes() 63 | if mode == 1 then 64 | engine.hz(MusicUtil.note_num_to_freq(notes[step])) 65 | else 66 | for i = 1, length do 67 | engine.hz(MusicUtil.note_num_to_freq(notes[i])) 68 | end 69 | end 70 | end 71 | 72 | local function advance_step() 73 | if mode == 1 then 74 | if step >= length then 75 | step = length 76 | step_increment = -1 77 | elseif step == 1 then 78 | step_increment = 1 79 | end 80 | step = step + step_increment 81 | play_notes() 82 | 83 | else 84 | step = step + step_increment 85 | if (step - 1) % 8 == 0 then 86 | play_notes() 87 | end 88 | end 89 | 90 | redraw() 91 | end 92 | 93 | local function start_stop_metro() 94 | if step_metro.is_running then 95 | step_metro:stop() 96 | else 97 | if mode == 1 then 98 | if step < 1 or step > length then step = 1 end 99 | play_notes() 100 | else 101 | step = 0 102 | end 103 | step_metro:start(60 / tempo / 4) -- 16ths 104 | end 105 | end 106 | 107 | 108 | function init() 109 | 110 | engine.amp(0.5) 111 | 112 | update_notes() 113 | 114 | step_metro = metro.init() 115 | step_metro.event = advance_step 116 | start_stop_metro() 117 | 118 | screen.aa(1) 119 | redraw() 120 | end 121 | 122 | 123 | function enc(n, delta) 124 | 125 | -- ENC1 tempo 126 | if n == 1 then 127 | tempo = util.clamp(tempo + delta, 60, 200) 128 | step_metro.time = 60 / tempo / 4 129 | 130 | -- ENC2 root note 131 | elseif n == 2 then 132 | root_note = util.clamp(root_note + delta, 36, 84) 133 | update_notes() 134 | 135 | -- ENC3 scale / chord 136 | elseif n == 3 then 137 | if mode == 1 then 138 | scale_type = util.clamp(scale_type + delta, 1, SCALES_LEN) 139 | else 140 | chord_type = util.clamp(chord_type + delta, 1, CHORDS_LEN) 141 | end 142 | update_notes() 143 | 144 | end 145 | 146 | redraw() 147 | 148 | end 149 | 150 | function key(n, z) 151 | 152 | if z == 1 then 153 | 154 | -- KEY2 is play/pause 155 | if n == 2 then 156 | start_stop_metro() 157 | 158 | -- KEY3 is mode 159 | elseif n == 3 then 160 | mode = mode % 2 + 1 161 | update_notes() 162 | end 163 | 164 | redraw() 165 | 166 | end 167 | end 168 | 169 | 170 | function redraw() 171 | screen.clear() 172 | 173 | screen.level(15) 174 | 175 | -- Play/pause 176 | if step_metro.is_running then 177 | screen.move(116, 6.2) 178 | screen.line(123, 9.5) 179 | screen.line(116, 12.8) 180 | screen.close() 181 | else 182 | screen.rect(116, 6, 2, 7) 183 | screen.rect(120, 6, 2, 7) 184 | end 185 | screen.fill() 186 | 187 | -- Tempo 188 | screen.move(5, 12) 189 | screen.text(tempo .. " BPM") 190 | 191 | -- Mode 192 | local name 193 | screen.level(3) 194 | screen.move(42, 12) 195 | if mode == 1 then 196 | screen.text("Scale") 197 | name = MusicUtil.SCALES[scale_type].name 198 | else 199 | screen.text("Chord") 200 | name = MusicUtil.CHORDS[chord_type].name 201 | end 202 | 203 | -- Name 204 | screen.level(15) 205 | screen.move(5, 27) 206 | screen.text(MusicUtil.note_num_to_name(root_note, true) .. " " .. name) 207 | 208 | -- Notes 209 | local x, y = 5, 52 210 | local cols = 8 211 | if length > cols then 212 | cols = util.round_up(length * 0.5) 213 | y = y - 6 214 | end 215 | for i = 1, length do 216 | if i == cols + 1 then x, y = 5, y + 12 end 217 | screen.move(x, y) 218 | if (mode == 1 and i == step) or (mode == 2 and (step - 1) % 8 == 0) then 219 | screen.level(15) 220 | else 221 | screen.level(3) 222 | end 223 | screen.text(note_names[i]) 224 | if string.len(note_names[i]) > 1 then x = x + 16 225 | else x = x + 10 end 226 | end 227 | 228 | screen.update() 229 | end 230 | -------------------------------------------------------------------------------- /lib/Engine_PolySub.sc: -------------------------------------------------------------------------------- 1 | // a subtractive polysynth engine 2 | 3 | Engine_PolySub : CroneEngine { 4 | 5 | classvar -12.dbamp, 75 | \shape -> 0.0, 76 | \timbre -> 0.5, 77 | \noise -> 0.0, 78 | \cut -> 8.0, 79 | \ampAtk -> 0.05, \ampDec -> 0.1, \ampSus -> 1.0, \ampRel -> 1.0, \ampCurve -> -1.0, 80 | \cutAtk -> 0.0, \cutDec -> 0.0, \cutSus -> 1.0, \cutRel -> 1.0, 81 | \cutCurve -> -1.0, \cutEnvAmt -> 0.0, 82 | \fgain -> 0.0, 83 | \detune -> 0, 84 | \width -> 0.5, 85 | \hzLag -> 0.1 86 | ); 87 | 88 | } // Startup 89 | } // initClass 90 | 91 | *new { arg context, callback; 92 | ^super.new(context, callback); 93 | } 94 | 95 | alloc { 96 | gr = ParGroup.new(context.xg); 97 | 98 | voices = Dictionary.new; 99 | ctlBus = Dictionary.new; 100 | polyDef.allControlNames.do({ arg ctl; 101 | var name = ctl.name; 102 | postln("control name: " ++ name); 103 | if((name != \gate) && (name != \hz) && (name != \out), { 104 | ctlBus.add(name -> Bus.control(context.server)); 105 | ctlBus[name].set(paramDefaults[name]); 106 | }); 107 | }); 108 | 109 | ctlBus.postln; 110 | 111 | ctlBus[\level].setSynchronous( 0.2 ); 112 | 113 | 114 | //-------------- 115 | //--- voice control, all are indexed by arbitarry ID number 116 | // (voice allocation should be performed by caller) 117 | 118 | // start a new voice 119 | this.addCommand(\start, "if", { arg msg; 120 | this.addVoice(msg[1], msg[2], true); 121 | }); 122 | 123 | 124 | // same as start, but don't map control busses, just copy their current values 125 | this.addCommand(\solo, "if", { arg msg; 126 | this.addVoice(msg[1], msg[2], false); 127 | }); 128 | 129 | 130 | // stop a voice 131 | this.addCommand(\stop, "i", { arg msg; 132 | this.removeVoice(msg[1]); 133 | }); 134 | 135 | // free all synths 136 | this.addCommand(\stopAll, "", { 137 | gr.set(\gate, 0); 138 | voices.clear; 139 | }); 140 | 141 | // generate commands to set each control bus 142 | ctlBus.keys.do({ arg name; 143 | this.addCommand(name, "f", { arg msg; ctlBus[name].setSynchronous(msg[1]); }); 144 | }); 145 | 146 | postln("polysub: performing init callback"); 147 | } 148 | 149 | addVoice { arg id, hz, map=true; 150 | var params = List.with(\out, context.out_b.index, \hz, hz); 151 | var numVoices = voices.size; 152 | 153 | if(voices[id].notNil, { 154 | voices[id].set(\gate, 1); 155 | voices[id].set(\hz, hz); 156 | }, { 157 | if(numVoices < maxNumVoices, { 158 | ctlBus.keys.do({ arg name; 159 | params.add(name); 160 | params.add(ctlBus[name].getSynchronous); 161 | }); 162 | 163 | voices.add(id -> Synth.new(\polySub, params, gr)); 164 | NodeWatcher.register(voices[id]); 165 | voices[id].onFree({ 166 | voices.removeAt(id); 167 | }); 168 | 169 | if(map, { 170 | ctlBus.keys.do({ arg name; 171 | voices[id].map(name, ctlBus[name]); 172 | }); 173 | }); 174 | }); 175 | }); 176 | } 177 | 178 | removeVoice { arg id; 179 | if(true, { 180 | voices[id].set(\gate, 0); 181 | }); 182 | } 183 | 184 | free { 185 | gr.free; 186 | ctlBus.do({ arg bus, i; bus.free; }); 187 | } 188 | 189 | } // class 190 | -------------------------------------------------------------------------------- /demos/graph.lua: -------------------------------------------------------------------------------- 1 | -- Graph Demo 2 | -- 3 | -- Four types of graphs you 4 | -- can use in your own scripts. 5 | -- 6 | -- E2/3 : Adjust graph 7 | -- K2 : Next demo 8 | -- K3 : Shift 9 | -- 10 | -- No sounds, just graphs! 11 | -- 12 | -- v1.0.1 Mark Eats 13 | -- 14 | 15 | 16 | -- Include the Graph classes 17 | local Graph = require "graph" 18 | local EnvGraph = require "envgraph" 19 | local FilterGraph = require "filtergraph" 20 | 21 | local MusicUtil = require "musicutil" 22 | 23 | -- This is where we will store the graph 24 | local demo_graph = nil 25 | local graph_id = 1 26 | 27 | -- Misc vars for the demos 28 | local wave_shape = 0 29 | local wave_freq = 2 30 | local env_vals = {a = 0.7, d = 1, s = 0.45, r = 1.8, c = -4} 31 | local point_vals = {} 32 | local seq_vals = {} 33 | local step = 1 34 | local step_metro 35 | local highlight_progress = 1 36 | local highlight_id = 1 37 | local filter_vals = {filter_type = 1, freq = 2000, resonance = 0.6} 38 | local filter_types = {"lowpass", "bandpass", "notch", "highpass"} 39 | 40 | local SCREEN_FRAMERATE = 15 41 | local screen_refresh_metro 42 | local screen_dirty = true 43 | local shift_key = false 44 | 45 | 46 | -- This is where we create the graphs 47 | local function init_graph(id) 48 | 49 | -- Wave shape graph 50 | if graph_id == 1 then 51 | 52 | -- Graphs are created with Graph.new and take the following arguments (all optional): 53 | -- Graph.new(x_min, x_max, x_warp, y_min, y_max, y_warp, style, show_x_axis, show_y_axis) 54 | demo_graph = Graph.new(0, 2, "lin", -1, 1, "lin", nil, true, false) 55 | -- We then set its position and size. 56 | demo_graph:set_position_and_size(5, 7, 118, 40) 57 | 58 | -- Add a function to the graph instance that takes an x value and outputs the y value. 59 | local wave_func = function(x) 60 | local sine = math.sin(x * wave_freq * math.pi) 61 | local saw = (1 - (x * wave_freq * 0.5 - 0.5) % 1) * 2 - 1 62 | return sine * (1 - wave_shape) + saw * wave_shape 63 | end 64 | -- Set sample_quality to 3 (high) 65 | demo_graph:add_function(wave_func, 3) 66 | 67 | 68 | -- ADSR graph 69 | elseif graph_id == 2 then 70 | 71 | -- The EnvGraph class is used for creating common envelope graphs. Passing nil means it will use a default value. 72 | -- EnvGraph.new_adsr(x_min, x_max, y_min, y_max, attack, decay, sustain, release, level, curve) 73 | demo_graph = EnvGraph.new_adsr(0, 8, nil, nil, env_vals.a, env_vals.d, env_vals.s, env_vals.r, 1, env_vals.c) 74 | demo_graph:set_position_and_size(66, 11, 58, 42) 75 | 76 | 77 | -- Selectable points graph 78 | elseif graph_id == 3 then 79 | 80 | -- This graph is a 'points' graph (as opposed to a 'function' graph). 81 | -- It is set to contain 12 equally spaced points from a table generated in init 82 | demo_graph = Graph.new(1, 12, "lin", -1, 1, "lin", "point", true, false) 83 | demo_graph:set_position_and_size(3, 3, 122, 58) 84 | for i = 1, #point_vals do 85 | demo_graph:add_point(i, point_vals[i]) 86 | end 87 | 88 | -- We also highlight one of the points that will be tied to interaction. 89 | highlight_progress = 1 90 | highlight_id = 1 91 | demo_graph:highlight_exclusive_point(highlight_id) 92 | 93 | 94 | -- Simple sequencer graph 95 | elseif graph_id == 4 then 96 | 97 | -- This is a bar graph. It's similar to the selectable points graph but with a different visual style. 98 | -- The y axis is based on MIDI note numbers 99 | demo_graph = Graph.new(1, 16, "lin", 48, 72, "lin", "bar", false, false) 100 | demo_graph:set_position_and_size(9, 4, 110, 46) 101 | for i = 1, #seq_vals do 102 | demo_graph:add_point(i, seq_vals[i]) 103 | end 104 | 105 | highlight_progress = 1 106 | highlight_id = 1 107 | demo_graph:highlight_exclusive_point(highlight_id) 108 | 109 | 110 | -- Filter graph 111 | elseif graph_id == 5 then 112 | 113 | -- The Graph class can also draw splines. The FilterGraph subclass uses this to draw approximate filter graphs. 114 | -- filter_type can be "lowpass", "bandpass", "notch" or "highpass". 115 | -- FilterGraph.new(x_min, x_max, y_min, y_max, filter_type, slope, freq, resonance) 116 | demo_graph = FilterGraph.new(nil, nil, nil, nil, filter_types[filter_vals.filter_type], 12, filter_vals.freq, filter_vals.resonance) 117 | demo_graph:set_position_and_size(5, 7, 118, 40) 118 | 119 | end 120 | 121 | end 122 | 123 | 124 | function init() 125 | 126 | screen.aa(1) 127 | 128 | -- Dummy data for graphs 129 | for i = 1, 12 do point_vals[i] = math.random() * 2 - 1 end 130 | for i = 1, 16 do seq_vals[i] = math.random(48, 72) end 131 | 132 | init_graph(graph_id) 133 | 134 | -- Metro to call redraw() 135 | screen_refresh_metro = metro.init() 136 | screen_refresh_metro.event = function() 137 | if screen_dirty then 138 | screen_dirty = false 139 | redraw() 140 | end 141 | end 142 | screen_refresh_metro:start(1 / SCREEN_FRAMERATE) 143 | 144 | -- Metro for sequencer demo 145 | step_metro = metro.init() 146 | step_metro.event = function() 147 | if graph_id == 4 then 148 | step = step % 16 + 1 149 | screen_dirty = true 150 | end 151 | end 152 | step_metro:start(0.25) 153 | 154 | end 155 | 156 | 157 | -- Encoder input 158 | function enc(n, delta) 159 | 160 | -- Wave shape interaction 161 | if graph_id == 1 then 162 | 163 | -- ENC2 blends between the two wave shapes using a 0-1 value. 164 | if n == 2 then 165 | -- We call update_functions() whenever the wave function gets new data (here, wave_shape is changed) 166 | wave_shape = util.clamp(wave_shape + delta * 0.05, 0, 1) 167 | demo_graph:update_functions() 168 | 169 | -- ENC3 set the wave frequency, 1-10. 170 | elseif n == 3 then 171 | wave_freq = util.clamp(wave_freq + delta * 0.1, 1, 10) 172 | demo_graph:update_functions() 173 | end 174 | 175 | -- ADSR interaction 176 | elseif graph_id == 2 then 177 | 178 | -- The ENC2 and ENC3 change attack and decay. When KEY3 is held they switch to sustain and release. 179 | local change = delta * 0.05 180 | 181 | if n == 2 then 182 | if not shift_key then 183 | env_vals.a = util.clamp(env_vals.a + change, 0, 2.5) 184 | else 185 | env_vals.s = util.clamp(env_vals.s + change, 0, 1) 186 | end 187 | elseif n == 3 then 188 | if not shift_key then 189 | env_vals.d = util.clamp(env_vals.d + change, 0, 2) 190 | else 191 | env_vals.r = util.clamp(env_vals.r - change, 0, 2.5) 192 | end 193 | end 194 | 195 | -- The ADSR values are stored in env_vals in this script then updated in the graph here. 196 | demo_graph:edit_adsr(env_vals.a, env_vals.d, env_vals.s, env_vals.r, 1, env_vals.c) 197 | 198 | -- Points interation 199 | elseif graph_id == 3 then 200 | 201 | -- ENC2 changes the highlight_id which is fed to the graph. 202 | if n == 2 then 203 | highlight_progress = util.clamp(highlight_progress + delta * 0.5, 1, 12) 204 | highlight_id = util.round(highlight_progress) 205 | demo_graph:highlight_exclusive_point(highlight_id) 206 | 207 | -- ENC3 changes the highlighted point value. 208 | elseif n == 3 then 209 | -- We could store the values in the graph but here we store the data model in this class and update the graph view from it. 210 | point_vals[highlight_id] = util.clamp(point_vals[highlight_id] + delta * 0.05, demo_graph:get_y_min(), demo_graph:get_y_max()) 211 | demo_graph:edit_point(highlight_id, nil, point_vals[highlight_id]) 212 | end 213 | 214 | -- Sequencer interaction 215 | elseif graph_id == 4 then 216 | 217 | -- ENC2 changes the highlight_id again. 218 | if n == 2 then 219 | highlight_progress = util.clamp(highlight_progress + delta * 0.5, 1, 16) 220 | highlight_id = util.round(highlight_progress) 221 | demo_graph:highlight_exclusive_point(highlight_id) 222 | 223 | -- ENC3 sets the MIDI note value. 224 | elseif n == 3 then 225 | seq_vals[highlight_id] = util.clamp(seq_vals[highlight_id] + util.clamp(delta, -1, 1), demo_graph:get_y_min(), demo_graph:get_y_max()) 226 | demo_graph:edit_point(highlight_id, nil, seq_vals[highlight_id]) 227 | end 228 | 229 | -- Filter interaction 230 | elseif graph_id == 5 then 231 | 232 | -- ENC2 sets frequency 233 | if n == 2 then 234 | filter_vals.freq = util.clamp(filter_vals.freq + (filter_vals.freq * delta * 0.1), 20, 10000) 235 | 236 | -- ENC3 sets resonance 237 | elseif n == 3 then 238 | filter_vals.resonance = util.clamp(filter_vals.resonance + delta * 0.05, 0, 1) 239 | 240 | end 241 | 242 | -- The filter values are then updated in the graph here. 243 | demo_graph:edit(nil, nil, filter_vals.freq, filter_vals.resonance) 244 | 245 | end 246 | 247 | screen_dirty = true 248 | end 249 | 250 | -- Key input 251 | function key(n, z) 252 | 253 | -- KEY2 advances to the next graph. 254 | if n == 2 and z == 1 then 255 | 256 | -- Increment graph_id 257 | graph_id = graph_id % 5 + 1 258 | 259 | -- Init a new graph. 260 | init_graph(graph_id) 261 | 262 | -- KEY3 is a shift key used for additional functionality in some of the graphs. 263 | elseif n == 3 then 264 | shift_key = z > 0 and true or false 265 | 266 | if graph_id == 3 then 267 | if shift_key then demo_graph:set_style("line_and_point") 268 | else demo_graph:set_style("point") end 269 | 270 | elseif graph_id == 5 and z == 1 then 271 | -- Change filter type 272 | filter_vals.filter_type = filter_vals.filter_type % #filter_types + 1 273 | demo_graph:edit(filter_types[filter_vals.filter_type]) 274 | end 275 | end 276 | 277 | screen_dirty = true 278 | end 279 | 280 | 281 | -- Drawing 282 | function redraw() 283 | screen.clear() 284 | 285 | -- Don't panic! Only one line of this redraw function is used to draw the graph, everything else relates to the supporting text and graphics. 286 | 287 | -- Draw wave shape text 288 | if graph_id == 1 then 289 | screen.level(15) 290 | screen.move(5, 60) 291 | screen.text("Sine") 292 | screen.move(38, 60) 293 | screen.text_center("Saw") 294 | screen.level(3) 295 | screen.rect(26 * wave_shape + 4, 62, 17 + 1 * (1 - wave_shape), 1) 296 | screen.fill() 297 | 298 | -- Draw ADSR text 299 | elseif graph_id == 2 then 300 | if shift_key then screen.level(3) else screen.level(15) end 301 | screen.move(4, 14) 302 | screen.text("A " .. util.round(env_vals.a, 0.01) .."s") 303 | screen.move(4, 27) 304 | screen.text("D " .. util.round(env_vals.d, 0.01) .."s") 305 | if shift_key then screen.level(15) else screen.level(3) end 306 | screen.move(4, 40) 307 | screen.text("S " .. util.round(env_vals.s, 0.01)) 308 | screen.move(4, 53) 309 | screen.text("R " .. util.round(env_vals.r, 0.01) .."s") 310 | 311 | -- Draw sequencer position and note name 312 | elseif graph_id == 4 then 313 | screen.level(15) 314 | screen.rect(util.round(util.linlin(demo_graph:get_x_min(), demo_graph:get_x_max(), demo_graph:get_x(), demo_graph:get_x() + demo_graph:get_width() - 1, step)) - 2, 52, 5, 2) 315 | screen.fill() 316 | screen.move(util.linlin(demo_graph:get_x_min(), demo_graph:get_x_max(), demo_graph:get_x(), demo_graph:get_x() + demo_graph:get_width() - 1, highlight_id), 62) 317 | screen.text_center(MusicUtil.note_num_to_name(seq_vals[highlight_id], true)) 318 | 319 | -- Draw filter text 320 | elseif graph_id == 5 then 321 | screen.level(15) 322 | screen.move(5, 60) 323 | screen.text(util.round(filter_vals.freq, 1) .. " Hz") 324 | local filter_name = filter_types[filter_vals.filter_type] 325 | filter_name = string.upper(string.sub(filter_name, 1, 1)) .. string.sub(filter_name, 2) 326 | screen.move(123, 60) 327 | screen.text_right(filter_name) 328 | screen.fill() 329 | 330 | end 331 | 332 | -- Draw the actual graph! 333 | demo_graph:redraw() 334 | 335 | screen.update() 336 | end 337 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------