N voice library (deprecated)

continuing discussions from:

I’m sharing a proposal for a community library of synthesis engines based on a shared communication standard.

the goal

to open up a variety of use cases beyond typical poly synth stuff, without complicating the synth engine, + opening up some nice interactions for lua script authors. I’m proposing four basic assumptions around such an engine:

  • there are n voices
  • all the voices are the same (share the same parameters)
  • one parameter must set frequency in hz
  • one parameter must set the peak level of an envelope, or the volume/presence of a sound

usage

what I’ve worked on is a lua syntax for communicating with such an engine, here’s an overview:

nv.name(name) : select engine from the nv lib
nv.init(n) : initialize n voices
nv.vc : list of voices and parameters per voice (e.g. nv.vc[1].hz = 440 )
nv.all : list of global parameters, summed (multiplied if .hz) with voice parameters per voice
.hz : required parameter, frequency in hz
.peak : required prameter, specifies the peak of an envelope or volume of a sound
vc.list : list of additional parameter keys supplied by engine
nv.active : list of active voices, populated via engine polls
nv.free: list of free voices, populated via engine pools
nv.id(id) : voice allocator, assigns an id to a free voice & returns the voice if id does not exist, or returns actice voice if exists
nv.update() : sends table data to supercollider

in the repo I sketched up three example scripts - a regular poly-synth with a couple niche features, two simultaneous, asynchronously-enveloped arps, and a 20 voice MEGADRONE - all using the same engine and syntax

next steps

what do you think ? what haven’t I considered ?

this is the front end - given my limited comfort with supercollider, I’m seeking help with working on the back-end standard, modifying PolySub and coming up with engine params and polls to best suit the spec laid out in this lua lib. (I * assume * it would be best for the engine to receive per-voice values in a batch format, and send free/active states back to lua in a poll)

from there I can fill out the middle !

(aside: I’m not super attached to names of things, though I enjoy super concise character counts for stuff like this)

12 Likes

this is an awesome idea. i would definitely be keen on making an “n voice library” structure for arcologies that would read all these and store the voice for you.

I’m back ! I’ve got more or less a working draft of this going with PolySub

(be careful with drone.lua, for some reason the level initializations aren’t working properly)

I decided to store parameter values supercollider rather than lua and updated the spec to match. so there’s an Engine_Nv superclass that other engines inherit from, which means a lua helper file is optional rather than required. it seems like it works … but certainly still getting by bearings with SC

there are some bugs but the examples mostly work !

2 Likes

thank you for the script. :slightly_smiling_face: It just helps me to build a polyphonic engine based on the Mutable Instruments Tides supercollider Ugen.

Small note for the use of “poly.lua” : The variable “keyboard” in line 9 is now a global variable and therefore causes Matron to crash when you want to switch to another script.

ack - based on some feedback from ezra i decided to abandon this code, the repo is an archive but i probably should’ve left a note here. i’d say this lib complicates things more than it simplifies them ! and probably plenty more bugs

i started on a new potential library for voice-management-ish stuff in the engine i’m working on (supercollider only)

feels much more focused & sensible than this project so far but i’m still really new to SC & i can’t yet say for sure if it’s in a good state

4 Likes

Yes, I had seen that this was already archived. But for my purposes (limit polyphony) it is ideal. Another advantage of the script is the possibility to quickly add more parameters of the synth. I had tried thebangs from Ezra, but there I have strangely MIDI latency problems, besides thebangs is meant for oneshots. (If you play pure chords the single notes are triggered shortly after each other.) I will test your toy keyboard script and give you feedback.

In my somewhat cheesy YouTube video, your N Voice library controls the polyphony.

1 Like

yea, i do like autogenerating the commands & plumbing from the synthDef args - that’s still in there (it’s the ‘gator’ class btw) but i didn’t include anything to limit the voice count or allocate voices (it’s only needed for high-CPU synthDefs which are maybe maybe better to avoid if possible) - you could do that on top of this supercollider layer using the voice lib (which nv does/did)

1 Like