SuperCollider Synthdefs that can play chords

I can play chords with Sonic Pi synths:

use_synth :dsaw

play 60

play(note: chord(:c3, :major))

No problem. When I write my own ones though they play single notes fine, then they crash when I play chords:

use_synth(:mysecondsynth)

play 60

play(note: chord(:c3, :major))

The error is:

Thread death!
Unable to normalise argument with key note: and value (ring <SonicPi::Chord...

So I am learning SuperCollider and figure this must be my problem and look at passing arrays as parameters and stuff. Nothing I try works. Then I read the source code to SuperCollider synths in github and they all seem to be single note synths.

I took the source of sonic-pi-rodeo renamed it an ran it and it did indeed fail with the same error on a chord.

Is there an example of how to write a SuperCollider synth that accepts chords as well as notes for me to look at?

I’m not sure about the answer to your question, but in the meantime, you can always use a workaround to play each note separately:

use_synth(:mysecondsynth)

chord(:c3, :major).each do |note|
  play note
end

yeah, but if the plan is to get more synths bundled with Sonic Pi using Supercollider that’s not really sustainable and if you are trying to do more complex synthesis then not having all the notes available in your SynthDef might be limiting, perhaps?