Complement problem

Evening All,

I’m having a slight problem in returning the correct output from the COMP object. P & N forms are fine but the COMP simply outputs the same hexachord as the original. Am i missing something?

Any help would be much appreciated. Thank you in advance!

hello krhes,
It cannot be seen what values are you setting in the 2nd and 3rd inputs. by default they are 4 and 5. just change the 3rd input value to 6 and you’ll get the right results.
sorry I can’t help better. I don’t have an explanation for it, I arrived to it just by intuition.
update: I can confirm that the 3rd input must be set with a number equal or greater than that of the complement’s cardinality. the 2nd input? no idea yet.

Good morning Perti,

Thanks very much for your help. I did try your suggestion but the output generated was 0 1 2 3 4 5 6 8 8 9 10! When setting the second input to 6 the answer was correct (I assume the setting 6 [hexachord] is what helped). Your intuition certainly spurred me on.
The information for mathstools is generally very good but it’s at moments like these I wish it was a little last ambiguous. However, perhaps this is my own failing!
Have a good day,

Hi krhes and petri,

I hope this can help a little (sorry, I am a musician, not a programmer).

I have observed the ‘comp’ lisp code, I think it is founded on ‘pcs-complement’, that is founded on ‘pcs-complement-f1’ that is founded on ‘gen-integer’. You can select objects and press ‘e’ for visualizing the code.

If I understand good some how ‘gen-integer’ force the ‘comp’ algorithm to consider only integer from 0 to 11. And petri’s observation about putting 6 in third ‘comp’ inlet is right. I have also tried with 0 and 6 (second and third inlet). I think it is in dependence from some ‘<’ and ‘>’ evaluation inside ‘pcs-complement’ code, but I can not say I have understood it completely, sorry.

I enclose a figure. In first ‘comp’ chain (0 6 11 13 15 22) give me (1 2 3 4 5 7 8 9 10) because only (0 6 11) numbers are considered (that is only from 0 to 11). In fact (second ‘comp’ chain) to have krhes’s right solution I must first apply mod12 to (0 6 11 13 15 22).

Sorry for my not complete clearness…



Dear fdsdb,

Thanks very much for your thoughts and the schematic. I will go back and check my wiring! Concision and elegance seem work best, but as you say, the programming aspect leaves me unsure as a musician. However, now that my patch works I’m happy!

Have a good day and thanks again,