-
Notifications
You must be signed in to change notification settings - Fork 9
Generation
This app generates new melodies using an IDyOM model trained on a dataset. A composition in the dataset is selected as a base sequence, the remaining compositions are used for training, and new notes are sampled so that the resulting melody is probable under the model.
The top-level function is generation:idyom-generation. It has four required arguments. These are positional arguments and should be supplied in the following order:
-
dataset-id: the dataset containing the training material -
base-id: the composition id of the base melody used in generation -
basic-attributes: a list of basic attributes to generate -
attributes: a list of viewpoints used in prediction
The generation method is controlled by the :method parameter. The current options are:
-
:metropolis: use Metropolis-Hastings sampling to alter notes in the base melody -
:gibbs: use Gibbs sampling -
:random: generate a melody by sampling directly from the predictive distributions
Useful optional parameters are:
-
models: the model configuration to use (default:both+) -
method: the generation method (default:metropolis); use:gibbsfor Gibbs sampling or:randomfor direct sampling from the predictive distributions -
context-length: the number of initial events to preserve; ifnil, the method's default behaviour is used -
iterations: the number of sampling iterations -
events: for Metropolis sampling, stop when the specified proportion of events has changed -
position: for Metropolis sampling, choose events:forward,:backwardor:random -
pretraining-ids: additional datasets used for pretraining -
random-state: a random state for replicable output -
threshold: restrict sampling to events above a given probability threshold; if:maxis used, the most probable event is always chosen; ifnil(the default), the full distribution is used -
use-ltms-cache?: whether to reuse cached long-term models; the default ist -
output-path: if supplied, export the generated melody as a MIDI file; ifnil, return the generated sequence -
output-filename: the filename to use when exporting MIDI
If output-path is nil, the function returns the generated sequence. Otherwise it writes a MIDI file.
The following is an example:
This uses dataset 0, takes composition 0 as the base melody, generates the basic attribute cpitch, and predicts it using the source viewpoints cpintfref and cpint. The method is Metropolis-Hastings sampling with 100 iterations.
CL-USER> (generation:idyom-generation 0 0 '(cpitch) '(cpintfref cpint)
:method :metropolis :iterations 100)
The following example writes the generated melody to a MIDI file:
This uses the same dataset, base composition and viewpoints, but switches to the :random method and writes the resulting melody as idyom-generation.mid in /tmp/.
CL-USER> (generation:idyom-generation 0 0 '(cpitch) '(cpintfref cpint)
:method :random :output-path "/tmp/"
:output-filename "idyom-generation.mid")
-
User documentation
- Installation
- Database management
- Multiple Viewpoints
- Running IDyOM
- Applying IDyOM beyond prediction
- Related software
- Troubleshooting
-
Developer documentation