1

I am trying to play audio through the play function of pydub play(audio_segment) but the function was getting constantly stuck on this function without actually playing the audio.

It seems like pydub is getting stuck on the def _play_with_pyaudio(seg): in the stream.open function of pyaudio on the line stream = Stream(self, *args, **kwargs).

If I pause between the creation of pyaudio and the opening of the audio stream, it plays through the audio stream just fine.

p = pyaudio.PyAudio()
    stream = p.open(format=p.get_format_from_width(seg.sample_width),
                    channels=seg.channels,
                    rate=seg.frame_rate,
                    output=True)

I am not getting an error, neither in code or in ALSA debug messages. How do I resolve this, I made sure to reinstall pyaudio, is it a problem in the library or in pyaudio? It seems to me that the problem is somewhere in pyaudio.

I am currently on pyaudio-0.2.11 and pydub 0.23.1. I am working in my personal Lubuntu virtual environment.

Lloyd
  • 1,119
  • 10
  • 29
  • does other audio playback work in the VM? it sort of sounds like the pyaudio isn't able to communicate with the audio device – Jiaaro Jan 23 '20 at 17:06
  • @Jiaaro Yes, other audio playback was and is working fine. I actually got this working by calling the function containing the specified pydub function from another python file. – Lloyd Jan 23 '20 at 19:21

0 Answers0