Skip to content

How to create a synthdef-factory #149

Answered by defaultxr
kflak asked this question in Q&A
Discussion options

You must be logged in to vote

You're getting that error because the format form is not being run at macro-expansion time, but instead is being passed to the defsynth form. When you macroexpand it, you can see that

> (macroexpand-1 '(defsynth-factory playbuf-mono
  :params ((buf 0) (rate 1) (start-pos 0) (loop 0) (attack 0.1)
                   (release 0.5) (gate 1))
  :sig ((env (env-gen.kr (asr attack 1 release)
                         :gate gate :act :free))
        (sig (* (play-buf.ar 1 buf rate
                             :start-pos start-pos
                             :loop loop)
                env)))))

becomes

(DOLIST (NUM-CHANNELS '(1 2 4 6))
  (DEFSYNTH (FORMAT NIL "~A-~A" PLAYBUF-MONO NUM-CHANNELS)
   …

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by kflak
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants