DrMarc / slab

python classes for working with sounds and conducting psychoacoustic experiments
MIT License
22 stars 7 forks source link

Add the Gstreamer backend as a fallback on Linux #26

Closed hadware closed 3 years ago

hadware commented 3 years ago

On most linux distro's (which should be ubuntu/debian based distro, in all fairness), gstreamer (and its python wrapper via gobjects) is present as a system dependency.

Maybe you could add it as a fallback, instead of having to rely solely on SoX. Here are some examples on how to use it (shameless plug).

DrMarc commented 3 years ago

I'm aware of gstreamer and was thinking about adding it at some point. Streaming players are aimed at playing longs signals though and often don't pay attention to starting latency. I'll have to measure that and test around a bit to see if it makes sense.

DrMarc commented 3 years ago

@OleBialas could you give this a try, since you are on ubuntu?

OleBialas commented 3 years ago

Seems to work, but in order to use PyGObject you have to install it plus it's dependencies (https://pygobject.readthedocs.io/en/latest/getting_started.html). If installing dependencies, one could directly go for the soundcard package which is OS independent or do you think there is any additional benefit in using gstreamer?

DrMarc commented 3 years ago

If it incurs additional installation and dependencies, then it may not make sense as a fallback. I'd rather encourage installing soundcard then, which also avoids tmp files and has considerably less latency.

hadware commented 3 years ago

Good point, i agree.