Pisound button and Pure Data

Is it possible to read the state of the Pisound button in Pure Data? And if so, how do I do it?


What do you mean by state? If you want to monitor the button log:

sudo journalctl -f -u pisound-btn

Hope this help. Thanks.

Yes it does help. By ‘state’ I mean whether the button is being pressed or not, and the button log gives me the information I need, so thanks for that.

However, I’m building a guitar effects pedal using Pure Data and I want to control the effect with the Pisound button, so I need to monitor the button log in the Pure Data patch. Is that possible?

I’ve only just started using Pure Data and Pisound so apologies if my questions are simplistic or I’m missing the obvious.


Hey, you’d have to override all the actions that the button currently does to use it in Pure Data, the default actions would be interfering with your system.

You could disable all actions but the up and down (setting them to do_nothing script) and write custom scripts for up and down actions to somehow let PD know of the buttons’ current state, like writing 0 or 1 to some common file at a known location, and reading / monitoring it from Pure Data patch. Unfortunately I don’t know any objects in PD that would be useful for that.


I’ve found a way to do it. Although I haven’t tested it yet, I’ll outline the concept below just in case anyone is interested.

Pure Data can receive text messages over a TCP network connection using the ‘netreceive’ object. Eg:

[netreceive localhost 55000]

To send a message from the Pisound button, associate a custom script with a button action and use the Linux netcat utility to send a message to Pd. For example:

echo 'btnclick;' | nc localhost 55000

There may a simpler way to achieve the same effect but I haven’t found it yet.


I think this solution is actually a pretty good one! :slight_smile: