python3 audio signal processing - audio

A project I am working on for one of my classes is to build a simple GUI sound editor for kids using python3 (using python3 is a strict project requirement). I don't want this editor to be as complex as something like audacity but I would like to have some fun built in effects similar to the sound editor on the nintendo ds http://nintendo.wikia.com/wiki/Nintendo_DSi_Sound.
I have been researching modules that are compatible with python3 that will help with the audio signal processing since I am very inexperienced in this area but I am running into trouble finding something that will work with python3. I found this great list of music modules for python: http://wiki.python.org/moin/PythonInMusic but everything that seems to have the functionality I think I want such as pyo and snack, does not have python3 compatibility.
I think at this point my best option is to use NumPy and SciPy for the signal processing but I was wondering if anyone had any better suggestions or advice? Or is using NumPy and SciPy an ideal choice if I can become familiar with them?

NumPy/SciPy can process audio signals, but it doesn't feel "native" as you have to write lots of interface code to play the resulting data as sound or write the in some standard format (like .wav).
I'd suggest porting those modules ; it's often very easy and straightforward and a good Python exercis.

Related

Alternative for vpython for 3D simulations (molecular dynamics)?

In working on a simple program to simulate and visualize crystal vibrations and molecular dynamics.
I'm not a very experienced programmer so I looked for an easy-to-use tool to work with, and I found that vpython (now GlowScript apparently) is simple enough and gives good results. But it lacks some basic functions like panning the scene, which breaks the deal for me.
What other tools are there out there, with reasonable learning curves (not raw opengl), can I use to create 3D simulations? (preferably within the python environment)
Here - An example in vpython similar to what I want to achieve
Have look at
http://vispy.org
Python based module.
Also python module specifically for molecular visualization.
https://pymol.org/2/

What is the easiest way to play a sound sample in Haskell?

I'm toying around with constructing a basic music composition system for fun. I can represent music in memory, but I'd (obviously) like to be able to output actual sounds! I don't really care what the format is (MIDI, mp3, ogg, whatever). I just want to be able to load samples into the program and play them in the simplest way possible. I've searched around for a solution but everything I'm seeing is either a) too complex (overhead-wise) for my needs, b) not actively supported, or c) not well-documented. I would love to see an example of sound output or otherwise, some direction on the simplest way to do so.
You might like Euterpea, which isn't on Hackage but was a breeze to install and has quite verbose documentation (it seems it forms the core of an introductory Haskell course at Yale). Hover over the word "Euterpea" in the menu at the top to find more links/instructions.
I ended up using MIDI and sending events to SimpleSynth, on Mac OSX. This was achieved using the hmidi package and the bindings to OSX's CoreMIDI by bkomuves. I had to install a fork of the hmidi package from here to get it working with the latest GHC. I then installed SimpleSynth and enabled an IAC Driver using the Audio MIDI Setup utility on OSX. I then set SimpleSynth to listen from the IAC Driver I set up and was able to use the enumerateDestinations function from bkomuvres' bindings to CoreMIDI to grab the first available Destination and send MidiEvents from hmidi using send. It works like a charm!
With Haskell, you may wish to get a handle on the language fully by utilising other libraries/applications from your code, however the following link is a link to libraries for music and sound.
http://www.haskell.org/haskellwiki/Applications_and_libraries/Music_and_sound
Another idea is to gain familiarity with OpenAL with C/C++ and then from there you will have some familiarity with the structure of HOpenAL (Haskell binding of OpenAL which indeed calls the OpenAL DLL/SO).
Link with straightforward tutorial for OpenAL ago!
http://enigma-dev.org/forums/index.php?topic=730.0;wap2
I hope this helps...

Scipy - Audio Processing

I looking for good tool for Audio signal processing.
e.g Speech & music analysis, identification.
Is scipy provides function for these?
Is this a good tool for Audio Signal processing?
Can you please suggest a better tool for this?
Thank you.
Scipy provides you with the basic scientific tools, but not anything particular. A lot of the stuff in scipy is inspired by or even copyied from the basic MatLab functionality. As fas as I know there is no speech processing package but instead everything you need to build such thing, i.e. dsp lib, fft, statistics, linear algebra, even a symbol toolbox.

