Pbindef and \midinote

I’m having some strange behaviour with a Pbindef when using \midinote. The problem is that from time-to-time the Pbindef doesn’t recognise the \midinote argument as a midinote. However, if I change the name of the Pbindef, as an example Pbindef(\melody, \instrument, \aSynthDef) becomes Pbindef(\m, \instrument, \aSynthDef), then everything works. However, if I go back to using the name \melody the problem is still there!

My SynthDef has a freq argument, which I’m using in Formant.ar, so if I understand correctly that should work, or is there a problem when swapping \freq for \midinote in a Pbindef?

I can post the SynthDef and Pbindef, but since they seem to work when first initialised then the strange behaviour doesn’t always appear straight away.

Hope that makes sense.

Thanks in advance.

Under certain circumstances the state of a Pbindef might become somehow unstable. That sometimes happened to me in the past, but I cannot reconstruct the reasons. However you can try something like

Pbindef(\xy).clear

or, more drastically

Pbindef.removeAll

to cleanup.

1 Like

Thanks Daniel.

I did wonder about that as I couldn’t see any good reason for that to happen, I’ll try that next time.