robbielyman / seamstress

seamstress is an art engine
GNU General Public License v3.0
129 stars 12 forks source link

params: starting point! #27

Closed dndrks closed 1 year ago

dndrks commented 1 year ago

hihihi <3 @ryleelyman, seamstress has been such a fantastic project to follow, thank you for extending the inherent fun of scripting musical ideas in Lua to such fantastic depths!!

inspired by discussions on Discord + #18 , i built up a starting point for importing the power of norns params and bending their API and methods for control to use in the seamstress environment. there are a lot of useful things to be done from here, but i feel like these introductory bits would be good to have in many hands.

image

summary

keyboard nav + interaction

though mouse-based interactions are entirely possible + super fun with seamstress, i think that this environment has a unique opportunity to accommodate many different Accessibility needs than is possible with norns. so, i've rooted all the parameter interactions in keyboard control:

scripting

controlspec-powered params

when scripting for norns, i really like using controlspec to define parameters. under the hood, all the raw values are between 0 and 1, even if they each have different ranges, quantizations, and meaning. this makes modulating values very easy, because i don't need to know how many items an option table has, or whether a parameter is 1-indexed, etc -- i just need to pass a value between 0 and 1. but their flexibility means instantiating them is a little bloated.

so, i've included three 'presets', which are each just controlspec under the hood, following the norns API:

visual adjustments

to accommodate color needs + preferences, the highlight color can be defined (in RGB) by the running script:

eg.

all

test script

function init()
  paramsMenu.highlightColors.r = 230
  params:add_separator('testHeading1', 'hello!')
  params:add_number('lvl', 'level', 0, 100, 23, '%')
  params:add_number('lvl2', 'level2', 0, 100, 87, '%')
  params:add_number('lvl3', 'level3', 0, 100, 34, '%')
  params:add_separator('testHeading2', 'some groups!')
  params:add_group('interstitial', 'interstitial group', 5)
  params:add_option('opt1', 'some options', {'hi!', '<3', 'bye!'}, 1)
  params:add_control('ctrl1', 'unipolar', controlspec.UNIPOLAR)
  params:add_control('ctrl2', 'freq', controlspec.FREQ)
  params:add_number('lvl7', 'level7', 0, 100, 28, '%')
  params:add_number('lvl8', 'level8', 0, 100, 93, '%')
  params:add_group('last_ones', 'last ones!', 2)
  params:add_number('lvl9', 'level9', 0, 100, 19, '%')
  params:add_number('lvl10', 'level10', 0, 100, 64, '%')
  params:hide('lvl10')
  paramsMenu.rebuild_params()
  params:bang()
end

please lmk any thoughts / feedback -- all of this is modified norns code, so i tried to strike a balance with wholesale importing (eg. controlspec.lua was a copy/paste except for fixing up a 5.3-deprecated math function) and purposeful omissions, given the scope of seamstress. there are a lot of directions into which this could be extended (MIDI mapping, PSET management, different parameter types), but hopefully this feels like solid footing from which to jump!