linux - How to play sound in Python WITHOUT interrupting music/other sounds from playing -


I am working on a timer in Python, which chimes when the waiting period expires. I use the following code: pseudo_play_play (): "" "Play sound file at once." Try "Sound_file = wave_open ('(n / a / dsp', 'w'): Except AFMT_S16_NE from ossaudiodev import (APMAS, NIC, SEP, FM, NF, Complex, Coommomm) imported irrows: if bitrate ==" small ": AFMT_S16_NE = ossaudiodev.AFMT_S16_LE Other: AFMT_S16_NE = ossaudiodev.AFMT_S16_BE dsp.setparameters (AFMT_S16_NE, NC, FR) data = sound_file.readframes (NF) sound_file.close () dsp.write (data) Dsp.close ()

This works very well, as long as no other device is already output sound.

How do I basically do (under Linux) Could Or is there any sound being played?

If you think the API will need to ensure the software mix in this process, please suggest a method :)

Support For Thx :)

Easy answer "Switch from OS to PulseAudio" (or to use DMIX Set up ALSA, or get soundcard with better Linux drivers ...)

More complex It's the vibe that your code is already the way you want it to ... on some sound cards. OSS drivers can expose hard-core mixers so that you can play multiple audio streams simultaneously, or they can highlight a single stream that displays the blocked audio that appears on your system. The only correct solution here is to use an API that ensures the software mix.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -