belangeo / pyo

Python DSP module
GNU Lesser General Public License v3.0
1.28k stars 130 forks source link

Running pyo in a headless server mode #268

Open lextoumbourou opened 1 year ago

lextoumbourou commented 1 year ago

Hi there,

Thanks a lot for pyo.

We are hoping to use pyo as a headless server, which would apply a bunch of effects to audio files when a user requests via an API call.

However, we are intermittently (around 10% of the time) receiving silent audio back from pyo.

We're pretty convinced that the issue is that we need to sleep for a variable amount of time between server.start() calls and server.stop(). However, the exact time is unclear. 5 seconds seems to decrease the rate of silence, although it doesn't give a 100% guarantee. Also, ideally, this API would be much faster than 5 seconds per request.

So my question is: is there any way to check if pyo is still processing before calling stop()? Or if not, would it be technically feasible to add as a feature?

Maybe a better question is: does pyo support running on a headless server like this? Is it recommended?

belangeo commented 6 months ago

I think what want to do is to run the Server in "offline" mode (compute as quick as possible). See the "audio" argument of the Server:

https://belangeo.github.io/pyo/api/classes/server.html