[Python-ideas] Python Sound API (Was: Cross Platform Python Sound Module/Library)

anatoly techtonik techtonik at gmail.com
Wed Sep 11 18:54:00 CEST 2013


On Sat, Apr 27, 2013 at 11:59 PM, M.-A. Lemburg <mal at egenix.com> wrote:
> On 27.04.2013 22:19, anatoly techtonik wrote:
>> On Sat, Apr 27, 2013 at 1:51 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>>
>>> On Fri, 26 Apr 2013 20:39:30 -0700
>>> Andrew Barnert <abarnert at yahoo.com> wrote:
>>>> On Apr 26, 2013, at 16:59, Greg Ewing <greg.ewing at canterbury.ac.nz>
>>> wrote:
>>>>
>>>>> Oleg Broytman wrote:
>>>>>> Are there cross-platform audio libraries that Python could wrap?
>>>>>
>>>>> There's OpenAL:
>>>>>
>>>>>   http://connect.creativelabs.com/openal/default.aspx
>>>>>
>>>> There's actually a bunch of options.
>>>>
>>>> The hard question is picking one and endorsing it as "right", or at least
>>>> "good enough to enshrine in stdlib ala tkinter".
>>>
>>> When you notice how "good enough" tkinter is (and has been for 10
>>> years at least), you realize the trap hidden in this question.
>>>
>>> Really, see my message earlier in this thread. This is better left to
>>> third-party libraries (which already exist, please do some research).
>>>
>>
>>>From the other side if 80% of cases can be covered without Python packaging
>> problems - that's already an advantage. For example most people find date /
>> time functionality in Python enough to avoid using mxDateTime as a
>> dependency. As for audio, most people find it insufficient.
>
> I'm not sure whether 3D audio support is really needed as core
> feature in a general purpose programming language ;-)
>
> I'd suggest to have a look at http://www.libsdl.org/, which can
> be used from Python via http://pygame.org/

3D audio support is not the basic common cross-platform base layer.
Many devices that run Python are mono at all.

What stdlib should concentrate on are basic audio operations needed by
people with accent on pure Python implementation of everything that
not represents system layer. Safe sound synthesis and sound output in
canonical format. If people need advanced algorithms and operations,
they are free to use SDL2, OpenAL, FFmpeg and other libs that are
inherently insecure due to amount of low level C code.

Audio even on Android devices doesn't require any advanced privileges.
It is a basic need for many programs and attraction for many creative
people who may use Python as an auxiliarry language in their works.

>From stdlib I also expected abstract scheduling and buffering
algorithms with explanations and documentation with pictures. I expect
super simple API for all basic cases. Ability to use this API on any
platform.

I'd expect Audio API to be multi-level.

Level 1: Beep - make audio signal to attract attention with the most
basic level OS provides
Level 2: Customize audio signal to attract attention (query signals,
chose, beep)
Level 3: Play pre-rendered waveform (such as WAV file) with the most
basic OS level (default format)
Level 4: Play continuous pre-rendered stream
Level 5: Mix pre-renderered streams and waveforms
Level 6: Synthesize sound in pure Python
Level 7: Synthesize sound indirectly (using GPU, MIDI interfaces,
external libs, ...)
Level 8: Audio device control - formats, channels, volumes -
everything hardware specific
--
anatoly t.


More information about the Python-ideas mailing list