Pyglet: control audio balance (panning)

I am looking for a way to control the balance of a sound (left-right) with Pyglet.
I am aware of the 3D positioning system, but what I really want is just control the panning (something like -1:left <--> 1:right), and the 3D system is quite counter-productive in that context (or maybe I am missing something).
If not with Pyglet, could you suggest any other python library allowing this?
(I've been looking at many, but without success).
It seems like a pretty straightforward task to ask to a sound engine, but I am not able to figure it out...
I found that pygame handles that.
The sound engine in pygame is based on sdl_mixer, which allows the use of channels, of which you can control the left and right volume separetely.
It is not pyglet... But... pygame seems to be included in Cocos2D which is built on pyglet...

Fast, Pixel Precision 2D Drawing API for Graphics App?

I woud like to create a cross-platform drawing program. The one requirement for writing my app is that I have pixel level precision over the canvas. For instance, I want to write my own line drawing algorithm rather than rely on someone elses. I do not want any form of anti-aliasing (again, pixel level control is required.) I would like the users interactions on the screen to be quick and responsive (pending my ability to write fast algorithms.)
Ideally, I would like to write this in Python, or perhaps Java as a second choice. The ability to easily make the final app cross-platform is a must. I will submit to different API's on different OS'es if necessary as long as I can write an abstraction layer around them. Any ideas?
addendum: I need the ability to draw on-screen. Drawing out to a file I've got figured out.
I just this week put together some slides and demo code for doing 2d graphics using OpenGL from python using the library pyglet. Here's a representative post: Pyglet week 2, better vertex throughput (or 3D stuff using the same basic ideas)
It is very fast (relatively speaking, for python) I have managed to get around 1,000 independently positioned and oriented objects moving around the screen, each with about 50 vertices.
It is very portable, all the code I have written in this environment works on windows and Linux and mac (and even obscure environments like Pypy) without me ever having to think about it.
Some of these posts are very old, with broken links between them. You should be able to find all the relevant posts using the 'graphics' tag.
The Pyglet library for Python might suit your needs. It lets you use OpenGL, a cross-platform graphics API. You can disable anti-aliasing and capture regions of the screen to a buffer or a file. In addition, you can use its event handling, resource loading, and image manipulation systems. You can probably also tie it into PIL (Python Image Library), and definitely Cairo, a popular cross-platform vector graphics library.
I mention Pyglet instead of pure PyOpenGL because Pyglet handles a lot of ugly OpenGL stuff transparently with no effort on your part.
A friend and I are currently working on a drawing program using Pyglet. There are a few quirks - for example, OpenGL is always double buffered on OS X, so we have to draw everything twice, once for the current frame and again for the other frame, since they are flipped whenever the display refreshes. You can look at our current progress in this subversion repository. (Splatterboard.py in trunk is the file you'll want to run.) If you're not up on using svn, I would be happy to email you a .zip of the latest source. Feel free to steal code if you look into it.
If language choice is open, a Flash file created with Haxe might have a place. Haxe is free, and a full, dynamic programming language. Then there's the related Neko, a virtual machine (like Java's, Ruby's, Parrot...) to run on Mac, Windows and Linux. Being in some ways a new improved form of Flash, naturally it can draw stuff. http://haxe.org/
QT's Canvas an QPainter are very good for this job if you'd like to use C++. and it is cross platform.
There is a python binding for QT but I've never used it.
As for Java, using SWT, pixel level manipulation of a canvas is somewhat difficult and slow so I would not recommend it. On the other hand Swing's Canvas is pretty good and responsive. I've never used the AWT option but you probably don't want to go there.
I would recommend wxPython
It's beautifully cross platform and you can get per pixel control and if you change your mind about that you can use it with libraries such as pyglet or agg.
You can find some useful examples for just what you are trying to do in the docs and demos download.

Resources