VarGui shortcut builds:
Filter:
Tutorials (extension) | Libraries > miSCellaneous > GUI

VarGui shortcut builds
ExtensionExtension

quick building of slider / player guis for synths and sequencing

Description

VarGui allows combined control of Synths, Pbinds / EventStreamPlayers and Tasks in one GUI. Many of its options though may not be relevant for most usages, also control specs were to be given directly (changed with v0.5). Shortcut build methods take advantage of SynthDef controlspec metadata, if defined (or global ControlSpecs), and autogenerate Pbinds for sequencing. Controls and Pbinds can be customized with options. Main tools are the methods sVarGui ( synth ), pVarGui ( pattern ) and compound builders spVarGui / psVarGui. Methods sVarGui / pVarGui, applied to a single Symbol / String, produce a VarGui for one or more Synth(s) or Pbind(s) based on the referred single SynthDef ( Ex.1a, Ex.1b, Ex.2a, Ex.2b ). Both methods also apply to collections of SynthDef Symbols / Strings ( Ex.3a, Ex.3b ), whereas spVarGui and psVarGui, builders of mixed Synth / Pbind VarGuis, expect collections of two items which may be Symbols / Strings or collections of Symbols / Strings ( Ex.3c ). Examples are using Patterns from dynamic scope PLx suite for conveniently refering to environmental variables.

1. Synth GUIs

 

Ex.1a: default instrument

 

Ex.1b: SynthDefs including metadata

SynthDef with defined controlspec metadata. The specs can be stored as ControlSpecs or Arrays, may also be Symbols / Strings refering to the global dictionary of Specs (Spec.specs). It's only convention to store specs under the key \specs, it can be anything else, and nothing prevents you from storing more than one dictionary of ControlSpecs per SynthDef - the VarGui shortcut methods have a metaKey arg (default: \specs) which determines where to lookup in the metadata dictionary.

2. Sequencing GUIs

Controlling Pbinds / EventStreamPlayers with VarGui is based on (a) the setting of environmental variables and (b) the proper definition of Pbinds with Patterns of PLx suite or Patterns with functional code ( Event patterns and Functions ) so that EventStreamPlayers get the updated variable values in the following events.

Basic example of a Pbind to get envir values:

Especially when based on a SynthDef with a large number of args writing a Pbind can be lengthy, moreover redundant if there are many pbind pairs of the form

The pVarGui method is going the opposite way: Pbind pairs get this most simple form for all args with metadata or global ControlSpecs defined, though it's possible to exclude keys and add respectively replace customized pairs before and after the automatically generated ones. All you need is a SynthDef that is suited for Pbind sequencing (known to SynthDescLib by being added, properly defined Envelopes).

WARNING: As a lot of the underlying Pbind structure (by default all of it !) is hidden, it's possible to call pVarGui without knowing anything about Patterns. Nevertheless it's highly recommended to be aware of the mechanisms of Pbind for applying useful sequencing customizations and having a look at the fully written Pbind examples in VarGui. Clearly: adding, replacing and excluding Pbind pairs without seeing the resulting code is a possible source of error, so if using VarGui this way better start slowly and go on stepwise. With the post option you can print out the ordered list of pairs.

 

Ex.2a: default instrument

 

Ex.2b: SynthDefs including metadata

Automatic Pbind generation in VarGui shortcut builds is especially saving typing if SynthDefs have a lot of args and controlspec metadata defined.

 

Ex.2c: Combination of parameter control and pattern exchange (JITLib)

 

Ex.2d: Combination of parameter control and pattern exchange (PLx)

3. Mixed GUIs

To control Synths or Pbinds / EventStreamPlayers derived from more than one SynthDef sVarGui and pVarGui can be applied to collections.

 

Ex.3a: Synths from different SynthDefs

 

Ex.3b: Pbinds from different SynthDefs

 

Ex.3c: Synths and Pbinds

4. Differences between shortcut builds and direct VarGui instantiation

5. Shortcut method specifictions

Shortcut methods also take Functions, that should return args in a valid form. This can be used for defining controls in different ranges in combination with num. See examples above.

 

5a: core shortcut methods

Symbol: -sVarGui

SequenceableCollection: -sVarGui

Symbol: -pVarGui

SequenceableCollection: -pVarGui

NOTE: The following two methods are equivalent, just take opposite arg order. This is independant of arrangement, which can be determined by gui args sliderPriority (\var or \synth) and playerPriority (\stream or \synth).

SequenceableCollection: -spVarGui

SequenceableCollection: -psVarGui

 

5b: spec- and pbindmaker methods

In most cases you won't need this, except for reloading customized sequencing VarGuis ( 6 ). For special arrangements methods for making specdata and Pbinds of appropriate Pfuncs can be used for customizing control with direct VarGui instantiation. These methods take args in the same way as sVarGui and pVarGui.

Symbol: -sVarGuiSpecs

Symbol: -pVarGuiSpecs

Symbol: -pfuncPbinds

 

6. Save and load

A VarGui's slider state can be saved via save button and dialog. Loading is straightforward with Synths. You just have to give the correct path and synth arg (which maybe has to be an array).

VarGui only saves slider states, not the Pbind structure (would open a can of worms). So if you had a customized Pbind in the original setup you'd have to pass an appropriate Pbind together with load. This can also be a Pbind other than in the original setup. But if you want to restore you can nearly copy the input of the original cutomization into the pbindmaker method pfuncPbinds ( 5b ).