Skip to content
Jean Bresson edited this page Jul 17, 2018 · 23 revisions

The DYCI2 library was designed for improvisation and style imitation: it works on sequences of abstract labels (e.g. chord labels, etc.) matching segments of a memory. DYCI2 produces new sequences by recombinations of these memory segments, given a scenario expressed as a sequence of labels, and keeping some properties learned from the memory.

Basics

The main object in om-dyci2 is DYCI2GENERATOR. It is initialized with a memory (list of "segments") and a sequence of labels indexing this memory (=> two lists of the same length). Currently DYCI2GENERATOR only support strings as memory segments and labels.

In the simple example below the memory is a simple list of 9 segments ("s1", ..., "s9") indexed by an alphabet of 3 labels ("A", "B", or "C"). Once the generator is initialized, a query can be made using the dyi2query function, and a new list of labels driving the sequence called the scenario.

The patch dyci2generator-basic provided with the library reproduces a similar example.

Musical sequences

In most case with real musical sequences, the memory will simply consist in indices or time markers indicating the beginning and end time of each segment. These markers can correspond from to the markers in an audio file, chords or other events in a MIDI sequence, etc. (see examples below).

Depending on the application at hand, a first trick will be to convert both the list of time markers and the corresponding labels into lists of strings suitablme to initalize a DYCI2Generator. A second trick will be to recombine a sequence from the new list of memory segments.

Two cases are covered in the library examples:

  • a segmented and labelled audio file
  • a MIDI file including text labels.

Audio file

Let's start with an OM audio file (SOUND object) containing labelled markers.

In o7, markers and labels can be set and extracted using the :markers inputs of the SOUND box. Labeled markers are output as a list of ((time "label") (time "label") ...). From this list needs to be gereated:

  • A list of segments formatted as strings: ("(t1 t2)" "(t2 t3)" ...)
  • A list of labels

The result of a query is a new list of ("(ta ta+1)" ... "(tx tx+1)" ...). From this list needs to be retrieved and sequenced segments if the original audio file. This can also be done using standard OM audio tools.

=> See the patch dyci2generator-audio provided in the library

Hint: get markers and labels from an external software

OM/o7 provide tools to process files and extract labels and time markers coming from external tools.

AudioSculpt for instance provides powerful means to automatically segment an audio file in beats and let you input labels attached to the beat markers. Markers can then be exported as SDIF files, and imported in OM.

Depending on your annotation and storage convention, different patches will need to be programmed to retreive the correct foprmat for memory and labels.

Loading memory in OM

.wav file

Loading memory Unlock these four boxes (b) and evaluate the file chooser boxes. On the first, which is connect to the sdiffile box, your .sdif file: the one you saved earlier. On the second, choose your audio file in a .wav format. Lock these boxes, evaluate the remaining boxes, then lock them.

.midi file

Making a generator

.wav file

Getting labels

With the GetLabels patch, whose two input are connected to the sdiffile box, you formate your .sdif file, then you collect in the first output your labels like ( ("nil" "nil" ... "C" "C" "A" "A" "G" "G" "G" ...) for our example, and in the second your segments corresponding to your labels.
Labels output

Making a generator

We use for this the dyci2generator command. On the MEMORY spot, connect your segments list, formatted like ("(start1 end1)" "(start2 end2)"...). On the LABLS spot, connect your labels list, formatted like ("lab1" "lab2"...). This box gives us in the self spot an element from the DYCI2 Generator class which is made for queries.
Making a generator

.midi file

Making queries

Queries

In order to use the dyci2query command, connect on the SELF spot an element from the DYCI2 Generator class and on the QUERY a labels query formatted like ("lab1" "lab2"...). In fact, this query is the result of a patch whose input is your query on the textbuffer written like lab1 lab2 lab3... and where you have to avoid spaces and replace them by a '-' character. This box, dyci2query, returns a segments list that respects your contraints. It still must be formatted but that is your result. Making a query

###Setting parameters We also have a lot of options with which you can drive your scenario generation: with the dyci2setparam command, you can connect on the SELF spot an element from the DYCI2 Generator class, on the TYPE spot type of your input (currently, only integers exist in), on the PARAMETER spot, the parameter you want to change (currently, only "avoid_repetitions_mode" and "max_continuity" exist) and in the fourth spot, the VALUE spot, put the value of your parameter.
Setting parameters

  • avoid\_repetitions\_mode :
    • set at 0: it avoids many use of the same segment from the memory in the output sequence.
    • set at 1: it favors the least used segments for the output sequence.
    • set at 2: it allows repetitions of every segments in the output sequence.
  • max\_continuity : the input must be a natural integer which represents the maximum length of a segments sequence from the memory in the output sequence.
Clone this wiki locally