Python audio library for a quick, carefree loop of many short audio tracks

I am writing an application to simulate train sounds. I received very short (0.2 s) sound samples for each train speed, and I need to combine up to 20 of them (one for each train) without spaces at the same time . A direct change in sound patterns (train speed) is also required. I was looking for possible solutions for python-audio, including

  • PyAudio
  • Pymedia
  • pyaudiere

but I'm not sure which one is best for my use, so I really appreciate any suggestions and impressions!

PS: I already tried gstreamer , but since there is no release 1.0 yet, and I canโ€™t figure out how to get win-win playback for working with pygi, I thought there might be a better choice, I also tried pygame , but it seems to be limited 8 audio channels.

+4
source share
1 answer

I use PyAudio for many things and am very happy with it. If this is possible, I do not know, but I think it is possible.

One solution is to feed the audio buffer manually and control / set the required delay. I did this and it works very well. If you have a sufficiently high latency, it will work.

Another solution similar to this is latency management. You can queue and mix small audio files manually, for example. sizes 0.5-1 s. This will significantly reduce the requirements for "realism" and allow you to make pretty nice transitions between the "speeds"

I donโ€™t know what latency you are dealing with, but if we talk about train speeds, I think that they do not change instantly - therefore, latency from 500 ms to several seconds is most likely acceptable.

0
source

Source: https://habr.com/ru/post/1435516/


All Articles