Overview Clamps Packages CM Dictionary Clamps Dictionary Fomus
Next: grain-buf-stereo , Previous: grain-buf , Up: G , Home: Overview

Clamps Dictionary

grain-buf-mono

Function

(grain-buf-mono &rest optional-keywords &aux (#:lambda-list '((buf (incudine-missing-arg |"buf"|) (trig-rate 10.0) (dur 0.1) (transp 0.0) (pos 0.0) (amp 0.5) (gate 1) (done-action #'free) id head tail before after replace action stop-hook free-hook fade-time fade-curve))))

Mono grain-buf dsp. Triggers at trig-rate hz. When gate becomes 0, calls done-action and frees the node.

Arguments

buf source buffer.
trig-rate grain trigger rate in hz.
dur grain duration in seconds.
transp transposition in MIDIcent (0 = no transposition).
pos start position in buffer 0..1.
amp amplitude (default 0.5).
gate 1 = playing, 0 = stop and call done-action.
done-action function called when gate closes (default #'free).

Example

(in-package :clamps)

(clamps-buffer-load "i-have-a-dream.wav")

(defvar *id* nil)

(grain-buf-mono
 (find-buffer "i-have-a-dream.wav")
 :action (lambda (node) (setf *id* (node-id node)))
 :head 200)

(set-control *id* :pos 0.2)
(set-control *id* :pos 0.5)

;; using a midi controller connected to :midi-1 in, sending ccin 0-3
;; on *default-midi-channel*

(defvar *unwatch* nil)

(reset-watch
  *unwatch*
  (set-control *id* :pos (ccin 0))
  (set-control *id* :transp (n-lin (ccin 1) -5 5))
  (set-control *id* :trig-rate (n-exp (ccin 2) 1 30))
  (set-control *id* :dur (n-exp (ccin 3) 0.1 1)))

Author: Orm Finnendahl

Created: 2026-06-24 Mi 18:02

Validate