Overview Clamps Packages CM Dictionary Clamps Dictionary Fomus
Next: find-buffer , Previous: filter , Up: F , Home: Overview

Clamps Dictionary

filter-idx-interp

Function

(filter-idx-interp seq num idx-interp)

Return a sequence with num elements extracted from seq with a distribution of elements according to idx-interp. This only works, if (> (length seq) num). The extracted sequence will always contain the first and last element of the source sequence. Index interpolation is a list of coordinate pairs denoting the distribution of delta Indexes with x values normalized to the range [0..1], 0 and 1 denoting the start and the end of the sequence respectively. The y values in the index interpolation denote the deltaindex at the respective positions.

seq - Seq of src elements. num - Number of elements of the target sequence. idx-interp - List of coordinate pairs.

Example

;; Extract 8 elements from a Sequence with 12 elements with every
;; second element at the beginning, then going down to every element
;; in the middle, going up to every second element at 0.75 of the
;; source sequence and finally going down to every element at the end:

(filter-idx-interp '(1 2 3 4 5 6 7 8 9 10 11 12) 8 '(0 2 0.5 1 0.75 2 1 1))
; -> (1 3 5 6 7 9 11 12)
idx-interp-plot.svg
Figure 4: Plot of the distribution of delta-indices
;;; The same using a chord:
(score-display
 (let ((pitches (mapcar (lambda (partial) (ftom (* partial (mtof 54)))) '(4 5 6 8 9 10 11 13 15 17 18 19))))
   (append
    (make-chord pitches)
    (make-chord (filter-idx-interp pitches 8 '(0 2 0.5 1 0.75 2 1 1)) :time 1)))
 :xscale 0.1)
filter-idx-interp.svg
Figure 5: Chord and filtered chord

Author: Orm Finnendahl

Created: 2025-12-15 Mo 22:48

Validate