Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Is it possible to use the microphone to measure sound frequency?
-
I am working on a sound visualizer and I'm at a dead end because I have no clue how to get access to the devices microphone. If I can how can I make it move bars and make a canvas or scene?
-
There is currently no way to access the microphone.
-
This only works in the Pythonista beta release https://gist.github.com/omz/9882a00abf59c6009fa4
-
Also, I was not able to get it to record .wav, although admittedly I didn't try too hard. Wav would be needed in order to get data in order to do a frequency response.
-
https://github.com/jsbain/audiovis.git
Early experiments. Found the right settings to record uncompressed pcm waves. Simple ui to draw the wave every 1sec. Played around a tad with fft display, but this was not satisfying, in large part because of the 1second lag. This always crashes the second time it is run... No idea why.
To do: look at more of a scrolling display, with buffered samples. Possibly fun with emitters or physics. Experiment with multiple recorder instances, which should be possible in theory, I think, and might allow for a more fluid experience.
-
I've updated the above repo. by refactoring things to configure multiple simultaneous recorders, if is possible to get reasonably fast updates to drive a visualizer plot. This is now in a reasonably clean class interface too.
I found that the way pythonista clears globals in the beta causes problems when rerunning a script. I need to
release
some ctypes objects before the references get deleted, butmsg
etc get deleted before the instance, so things don't get freed. My solution was to force deletion after the scene ends.I think there is a similar problem with sk scenes/views... If the scene ends without an error, rerunning the script causes pythonista to crash. The solution was to raise an error inside
did_stop
to force whatever resetting is going on. Not sure if this is for all scenes, say that use actions, or if this is specific to the way I'm doing things.Anyway... Microphone to scrolling display now works... Need to experiment with different ways to plot this... Are 8000 sprites faster than an 8000 point path?
-
Unfortunately I'm using an iPad and I was gonna do this as a project so I can show up my teacher because he's an ass who thinks he's an expert. (we have to teach ourselves in class)
-
With the Pythonista Beta, the repo above works on ipad.