February 27Feb 27 Hi,I’ve experimented with Opusmodus GPT and created this tool for my personal use. However, I thought it might be helpful for some of you, so I’m sharing it.GEN-SLONIMSKY-PATTERNSynopsis(gen-slonimsky-pattern octaves divisions &key interpolation infrapolation ultrapolation root direction dedupe dedupe-mode dedupe-tolerance limit-to-octave trim-with-gen-trim interpolation-permutation remove-consecutive-repeats transpose rotate)DescriptionGEN-SLONIMSKY-PATTERN generates a Slonimsky-like procedural pitch pattern as an Opusmodus pitch list.Conceptually, the function builds a chain of “principal tones” across a span of octaves (converted to a total chromatic span), subdivided into divisions. For each principal tone, it can optionally insert:an infrapolation pitch (below the principal tone),one or more interpolation pitches (offsets around each principal tone),an ultrapolation pitch (above the principal tone).After construction, the pattern can be octave-wrapped, de-duplicated (exactly or with a tolerance), trimmed to a target size, filtered for repeats, then optionally transposed and rotated.The function returns either one pitch list or a list of pitch-lists, depending on :interpolation-permutation.ParametersRequiredoctavesNumber of octaves covered by the pattern. Internally, the chromatic span is (* 12 octaves).divisionsNumber of divisions across the total span. The step size is computed as:step = (/ (* 12 octaves) divisions)The principal-tone loop iterates i = 0 .. divisions (inclusive), so endpoints are included.Keyword optionsPattern content:interpolation (default: NIL)A list of numeric offsets (in MIDI units) inserted after each principal tone. Each k produces an inserted pitch at pt + (dir-sign * k).:infrapolation (default: NIL)If non-NIL, inserts one pitch below each principal tone: pt - infrapolation (respecting direction sign as implemented).:ultrapolation (default: NIL)If non-NIL, inserts one pitch above each principal tone: pt + (dir-sign * ultrapolation).:root (default: 'c4)Root pitch (Opusmodus pitch symbol). Converted to MIDI via PITCH-TO-MIDI. :direction (default: :up)Either :up or :down. Controls the sign of principal-tone stepping and of interpolation offsets.De-duplication:dedupe (default: NIL)Enables de-duplication after optional octave-wrapping.:dedupe-mode (default: :consecutive):consecutive removes only consecutive duplicates.:all removes duplicates globally (first occurrence kept).:dedupe-tolerance (default: 0)If 0, duplicates are detected by exact MIDI equality.If > 0, two MIDI values are considered equal if their absolute difference is <= dedupe-tolerance.Octave limiting:limit-to-octave (default: NIL)NIL: no wrappingT: wraps every MIDI value into the octave [root, root+12) (relative to the MIDI value of root), then converts back to pitches.Trimming / sizing:trim-with-gen-trim (default: NIL)If true, calls GEN-TRIM to force a computed target size. GEN-TRIM trims or extends a list to the requested length. The internal target size is computed as:target-size = divisions + (length interpolation) + (if infrapolation 1 0) + (if ultrapolation 1 0)(Note: principal tones are generated with endpoints included, but the trimming target is computed as shown above.)Interpolation permutation:interpolation-permutation (default: NIL)Controls only the ordering/selection of the :interpolation list; principal tones remain fixed.Supported values:NIL → uses interpolation as given.:all → generates all permutations of interpolation via PERMUTE and returns a list of pitch-lists (one per permutation). :messiaen → applies MESSIAEN-PERMUTATION to the interpolation list. For length 2, the code forces :type :openby default. (MESSIAEN-PERMUTATION is documented with :type options such as :open / :closed.) (:messiaen type) → uses MESSIAEN-PERMUTATION with an explicit :type. (:nth n) → takes the nth permutation from (permute interpolation) and builds a single pattern.Repeat filtering:remove-consecutive-repeats (default: NIL)If true, applies (filter-repeat 1 ...) to the trimmed pitch list. FILTER-REPEAT limits repetitions; with n = 1 it removes consecutive repeats. Post transforms (new):transpose (default: NIL)If non-NIL, applies (pitch-transpose transpose sequence) to the final pitch list.:rotate (default: NIL)If non-NIL, applies (pitch-rotate rotate sequence) to the (optionally transposed) result. PITCH-ROTATE supports rotation-number as a number or list, and has keyword options such as :chord (default T). Return valueIf :interpolation-permutation is :all → returns a list of pitch-lists (one per permutation variant).Otherwise → returns a single pitch list.Pitch conversion uses MIDI-TO-PITCH for the final MIDI list back to pitch symbols. Examples;; Basic example + consecutive de-dupe + target trimming (gen-slonimsky-pattern 1 2 :root 'c4 :direction :up :interpolation '(1 6) :dedupe t :dedupe-mode :consecutive :trim-with-gen-trim t) ;; target-size = 2 + 2 = 4 ;; With infra + ultra, trimmed to target size (gen-slonimsky-pattern 1 2 :root 'c4 :direction :up :interpolation '(1 6) :infrapolation 1 :ultrapolation 2 :trim-with-gen-trim t) ;; target-size = 2 + 2 + 1 + 1 = 6 ;; Messiaen permutation of interpolations (principal tones unchanged) (gen-slonimsky-pattern 1 2 :root 'c4 :direction :up :interpolation '(1 6) :trim-with-gen-trim nil :interpolation-permutation :messiaen) ;; Messiaen permutation + remove consecutive repeats (gen-slonimsky-pattern 1 2 :root 'c4 :direction :up :interpolation '(1 6) :trim-with-gen-trim nil :interpolation-permutation :messiaen :remove-consecutive-repeats t) ;; Transpose then rotate (melodic rotation) (gen-slonimsky-pattern 1 2 :root 'c4 :direction :up :interpolation '(1 6) :interpolation-permutation :messiaen :remove-consecutive-repeats t :transpose 2 :rotate 1) ;; Rotation with a longer interpolation set (gen-slonimsky-pattern 1 2 :root 'c4 :interpolation '(1 6 8) :trim-with-gen-trim t :rotate 2) ;; Random interpolation offsets + random rotation amount (gen-slonimsky-pattern 1 2 :root 'c4 :interpolation (rndn (rndn 1 2 5) 1 11) :trim-with-gen-trim nil :rotate (rndn 1 0 11))Related documented functions (used internally)PITCH-TO-MIDI (list &key quantize remain)MIDI-TO-PITCH (values &key quantize remain)GEN-TRIM (n sequence ...) (trims/extends to length) FILTER-REPEAT (repeat limiting / consecutive control) PERMUTE (sequence) (all permutations) MESSIAEN-PERMUTATION ... :type ... (permutation strategies, e.g., :open, :closed) PITCH-ROTATE (rotation-number sequence &key chord section exclude ambitus) gen-slonimsky-pattern.lisp
February 27Feb 27 Thanks, StephaneI was using the function sieve for that.(setf patt '(1 5))(setf pitches (gen-sieve '(c4 e6) patt :type :pitch))
Create an account or sign in to comment