Thursday, August 12, 2010

Building Tartini on Debian

Tartini is a cool real-time "music analysis" program (http://miracle.otago.ac.nz/tartini/index.html).  The issue is that the sources don't immediately compile on my Debian system.

UPDATE: I've actually gone through and fixed all the issues and created a Debian package for it.  You can download the source at https://github.com/jeremysalwen/tartini-debian  Hopefully it will be in debian too soon.

Obviously, as the instructions say, qt 4, fftw 3, and qwt 5 must be installed for it to compile.  Installing the packages fftw3-dev and libqt4-dev is straightforward.  Make sure that if qt3 is installed, all of the build tools point to the qt4 versions. However, be careful with qwt, as the debian repositories contain a package "qwt-dev" which is not version five.  Instead, install libqwt5-qt4-dev.


As the build instructions state, you then have to modify pitch.pro to tell it where the includes and libraries are.  On a typical debian system, the important part of the file should look like:

unix{
  macx{ #MacOSX
    MY_LIB_PATH += -L/Users/student/usr/local/lib
    MY_INCLUDE_PATH += /Users/student/usr/local/include
  }else{ #Linux
    MY_LIB_PATH += -L/usr/lib
    MY_INCLUDE_PATH += /usr/include/qt4 /usr/include/qwt-qt4 /usr/include
  }
}

Then, qmake will still give you the error

RCC: Error in 'pitch.qrc': Cannot find file 'pics/tartinilogo.png'

For some reason it's looking for a png when the file is really a jpg.  Just modify pitch.qrc to replace tartinilogo.png with tartinilogo.jpg

qmake will then work, but make will still complain about

error: invalid conversion from ‘const char*’ to ‘char*’

a bunch of times.   mystring.cpp and mystring.h are the offending files.  Basically there is a bunch of code that seems to be just *wrong* in how it handles constness.  If you make the local variable "char * ext;" into "const char * ext;" in two functions, and make getFileExtension return type "const char*" instead of "char*", it will work.  (don't forget to change the function in both the cpp and the header file.

Meanwhile, prony.cpp gives a cryptic warning about the included file "cstdio", which seems to be caused by the line:
#define _GLIBCXX_USE_C99

I am not really sure if this affects the functionality of the code, but when I comment it out, it compiles and runs fine.  Apparently there is strange functionality surrounding this symbol anyway: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=443234

You will also get a linking error because it tries to link with -lqwt, when the qwt5 package only provides qwt-qt4.  Again, under the linux section of pitch.pro, replace the line

LIBS += $$MY_LIB_PATH -lfftw3f -lqwt -lasound

with

LIBS += $$MY_LIB_PATH -lfftw3f -lqwt-qt4 -lasound

Still, when you build it, it segfaults when you try to run fixing up calculateAnalysisData in mytransforms.cpp, we replace

if(chunk > 0 ) {
with

if(chunk > 0 && prevAnalysisData->highestCorrelationIndex!=-1) {

To stop the segmentation fault if the previous highest correlation index is -1 (not found).

And that should be enough to get a working Tartini build on Debian.  I would post a diff or a zip of all the corrections, but I can't attach it here.

10 comments:

  1. Thanks for posting this Jeremy - I've been struggling with this and was just revisiting it after giving up a couple of weeks back (I'd been having a lot of qt3/qt4 issues). This should help me get over the starting line.

    ReplyDelete
  2. thanks. I managed to install it on ubuntu but I did not find the reason why it seg-faults.

    ReplyDelete
  3. Am wanting to get this to work on Ubuntu 12.04.1 LTS 32 bit. I'm a bit new, but I understand some stuff. I have all the downloads, but what do I need to do with them and it what order? Maybe I already have some of the packages, how would I check that? Can we communicate away from the blog site?

    ReplyDelete
  4. Hi,

    I am trying to build your DEB packet. Unfortunately this does not work.
    I get an error when I do "debuild": "RCC: Error in 'pitch.qrc': Cannot find file 'pics/tartinilogo.png'".
    Could you provide the completed Debian packet for download?

    ReplyDelete
  5. Thanks a lot - I git-cloned your code and it compiled straight away on my Ubuntu 12.04. It even started to paint its windows when I started it up. However, it then started throwing X Error: GLXBadContextTag 173 and other errors, eventually crashing with a SEGV. Googling suggests that this may be due to some sort of OpenGL compatibility issue that the glxinfo command may help debug, but that command throws an error as well. Stuck now, I know nothing about programming OpenGL. Still: thank you for making it compile.

    ReplyDelete
    Replies
    1. PS this turned out to be a general problem with OpenGL that I fixed owing to StacExchange (http://askubuntu.com/questions/263550/opengl-with-intel-82865g-integrated-graphics).

      However, there are several more problems - for instance, I don't know how to make Tartini play sound (recording works). Is anyone actively working on Tartini?

      Delete
    2. I put together all my changes into a tarball a while ago, and the author agreed to release it as the next version of tartini, but it never ended up happening. In any case you can download it at http://columbia.edu/~jas2312/tartini-1.3.tar.gz. If you have specific problems or bugs, please report them on github rather than here, I check it much more frequently

      Delete
  6. Hello Jeremy,

    thanks for your work, you made it possible for me to compile and run this program on Wheezy, creating the package from your git repository.

    I have one question though, are the Chromatic tuner and Vibrato view windows supposed to jump around the way they do in my system? I recorded this to show you:

    https://www.youtube.com/watch?v=XpgIk6KZSXU

    Thanks

    ReplyDelete
    Replies
    1. Your video is private. It shouldn't look smooth, but it still should have a high frame rate.

      Delete
  7. Hello,

    how to address this error! on Ubuntu14.04 platform.

    In file included from widgets/freq/freqwidgetGL.cpp:38:0:
    general/mygl.h: In function ‘void mygl_resize2d(int, int)’:
    general/mygl.h:45:24: error: ‘gluOrtho2D’ was not declared in this scope
    gluOrtho2D(0, w, h, 0);
    ^
    make: *** [.obj/freqwidgetGL.o] Error 1

    ReplyDelete