Search code examples
puredata

Openpanel and symbol communication not working


I am trying to make a patch that plays audio when a bang is pressed. I have put a symbol so that I don't need to keep reimporting the file. However it works sometimes but not all the time.

A warning in the Pd console reads: Start requested with no prior open

However I have imported an audio file

Is there something that I have done wrong?


Solution

  • Use [trigger] to get the order-of-execution correct.

    One problem is, that whenever you send a [1( to [readsf~] you must have sent an [open ...( message directly beforehand. Even if you have just successfully opened a file, but then stopped it (with [0() or played it through (so it has been closed automatically), you have to send the filename again.

    The real problem is, that your messages are out of order: you should never have a fan-out (that is: connecting a message outlet to multiple inlets), as this will create undefined behavior.

    Use [trigger] to get the order-of-execution correct.

    (Mastering [trigger] is probably the single most important step in learning to program Pd)