Maybe I’m being selfish in thinking this since I’m interested in audio-related things, but I think it’d be a good idea to have a module in python for reading/writing several audio formats. Partly, I don’t want to deal with ffmpeg or libsndfile too, as good as they are. A natural extension of this idea would probably include images and videos.
I’m aware PEP 594 got some audio related modules removed, I’m not arguing about bringing all of those back individually. Maybe AIFF could fall under the new module.
I’m also aware tkinter covers some things in image/video, but am unfamiliar with it so I’ll leave discussion to anyone else on that matter.
Maybe Python’s JIT (which I know has a PEP open waiting to be resolved to resume progress on its development) is a factor on how much can be implemented in such a module without relying on any external libraries. Would be interesting if no C/C++ libraries would be used, but I understand that’s not my decision.
A longer-term want is to have some audio backend abstractions as well, but that would probably be much harder to implement compared to audio/image/video format specs that don’t frequently change or haven’t changed in years. Personally, I’d like if it wouldn’t have to rely on a C/C++ library like portaudio/miniaudio, but again not my decision.
What audio formats do I want covered in such a new module? Distinguishing some terms:
- Containers/formats: WAV (RIFF), AIFF/AIFC, FLAC (native), CAF, Ogg (Vorbis, Opus, FLAC), MP3 (MPEG-1 Audio Layer III frames), standard MIDI file (SMF).
- Codecs: PCM (uncompressed), FLAC, Vorbis, Opus, ALAC, MP3, Microsoft IMA ADPCM.
- Maybe cover some ambisonics metadata too? Though I can’t explain since I don’t know it well.
Maybe cover MIDI 1.0/SMF, though that’s not an audio file format. midi could be its own module?
What do I want to be able to do with the audio formats? As the first paragraph mentioned, read, write and also seek, at least. Distinguish between frames and the time in seconds. (And if audio backend abstraction was implemented, play audio by writing less than 5 lines of code.)
Sorry if this seems all over the place or not detailed enough (audio or otherwise), I am not too familiar with the software side of audio/music despite making this idea post. I instead see value in initiating the discussion on having a dedicated audio/multimedia module for dealing with (at least audio) formats that are used day-to-day, and hope something good comes out of it. Obviously the scope looks big so I assume a PEP would have to be made if such an audio/multimedia module needs to come to existence.
Also despite being the one to start the post, I don’t think I can bring enough to the discussion, so I hope other people can take over the discussion and come up with clearer ideas/explanations for/against this. If it makes sense for fewer codecs and formats to be covered in a stdlib module, so be it. Better one post to see discussion on this than none. (I didn’t find any similar post in idea before making this)
Edit: If this reads too much like an “it’d be nice”, I’d like to mention having these read/write capabilities can help with file format conversion, maybe changing sampling rates too, make slight volume adjustments to a file’s contents, maybe other things that one can do in a DAW (but probably not everything one can do in a DAW? That’d be too much.)