numpy-based multimedia library
For programmers familiar with python or matlab who are interested in toying with the sounds and images around them; for artists, designers, and composers seeking a deeper understanding of the numerical systems that underlie modern media production.
numm is a minimalist media library that translates popular sound, image, and video formats to and from numpy arrays. By coercing inputs into common modes (eg. sample rate, bit depth), combining and mutating these numpy arrays is greatly simplified.
The general strategy for these functions is to make any assumptions necessary such that a single array of numbers provides sufficient information with which to reconstruct a media file, without any additional metadata. For example, width and height are contained in the dimensions of an array, so they may be different image to image, but framerate, samplerate, &c is not inherent to the data, so it should be made uniform unless explicitly specified.
In the transition from an image to an array, the primary considerations are resolution (wxh) and mode (RGB, RGBA, 8bit, 16bit, &c). We choose not to provide any special API for resampling an Image–this can be done with numpy if desired–and always return 8bit RGB buffers.
image2np(path) np2image(np, path)
In the case of audio, we choose to force all input to 44100Hz stereo.
sound2np(path) np2sound(np, path)
Video is an array of wxhx3 arrays 30frames per second. Square pixels are assumed.
video2np(path) np2video(np, path)
Note that in particular in the case of video, these numpy buffers will require a considerable amount of memory; preprocess accordingly (eg in ffmpeg). We should also raise a NotEnoughMemory exception when RAM will not hold our buffer.
The live interface is provided by numpy.run.run(), a function with just a few input-output controls, communicated through function passing.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.