Where are the Python 3 Libraries for Media Computation
My Blog@CACM post for this month is on JES, the Jython Environment for Students, which at 14 years old and over 10,000 downloads, is probably one of the oldest, most used, and (by some definition) most successful pedagogical Python IDE’s.
The SIGCSE Members list recently had a discussion about moving from Python 2 to Python 3. Here’s a description of differences. Some writers asked about MediaComp. With respect to the Media Computation libraries, one wrote:
I’m sad about this one, because we use and like this textbook, but I think it’s time to move to Python 3. Is there a compatible library providing the API used in the text?
Short answer: No. There are no compatible Media Computation libraries for CPython 2 or 3.
We keep trying. The latest attempt to build Media Computation libraries in CPython is here: https://github.com/sportsracer48/mediapy. It doesn’t work on all platforms yet, e.g., I can’t get it to load on MacOS.
We have yet to find a set of libraries in Python that work cross-platform identically for sample-level manipulations of sounds. For example, PyGame’s mixer object doesn’t work exactly the same on all platforms (e.g., sampling rates aren’t handled the same on all platforms, so the same code plays different speed output on different platforms). I can do pixel-level manipulations using PIL. We have not yet tried to find libraries from frame manipulations of video (as individual images). I have just downloaded the relevant libraries for Python 3 and plan to explore in the future, but since we can’t make it work yet in Python 2 (which has more mature libraries), I doubt it will work in Python 3.
I complained about this problem in my blog in 2011 (see post here). The situation is better in other languages, but not yet in Python.
- I have been building Media Computation examples in GP, a blocks-based language (see post here).
- Jeff Gray’s group at U. Alabama has built Blockly-like languages Pixly and Tunely for pixel and sample level manipulations.
- Cynthia Lee at Stanford has been doing Media Computation in her classes in MATLAB and in C++
- The Calico project supports Media Computation in IronPython (based on Python 3) and many other languages, because it builds on .NET/MONO which has good multimedia support.
When we did the 4th edition of our Python Media Computation textbook, I looked into what we’d have to change in the book to move to Python 3. There really wasn’t much. We would have to introduce