Home › Forums › General › Programming › simple sequencer
Tagged: sequencer
- This topic has 162 replies, 3 voices, and was last updated 6 years, 2 months ago by human fly.
-
AuthorPosts
-
January 1, 2018 at 1:25 am #74047
panel:getComponent("display2"):setPropertyString("uiLabelText",""..chordConcat)
chordConcat is already a string, so no need for""..chordConcat
as I see it.January 1, 2018 at 9:32 am #74048a-haaa… here’s the next challenge: Transpose 🙂
not done yet, off to think about it.
here’s the current state of the panel >note: good thing about this is you can chuck any tables
you want into ‘tables()’ – but these, at present, are
mostly just the basic notes of a chord, without extensions
into 2nd octave (apart from 11th,13th etc.) – only the last
5 or 6 are scales. and this still doesn’t deal with modes,
lydian, etc. etc. 🙂 🙂as far as getting a keyboard UI to work, it should not be too
difficult to get valid returned values to change state of
corresponding off/on indicators.
(not sure what the ‘divide’ option is good for yet)Attachments:
You must be logged in to view attached files.January 1, 2018 at 11:08 am #74050transpose was fairly easy:
(although not sure the results are what the positions one
would play – inversions ! )
-there are, of course, some great bits of software out there
for doing all this –function transpose() tables() --[load tables]-- local x = panel:getModulatorByName("chords"):getValue()+1 txpose = panel:getModulatorByName("transpose"):getValue() -- local tbl_txpose = {} for j =1, #(_G["tbl_chd"..x]),1 do value = _G["tbl_chd"..x] [ j ] tx=value+txpose table.insert(tbl_txpose,tx) end local txConcat = table.concat(tbl_txpose, " ") panel:getComponent("display3"):setPropertyString("uiLabelText",""..txConcat) end
January 2, 2018 at 12:58 pm #74054here’s a file with some ‘key’ labels, which could change
colour. didn’t have much success with this yet, getting
them into a table, so i backed off to have a fresh think
about it. vague notion of matching table keys, or maybe it
should be something else.there’s a ‘transpose’ thing there – with a threshold after
which it ‘wraps’ – kind of a rough implementation – and
i made three buttons, notionally for if it can have
1st,2nd,3rd inversions ( ? ) …the top part is separate, really, from the bottom ‘test’ part.
(and there’s some junk lines in the method commented out)will have another look at it later.
Attachments:
You must be logged in to view attached files.January 4, 2018 at 11:04 pm #74072focusing in on getting the results from one table -the notes-
to affect a property on selected items of another table -the
keyboard keys-these keyboard keys are labels – which are addressed as ‘components’ –
and the objective is to change label colour property for the table
items (table keys! …happen to also be keyboard keys 🙂 )
trying to figure out how to match the two tables.so far:
function getText() tables() --call the note table local majConcat = table.concat(tbl_majorScale, " ") panel:getComponent("display1"):setPropertyString("uiLabelText",""..majConcat) console(String(majConcat)) for i =1, #tbl_majorScale,1 do note = tbl_majorScale [ i ] console(String("note"..i .. ": " .. note)) end for j=1,24 do keyz=panel:getComponent("kb"..j) --:getProperty("uiLabelBgColour") --:getValue() --console(String("key "..j .. ": " .. keyz)) --tostring(keyz))) local tbl_kybd={} table.insert(tbl_kybd,keyz) end end
Attachments:
You must be logged in to view attached files.January 5, 2018 at 12:00 am #74074this is it. needs on/off so they can go back to normal
colours, and the loading of different scales – 8-Dfunction getText() tables() local majConcat = table.concat(tbl_majorScale, " ") panel:getComponent("display1"):setPropertyString("uiLabelText",""..majConcat) console(String(majConcat)) for j=1,24 do keyz=panel:getComponent("kb"..j) for i =1, #tbl_majorScale,1 do noteval = tbl_majorScale [ i ] if noteval==j-1 then keyz:setProperty("uiLabelBgColour","FF17A800", false) end end end end
January 5, 2018 at 10:25 am #74075simpler keyboard-only panel >>
can now change ‘key’ colour according to chord/scale,
but only setting them *all* to white at the moment
-and still don’t have ‘momentary’ action; it has a
‘reset’/clear button. (‘for j=1,24’ etc.)currently having trouble separating white and black keys,
which i’m listing in separate Wkeys and Bkeys tables,
trying all sorts of things on ( eg: _G [ ] etc.)will have to try to figure it out later – momentary action too.
Attachments:
You must be logged in to view attached files.January 5, 2018 at 10:16 pm #74083ok, think this is a bit better. it can transpose any chord
or scale now, on a 2 octave keyboard. still a bit primitive,
and can’t seem to get a momentary action on the keyboard.
might draft this as a little chord tutor exe 🙂
(code can probably be improved)
panel >>and here it is as a little standalone exe, zipped:
https://app.box.com/s/cbefq35g8vagwwlx1la61bi5bjmownl1Attachments:
You must be logged in to view attached files.January 5, 2018 at 11:31 pm #74085That’s interesting and a nice way of learning complex chords. Should a dominant 11 the and 13 the not have a b flat in the chord rather than a b?
January 5, 2018 at 11:43 pm #74086LOL i’m not sure, i probably got my lists wrong
for the tables – please enlighten, i’ll happily
correct them. i tried to find a chart but ended up
skipping back+forth between 2 webpages ! and the
harmonic minor scale is shown as same as melodic,
-that’s going to be tricky to represent, if it goes
up one way, and comes back down as a natural minor.tbh, i wasn’t sure what i needed to represent, and
just used this lot so i had something to work with.January 5, 2018 at 11:49 pm #74087Well my knowledge of chord structures is not so good without looking things up – it’s a good idea though (this panel) – it could be useful for trying different voicings. I have an old YamahaQY 20 that can play those obscure chords.
January 5, 2018 at 11:50 pm #74088indeed:
dominant 11th “C11 (dominant eleventh): C–E–G–B♭–D–F.”dominant 13th “C13 consists of C, E, G, B♭, and A.”
not sure for dominant 13th, although it says that’s the
most commonly used 13th.my knowledge of music theory is pretty limited.(why i
was interested in doing this)i remember now i omitted a note because it was suggested
as optional for some of them – look at the tables() method.
maybe that was itJanuary 5, 2018 at 11:55 pm #74089yep have a QY too (100) – which means you never have to
learn them ! i’m more of a guitar twanger, and i don’t
think i can even transpose major chords fluently on the
keyboard. 🙂January 5, 2018 at 11:58 pm #74090“While the dominant thirteenth is the most common thirteenth chord, the major thirteenth is also fairly common. A major thirteenth chord (containing a major seventh) will nearly always feature a chromatically raised eleventh (C E G B D F♯ A) (see lydian mode), except for cases when the eleventh is omitted altogether. “It is customary to omit the eleventh on dominant or major thirteenth chords because the eleventh conflicts with the third, in these chords by a semitone.”
January 6, 2018 at 3:07 pm #74091alternatively, interesting to look at the intervals
in semitones instead? just went through the tables
annotating for each one with the intervals – which
i’ve never done before, and probably should have
-did, many years ago, but just for the major scale,
(“tone,tone,semitone, tone,tone,tone, semitone”…)
and thereafter just learnt others on the fretboard
ha and later it was just bashing in notes in a sequencer
so..
anyway: as repeating patterns, that comes out as:
major : 2,2,1,2,2,2,1 (last step is to next octave)
minor/nat : 2,1,2,2,1,2,2
minor/mel : 2,1,2,2,1,3,1
& same sort of thing for chords.so by just specifying the root and either scale or chord…
will have to think about it.. for i,v etc. count=count+v?
(but how to get it to start again and repeat through same
table…)(same issue as trying to run a count from a table
with sequencer clock..)January 7, 2018 at 7:58 pm #74096how do you select only specified keys in an array/table/field?
i think i know how to select one, but say i want 1, 4, and 7
for example?possibly something here:
“5.1 – Multiple Results”
https://www.lua.org/pil/5.1.htmland a couple of new things:
function b(...) for k, v in pairs({...}) do myTable[k] = v end end b(1, 2) -- {[1] = 1, [2] = 2} is added to myTable
function b(...) for i = 1, select('#',...) do myTable[#myTable+1] = select(i,...) end end
then:
> myTable = {'a','b'} > b('c','d') > for i = 1, #myTable do print(myTable) end a b c d >
https://stackoverflow.com/questions/13214926/lua-insert-multiple-variables-into-a-table
January 10, 2018 at 1:48 am #74169another digression: the above resulted in me trying this.
haven’t really gone through it yet, it is the multi select
thing. is this a useful way to collect values of multiple
modulators, or is it just something i can do more simply
with something more conventional (duh..)
it is collecting the values from the modulators and
displaying them, so far. seems to be an alternative
to table.insert?function multiRun() mod1=panel:getModulatorByName("mod1"):getValue() mod2=panel:getModulatorByName("mod2"):getValue() mod3=panel:getModulatorByName("mod3"):getValue() mod4=panel:getModulatorByName("mod4"):getValue() enab1=panel:getModulatorByName("enable1"):getValue() enab2=panel:getModulatorByName("enable2"):getValue() enab3=panel:getModulatorByName("enable3"):getValue() enab4=panel:getModulatorByName("enable4"):getValue() function multiselect(...) myTable={} for k, v in pairs({...}) do myTable[k] = v --console(String("myTable "..k .. ": " .. v)) end end multiselect(mod1,mod2,mod3,mod4) local myTableconcat = table.concat(myTable," ") panel:getComponent("display3"):setPropertyString("uiLabelText",""..myTableconcat) end
January 10, 2018 at 5:27 pm #74187the enab stuff shouldn’t be in the thing above. but say
you wanted an enable button to validate each modulator+value,
and wanted something like >below> , how would you incorporate
it? don’t know how it can work with this (…) thing.enab1=panel:getModulatorByName("enable1"):getValue() enab2=panel:getModulatorByName("enable2"):getValue() enab3=panel:getModulatorByName("enable3"):getValue() enab4=panel:getModulatorByName("enable4"):getValue() for i=1,4 do enab= _G["enab"..i] if enab ==1 then --console(String("enab "..i)) end end
Attachments:
You must be logged in to view attached files.January 11, 2018 at 4:39 pm #74232right so i got something working.
is there any benefit at all in doing it like this?
if not, what alternative is obvious to you? 😀
(demo panel below)i can see this being useful: if a button is ‘on’, then
it collects the value of the corresponding modulator
and adds it to the table. display only shows what’s in
the table.
main thing here is using the({...})
thing ..function multiRun() -- --------------------------------------------- mod1=panel:getModulatorByName("mod1"):getValue() mod2=panel:getModulatorByName("mod2"):getValue() mod3=panel:getModulatorByName("mod3"):getValue() mod4=panel:getModulatorByName("mod4"):getValue() enab1=panel:getModulatorByName("enable1"):getValue() enab2=panel:getModulatorByName("enable2"):getValue() enab3=panel:getModulatorByName("enable3"):getValue() enab4=panel:getModulatorByName("enable4"):getValue() -- --------------------------------------------- tbl_enab ={} for i=1,4 do enabled = _G["enab"..i] modval = _G["mod"..i] if enabled ==1 then table.insert(tbl_enab,modval) end end local enabconcat = table.concat(tbl_enab," ") -- --------------------------------------------- function multiselect(...) for k, v in pairs({...}) do tbl_enab[k] = v end end -- --------------------------------------------- multiselect(mod1,mod2,mod3,mod4) panel:getComponent("display3"):setPropertyString("uiLabelText",""..enabconcat) end
Attachments:
You must be logged in to view attached files.January 12, 2018 at 12:52 am #74256well half of that wasn’t needed.
function multiselect() local myTable ={} for i=1,4 do _G["enable"..i] = panel:getModulatorByName("enable"..i) :getValue() _G["mod"..i] = panel:getModulatorByName("mod"..i) :getValue() if _G["enable"..i] ==1 then table.insert(myTable,_G["mod"..i]) end end -- --------------------------------------------- local myConcat = table.concat(myTable," ") panel:getComponent("display3"):setPropertyString("uiLabelText",""..myConcat) end
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.