Combining the Marsyas python bindings with the matplotlib library for plotting in Python creates a great environment for prototyping. In the past few months I have done a lot of Marsyas work using this approach and really enjoy it. It gives a lot of the expressive power and prototyping of MATLAB while retaining the data-flow model and efficient processing of Marsyas. Unfortunately getting everything installed and setup for the first time takes some effort.
I recently did an installation on a fresh copy of Ubuntu 11.04 - Natty Narwhal - 32 bits and in this blog post I will share the steps I had to take. As usual the exact details change over time so the instructions are slightly different from previous versions of Ubuntu. These instructions can also be found in the Marsyas User Manual as part of the installation instructions for specific systems.
The first step is to get subversion and cmake installed. I did all the package installation directly using apt-get but you can also use the Synaptic package manager for that purpose. Lines that start with $ are to be typed in the terminal. The others are simply comments describing the steps.
$ sudo apt-get install subversion
$ sudo apt-get install cmake
$ sudo apt-get install cmake-curses-gui
$ sudo apt-get install libasound2-dev
Now we are ready to get the latest Marsyas from svn, configure and compile.
$ svn co https://svn.code.sf.net/p/marsyas/code
$ cd marsyas
$ mkdir build
$ cd build
$ ccmake ../src
(Press [c] to continue and [g] to generate the Makefile)
$ make -j 3 (or higher if you have more cores)
When the compilation is finished you can check that the command-line Marsyas tools were compiled.
$ cd bin
$ ./helloWorld
(Press ctrl-c to stop the sine wave from playing)
$ cd ..
If everything worked you will hear a sine wave playing on your speakers.
Now we are ready to get the Python/SWIG bindings going.
$ sudo apt-get install swig
$ sudo apt-get install python-dev
(the python headers)
$ sudo apt-get install python-matplotlib
$ sudo apt-get install ipython
Now we need to reconfigure/compile Marsyas to use Swig to create the python bindings.
$ ccmake ../src
(enable the WITH_SWIG option)
$ make -j 3
$ sudo make install
(install the Marsyas python bindings so that Python can find them)
$ sudo ldconfig /usr/local/lib
(add /usr/local/lib to the path searched for libraries)
If everything has worked you can now combine Marsyas and matplotlib. To check try:
$ cd src/marsyas_python
$ python windowing.py
$ ipython --pylab windowing.py
After running these commands you should be able to see a nice generated figure looking like the image above this paragraph. If you look at the code of windowing.py you will see that the comlputation of the figure data is done through Marsyas. All you need to do is import marsyas at the top of your Python source code. In a future post I will show some utilities that making plotting data from Marsyas networks easy and save you time.
The same instructions also work on Ubuntu 64-bits. The only additional package I needed to install was somewhat to my surprise g++ (gcc is installed). This can be done by:
ReplyDeletesudo apt-get install g++
In order to add the ability to write PNG files you need to turn WITH_PNG ON and install the development version of the freetype library as follows:
ReplyDeletesudo apt-get install libfreetype6-dev
This comment has been removed by the author.
ReplyDeleteUsing ubuntu 11.10, I followed your instructions, everything compiled and worked, but when importing marsyas I get this error:
ReplyDeleteImportError: libzlib.so: cannot open shared object file: No such file or directory
Hi, I used these instructions for installation and I get a a gazillion warnings for "unused parameter", is that normal? Also when I run helloWorld it doesn't sound like an A note, but an ugly distorted sound instead. What can be wrong? Thanks in advance
ReplyDelete