pydub icon indicating copy to clipboard operation
pydub copied to clipboard

How can I hide 'pydub' output information?

Open bbbirkan opened this issue 3 years ago • 3 comments

My code:

from pydub import generators
from pydub.playback import play

play(generators.Sine(440).to_audio_segment(duration=1500))

In the console output:

Input #0, wav, from '/var/folders/_7/0q83l2vn4zjd7zgqpy3v97840000gn/T/tmphlm6i9s_.wav':
  Duration: 00:00:01.50, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 1 channels, s16, 705 kb/s

bbbirkan avatar Apr 11 '21 03:04 bbbirkan

Same question

lodenrogue avatar May 08 '21 14:05 lodenrogue

If you install simpleaudio (e.g. run pip install simpleaudio), it should play audio without emitting any text.

N.B. This output is coming from ffplay, which is a used because simpleaudio is not installed. We don't currently have any way to suppress output from ffplay. We would need to pass the arguments -loglevel -8 to the ffplay call. Arguably, this should be the default.

GreyAlien502 avatar Sep 07 '21 01:09 GreyAlien502

simpleaudio is not available on my device.

I find none of the answers mentioned above work.

I finally managed to hide the pydub playback output by using a subprocess.

If you are interested, I implemented at:

https://github.com/eliranwong/UniqueBible/blob/main/util/RemoteCliMainWindow.py#L287

eliranwong avatar Mar 03 '23 12:03 eliranwong