NAME

Synth::Config - Synthesizer settings librarian

VERSION

version 0.0016

SYNOPSIS

use Synth::Config ();

my $synth = Synth::Config->new(model => 'Moog Matriarch');

my $name = 'Foo!';

my $id1 = $synth->make_setting(name => $name, etc => '...');
my $id2 = $synth->make_setting(name => $name, etc => '???');

my $setting = $synth->recall_setting(id => $id1);
# { etc => '...' }

# update the etc key only
$synth->make_setting(id => $id1, etc => '!!!');

my $names = $synth->recall_names;
# [ 'Foo!' ]

my $settings = $synth->search_settings(etc => '???');
# [ 2 => { etc => '???' } ]

$synth->remove_setting(id => $id1);

$synth->remove_settings(name => $name);

DESCRIPTION

Synth::Config provides a way to save and recall synthesizer control settings in a database.

This does not control the synth. It is simply a way to manually record the parameters defined by knob, slider, switch, or patch settings in an SQLite database. It is a "librarian", if you will.

ATTRIBUTES

model

$model = $synth->model;

The required model name of the synthesizer.

This is turned into lowercase and all non-alpha-num characters are converted to an underline character (_).

dbname

$dbname = $synth->dbname;

Database name

Default: synth-config.db

verbose

$verbose = $synth->verbose;

Show progress.

METHODS

new

$synth = Synth::Config->new(model => $model);

Create a new Synth::Config object.

This automatically makes an SQLite database with a table named for the given model.

make_setting

my $id = $synth->make_setting(%args);

Save a named setting and return the record id.

The name is required. If an id is given, an update is performed. Otherwise, a database insert is made.

Example:

name: 'My Best Setting!'
settings:
  group   parameter control bottom top   value unit is_default
  filters cutoff    knob    20     20000 200   Hz   true

name: 'My Other Best Setting!'
settings:
  group parameter control group_to param_to is_default
  mixer output    patch   filters  vcf-1-in true

recall_setting

my $setting = $synth->recall_setting(id => $id);

Return the parameters of a setting for the given id.

recall_all

my $settings = $synth->recall_all;

Return all the settings for the synth model.

search_settings

my $settings = $synth->search_settings(some_setting => $value);

Return all the settings given a search query.

recall_names

my $names = $synth->recall_names;

Return all the setting names.

remove_setting

$synth->remove_setting(id => $id);

Remove a setting given an id.

remove_settings

$synth->remove_settings(name => $name);

Remove all settings for a given name.

SEE ALSO

The t/01-methods.t file in this distribution

Moo

Mojo::JSON

Mojo::SQLite

Knob: https://codepen.io/jhnsnc/pen/KXYayG

Switch: https://codepen.io/magnus16/pen/grzqMz

Slider: ?

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2023 by Gene Boggs.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)