[PD] Linux: changing sound card params from patch, sending OS commands

Claude Heiland-Allen claudiusmaximus at goto10.org
Tue Apr 11 15:17:49 CEST 2006


John Harrison wrote:
> I'm using Pd as part of the engine for an interactive art project. The 
> setup is an old PII laptop running xubuntu Dapper. I'm stuck on a few 
> things:
> 
>    1. It's a long story but the bottom line is that it appears that I
>       have to use this crappy computer as well as its less-than-steller
>       internal sound card, and that the internal sound card or driver
>       has some sort of bug which requires me to switch to ALSA *after*
>       starting Pd. Everything else produces no sound. And OSS is
>       completely inoperative. So is there a way I can do this in a
>       patch? (The sound card is a Yamaha OPL3-SA23 BTW.)

Create a little patch like:

[receive pd]
  |
[print]

Then use Pd's audio dialogue to set the audio up the way you want it, 
which should print a long cryptic message.  Then recreate this message 
in Pd, like this:

[loadbang]
  |
"message that was printed with audio settings"
  |
[send pd]

Alternatively you can send this audio settings message from the command 
line that starts Pd, with the -send command line option.  Something like 
  'pd -send "; pd dsp 1"' works for activating DSP, the same technique 
works for audio settings.

However:  this has the side-effect of opening the audio settings 
dialogue window, and I don't know how to close this window programmatically

This is the only way I have managed to get pd-0.39.2 to start with JACK 
ports enabled, without having to manually activate them in the dialogue 
window.  Needless to say it is very inconvenient, and it would be much 
better if Pd really did obey the command line parameters for audio settings.

>    2. I'd like Pd to be able to send commands to the OS such as shutdown
>       -h "now" when the gallery closes each evening. Is there a way to
>       send such commands from a patch? The only thing I could think to
>       do is send a message to a Python script using sockets....seems
>       rather clumsy.

There is the [shell] Pd external, but I've never used it myself.  I'm 
thinking there would be permissions issues, depending if the user 
running Pd has the right to shutdown the computer or not (I'm not 
familiar with Ubuntu).  If the user running Pd doesn't have that 
permission, I think socket communication is a logical way to send 
information to a script run by a user with the permission.

But, cron is designed for running commands at certain times, so it might 
be easier to use that.

> Thanks,
> 
> -John

Hope this helps,


Claude
-- 
http://claudiusmaximus.goto10.org




More information about the Pd-list mailing list