-
Controlling Samples by Spitting Them
(0)Last night, Nate and I were able to sucessfully and intuitively control up to 3 or 4 individual drums based on different sounds vocalized into a mic. The bass drum would play when 'oooh' was sung, a snare when 'eee' was sung and a cymbal when 'aaah' was sung. There are still some kinks in the system, but as a proof of concept, it works fairly well. The mapping between input sound and MIDI event are learned in real time so you are not restricted to different vowel sounds. The 3 distinguishing sounds could have just as easily been a clap, growl and whistle. The code: fftknn.
fft, fftknn, hci, jack, knn, learning, midi, music, pyjack, recognition, sound -
List of bound variables in Python (excluding variables from modules)
(1)Posted on October 28th, 2008CodeI've heard multiple people ask for a way to see a list of locally bound variables in python. It would be especially useful for use in the interactive prompt. They like the interface that matlab gave them and this is one of the features they miss the most. I'm not sure what the best way to accomplish this is, but I've coded together one solution. Here is an example use case:
from boundvars import boundvars def test() : a = 1 b = 2 print 'test1:', boundvars(vars()) import urllib print 'test2:', boundvars(vars()) x = 1 y = 2 boundvars(vars()) = {'y': 2, 'x': 1, 'test': } from urllib import * boundvars(vars()) = {'test': , 'x': 1, 'y': 2} test() printed: "test1: {'a': 1, 'b': 2}" printed: "test1: {'a': 1, 'b': 2}"
As you can see, boundvars is called with vars() as a parameter which then returns a dictionary of locally bound variables. If boundvars.ignore_external_functions is set to False, the first two calls which show x and y bound would also show the variable boundvars. If it is set to True, then all values which are functions not defined in the __main__ module are excluded from the output dictionary. The latest code can be downloaded below. Installation is as simple as:
$ wget http://dwiel.net/wp-content/uploads/2008/10/boundvars.tar.gz
$ tar -xvf boundvars.tar.gz
$ cd boundvars
$ sudo python setup.py install
Its not big enough to warrant a project at a code hosting service so its just provided here. If you know of any way that this module could be improved (or avoided by some cool function I don't know about) please, let me know!
boundvars.tar.gz (version 0.1)
Code, library, module, python
