Pure Data extension additional audio inlets how to?

Hi,

I’m currently working on a synth with 8 voices. The model is the Roland JP-8000. This synth has 8 voices (stereo). Not that it even comes close to the sound of the original. But that’s not what I’m talking about. These are my first steps in DSP programming, and I chose the JP-8000. It’s straightforward and delivers really good sound.

So: no problem at all. But: I don’t particularly like the [vcf~]. However, I do like the [bob~]. With 8 voices in stereo, that means 16 x [bob~]. Not feasible on the Organelle M. So I built a quite simple Moog-style 4-pole ladder filter that is integrated in the voice. It works quite well. Its sound isn’t comparable to [bob~], but it’s reasonably usable. This now should still run quite well on a Raspi 3.

Now I want to operate the cutoff frequency and resonance at audio rate as well. The extension is set up so that the first inlet receives messages that control the voice. Which works.

Now I’d like two more audio rate inlets with which I can control the cutoff and resonance. I just can’t seem to get it right. There’s something I’m missing, and I still don’t seem to understand it.

The extension code can be found here:

Perhaps one of you can help me out?

There is some good info here about writing externals:

Specifically Example 4 shows how to setup signal inlets to objects.

2 Likes

Thank you! In the end I turned on my brain. Audio rate inlets are always buffers. So my value is at position one of the buffer:

x->in_cutoff = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
x->in_reso = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
...
dsp_add(jpvoice_tilde_perform, 6, 
        x, 
        sp[0]->s_vec, // in_cutoff
        sp[1]->s_vec, // in_reso
        sp[2]->s_vec, // outL
        sp[3]->s_vec, // outR
        sp[0]->s_n);

t_int *jpvoice_tilde_perform(t_int *w)
{
    t_jpvoice *x = (t_jpvoice *)(w[1]);
    float cutoff = static_cast<float>(((t_sample *)(w[2]))[0]);
    float reso = static_cast<float>(((t_sample *)(w[3]))[0]);
    t_sample *outL = (t_sample *)(w[4]);
...

I’m not sure if this is the right way to go. But for now, it’s working.