0

I'm trying to figure out Pure Data's Abstractions.

I have a simple synth program and I try to pull two copies of it into a second pd program.

However it seems like although I have twice as much sound, I can't tweak the controls of the Abstractions independently. The volume controls seems to work separately, but when it comes to filter cutoff and resonance controls etc. both synths seem to be using the same values. And only one of the UIs (put onto the main screen with graph-on-parent) seems to affect this.

As a programmer, I understand variables and scope, but I'm really not making much sense of documentation like http://en.flossmanuals.net/pure-data/dataflow-tutorials/dollar-signs/ which seem to be written for people who don't understand such things.

I assume that Abstractions are not completely separate namespaces but that namespace-like behaviour is faked somehow with these random numbers in $0.

I'm currently not using any $0s in this Abstraction and I suppose that is why I'm getting the interference between the two instances of it. But I really can't see how I'm meant to.

So can anyone recommend a good tutorial that explains how the scoping rules of Abstractions work in PD? Or that just gives a clear tutorial in how you can use multiple copies of the same Abstraction in the same program.

If it's at all useful, here's the synth I'm trying to use two copies of :

#N canvas 100 100 500 500 10;
#X obj 150 30 hsl 120 20 0 127 0 0 empty empty pitch1 -2 -8 0 10 -262144 -1 -1 0 1;
#X obj 300 30 hsl 120 20 0 20 0 0 empty empty twin_pitch_diff_1 -2 -8 0 10 -262144 -1 -1 0 1;
#X obj 20 40 +~;
#X obj 20 80 phasor~ 0;
#X obj 20 120 +~ -0.5;
#X obj 20 160 phasor~ 0;
#X obj 20 200 +~ -0.5;
#X obj 20 240 +~;
#X obj 450 30 hsl 120 20 -10 10 0 0 empty empty filt_freq_phasor_speed_1 -2 -8 0 10 -262144 -1 -1 0 1;
#X obj 20 280 phasor~ 0;
#X obj 20 320 *~ 1000;
#X obj 90 70 hsl 120 20 0 10 0 0 empty empty filter_res_1 -2 -8 0 10 -262144 -1 -1 0 1;
#X floatatom 20 360 5 0 0 0 - - -;
#X obj 20 400 vcf~ 440 1;
#X obj 240 70 hsl 120 20 -15 15 0 0 empty empty lfo_1 -2 -8 0 10 -262144 -1 -1 0 1;
#X obj 20 440 loadbang;
#X msg 320 70 0.0001;
#X obj 20 480 phasor~ 0;
#X obj 20 520 *~;
#X obj 20 560 delwrite~ echo_1 1001;
#X obj 470 70 hsl 120 20 0 1000 0 0 empty empty echo_1_feedback_time -2 -8 0 10 -262144 -1 -1 0 1;
#X obj 20 600 vd~ echo_1;
#X obj 90 110 hsl 120 20 0 0.9 0 0 empty empty echo_1_feedback_gain -2 -8 0 10 -262144 -1 -1 0 1;
#X obj 20 640 *~;
#X obj 240 110 hsl 120 20 0 1 0 0 empty empty vol_1 -2 -8 0 10 -262144 -1 -1 0 1;
#X floatatom 20 680 5 0 0 0 - - -;
#X obj 20 720 *~;
#X obj 20 760 outlet~ ;
#X connect 0 0 2 0;
#X connect 1 0 2 1;
#X connect 0 0 3 0;
#X connect 3 0 4 0;
#X connect 2 0 5 0;
#X connect 5 0 6 0;
#X connect 4 0 7 0;
#X connect 6 0 7 1;
#X connect 8 0 9 0;
#X connect 9 0 10 0;
#X connect 11 0 12 0;
#X connect 7 0 13 0;
#X connect 10 0 13 1;
#X connect 12 0 13 2;
#X connect 15 0 16 0;
#X connect 16 0 14 0;
#X connect 14 0 17 0;
#X connect 13 0 18 0;
#X connect 17 0 18 1;
#X connect 18 0 19 0;
#X connect 20 0 21 0;
#X connect 21 0 23 0;
#X connect 22 0 23 1;
#X connect 23 0 19 0;
#X connect 24 0 25 0;
#X connect 21 0 26 0;
#X connect 25 0 26 1;
#X connect 26 0 27 0;
#X coords 0 -1 1 1 540 140 1 70 10;

1 Answer 1

1

I don't have time to look at your patch now, but would strongly think your cross-talk problem is related to the lack of $0s in the abstraction.

$0s aren't really variables in the same way as $1, $2, etc. which can be assigned numbers by the user. Instead, they represent unique ID numbers that are automatically assigned to an abstraction - and, critically, are unique to each abstraction! Therefore, if you use two instances of the same abstraction in a patch, each instance of the abstraction will be assigned a different number.

This is useful if you're using wireless connections, like 'send', 'receive', 'throw~', 'catch~', or any delay effects, each of which you assign an address name to (eg. [send output] and [receive output] ). If you have multiple abstractions running at the same time, and each has a wireless connection, PD won't know which address name to send the signal to, as there will effectively be multiple instances of the receiving connection.

So, for multiple instances of the same abstraction, instead of [send output] being received by [receive output], you need [send $0-output] being received by [receive $0-output]. By doing this you're in effect assigning the objects in each instance of an abstraction a different name.

Get it? Not sure about tutorials, but some of the PD forums are very good.

1
  • Yes, that was it. I actually had a delay-line using a delwrite~ and vd~ with a named buffer that didn't have $0 appended to the name.
    – interstar
    Mar 28, 2014 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.