Python: How to make it do pretty things.
See controllerism for interaction design..
Pro-tip: run your python code as a web service
Web services are the new reliable lingua franca, and have a lot of development time.
Python + tornado +“PocessPoolExecutor“ is reasonably performant.
DIY, bareback style. Tedious, but do-able. The best example I know is paulstretch, which creates a lovely phase vocoder from nothing reasonably compactly. For real-time things though, this will get tedious.
The most active python audio. Stuck in python 2, though.
“is a Python module written in C to help DSP script creation. Pyo contains classes for a wide variety of audio signal processing. With pyo, the user will be able to include signal processing chains directly in Python scripts or projects, and to manipulate them in real time through the interpreter. Tools in the pyo module offer primitives, like mathematical operations on audio signals, basic signal processing (filters, delays, synthesis generators, etc.), but also complex algorithms to create sound granulation and other creative audio manipulations. pyo supports the OSC protocol (Open Sound Control) to ease communications between softwares, and the MIDI protocol for generating sound events and controlling process parameters. pyo allows the creation of sophisticated signal processing chains with all the benefits of a mature, and widely used, general programming language.”:
>>> s = Server().boot() >>> s.start() >>> wav = SquareTable() >>> env = CosTable([(0,0), (100,1), (500,.3), (8191,0)]) >>> met = Metro(.125, 12).play() >>> amp = TrigEnv(met, table=env, dur=1, mul=.1) >>> pit = TrigXnoiseMidi(met, dist='loopseg', x1=20, scale=1, mrange=(48,84)) >>> out = Osc(table=wav, freq=pit, mul=amp).out() * see also cecilia_, a gui for pyo.
Looks great, but has been abandoned by its creator.
Prioritizing code expressiveness, clarity and simplicity, without precluding the lazy evaluation, and aiming to be used together with Numpy, Scipy and Matplotlib as well as default Python structures like lists and generators, AudioLazy is a package written in pure Python proposing digital audio signal processing (DSP), featuring:
- A Stream class for finite and endless signals representation with elementwise operators (auto-broadcast with non-iterables) in a common Python iterable container accepting heterogeneous data;
- Strongly sample-based representation (Stream class) with easy conversion to block representation using the Stream.blocks(size, hop) method;
- Sample-based interactive processing with ControlStream;
- Streamix mixer for iterables given their starting time deltas;
- Multi-thread audio I/O integration with PyAudio;
- Linear filtering with Z-transform filters directly as equations (e.g. filt = 1 / (1 - .3 * z ** -1)), including linear time variant filters (i.e., the a in a * z ** k can be a Stream instance), cascade filters (behaves as a list of filters), resonators, etc.. Each LinearFilter instance is compiled just in time when called;
- Zeros and poles plots and frequency response plotting integration with MatPlotLib;
- Linear Predictive Coding (LPC) directly to ZFilter instances, from which you can find PARCOR coeffs and LSFs;
- Both sample-based (e.g., zero-cross rate, envelope, moving average, clipping, unwrapping) and block-based (e.g., window functions, DFT, autocorrelation, lag matrix) analysis and processing tools;
- A simple synthesizer (Table lookup, Karplus-Strong) with processing tools (Linear ADSR envelope, fade in/out, fixed duration line stream) and basic wave data generation (sinusoid, white noise, impulse);
- Biological auditory periphery modeling (ERB and gammatone filter models);
- Multiple implementation organization as StrategyDict instances: callable dictionaries that allows the same name to have several different implementations (e.g. erb, gammatone, lowpass, resonator, lpc, window);
- Converters among MIDI pitch numbers, strings like “F#4” and frequencies;
I can’t tell the difference between pydub and amen, both of which seem to be designed to mainly edit audio files with precise slicing and crossfades, but not to do much like effects or synthesis. Handy for algorithmic remix.
Surprisingly, GNURadio supports extensive DSP for python using an high-performance compiled dataflow graph, kind of like a realtime Tensorflow.
python’s audio analysis toolkit is much more impressive than its synthesis - see machine listening.
colormotor_sandbox, live-reloading CV+video framework:
Colormotor is a creative coding framework with a “scientific twist”. The framework builds on top of Armadillo for linear algebra operations, OpenCV for image manipulation and OpenGL for hardware accellerated rendering.
Armadillo is definitely not the fastest or most lightweight solution for a graphics-oriented framework. On the other hand, the library provides many utilities that make it easy to switch between C++, Python and Matlab, and vectorised operations result in much more concise code.
Colormotor includes Python bindings that can be used independently as a module, or within the Colormotor Sandbox live coding environment.
field (github) “is an open-source software project initiated by OpenEndedGroup, for the creation of their digital artworks. It is an environment for writing code to rapidly and experimentally assemble and explore algorithmic systems. It is visual, it is hybrid, it is code-based. We think that it has something to offer a diverse range of programmers and artists”:
slider1= sheetSlider("slider1") xySlider2 = sheetXY("xySlider2") aGraph = sheetGraph("aGraph") print slider1.get() print xySlider2.get() print aGraph.get().get(0.2) slider1.set(0.5) xySlider2.set( (0.2, 0.6)) GUI toolkit looks good (Java-based). OpenGL and other drawing functionality seem advanced. Audio does not seem to be a priority.
- A sprout off the gone-to-seed[#]_ NodeBox is PlotDevice, which is a designerly python app for making printable graphics. It is cousin to the more famous Processing language, which is itself seedy.
- the graphing can be OK too - graphing in python.
|||Nothing wrong with going to seed; It’s perfectly lovely software, just a bit overgrown, and it has lost that fresh tang.|