what did i learn today
Technology generative art processing ubuntu
converting a processing sketch with audio and visuals to a video on ubuntu

I really like generative art, so I have been playing with processing for a while. Processing is an open source language (on top of java), that gives the possibilty to create images, animations, with added interactivity. First I created a simulation of raindrops, and because I wanted it to be easily configurable I used processing.js: processing implemented on top of javascript. So that becomes native processing in the browser. Allowing to interact with HTML and javascript objects easily. Publishing the sketch is just: give people the link.

Next-up I wanted to create a music visualisation. Interact with the music. I had the perfect piece of music in my head: "Endless Season" by Ken Ishii. Now processing.js does not interact with music. There is HTML5 audio, but it still is very experimental, and I did not find any API for processing music, reacting to and analysing music played. Processing (the java version) has an excellent library for this: Minim (actually more than one, but I ended up using that one). When the sketch was finished, I wanted to share it, convert it to a video. What were the options.

Use Processing itself

There are two ways to convert a processing sketch to a movie, from within processing itself:

  • use MovieMaker: this requires quicktime and unfortunately does not work on Ubuntu
  • when each frame is drawn, do saveFrame and then convert all frames to a movie afterwards. While in theory this should work, saving the images slowed down my sketch, and ultimately screwed up the sync with the audio. My frame-rate was not consistent enough. For straightforward stuff this does not matter, but I needed it to sync with the audio.
  • There is a third option: GSVideo, but frankly, that seemed to damn hard for me, so I skipped that. So I needed an alternative approach. If it runs correctly on my screen, couldn't I just record it on my screen?

Use some sort of screenrecording/screencast software

To record my desktop, on ubuntu, including the sound from processing proved to have some issues:

  • processing (i.e. java/JDK 6) does not use ALSA to create the sound, but address the hardware devices directly
  • I do not want to record my entire desktop, but a specific part, of a specific size
  • I want to share my video on vimeo, so it has to follow certain guidelines The first proved to be the hardest.

Recording the system audio out together with the video

On ubuntu, I found one approach to work very well for me:

  • use gtk-recordmydesktop
  • use PulseAudio mixer, it will allow to take the sound output as input to record
  • and record away! :) But, unfortunately, since java does not ALSA but uses the hardware devices directly, PulseAudio was unable to capture the sounds. However, by accident I found out that if you export your processing sketch to an applet, and run the applet in the browser, it does use ALSA and can be recorded perfectly. Awesome. Part one solved.

Recording a specific part of the screen

gtk-recordmydesktop allows to specify an area of the screen to record, but somewhat akwardly.

Now, for exporting to vimeo, it had to follow certain fixed, optimal sizes. E.g. 640×480 for 4:3 SD video, 640×360 for 16:9 SD video, and 1280×720 or 1920×1080 for HD. And that is hard to do if you are trying to position the recording box manually.

But, as I found out here, when using recordmydesktop from the commandline, you can send those options along:

  recordmydesktop -x=0 -y=0 --width=320 --height=240 

So, if you open the Advanced->Misc, and look for the Extra options field, there you can fill in the same options, and when you press record gtk-recordmydesktop will show the bounding box that is recorded.

Preparing your video for uploading to vimeo

To upload your video to vimeo, you have make sure two things are correct:

  • the screensize, which we discussed before
  • the video format

gtk-recordmydesktop creates an Ogg Theora file, and unfortunately vimeo does not accept that format yet. Converting that to MP4 was hell, until I found Arista Transcoder. Using Arista to create an MP4 is easy (but you have to know it):

  • open Arista Transcode
  • create a new conversion
  • select your file, by default called out.ogv, as the source
  • select Sony Playstation - PSP as the device
  • press create!

This will create a file called out.mp4 which is just perfect for vimeo, including the sound.

The result

Twotoned from meanderend on Vimeo.

More ...
News 11.04 nvidia unity ubuntu
upgrading to Ubunty 11.04: nvidia troubles

When upgrading my development machine to Ubunty 11.04, Natty Narwal, I also had a problem with nvidia drivers, and I want to list all possible solutions to fix that. First the symptoms: my Ubuntu would boot up, but the screen would just turn black. When booting in failsafeX it would work, but not with Unity (I would get white areas instead of window-content), because it needs the 3D acceleration? But when trying to enable the nvidia card in any way, and rebooting normally, I would end up with black screens. So what did i attempt to fix all that:

  • I removes the previously installed drivers and installed them again: this will make sure the drivers are rebuilt against the current kernel. This could already help.
  • Booting through failsafeX and activating the current driver; also using the previous driver (173): did not help me either
  • i added UNITY_FORCE_START=1 to /etc/environment as mentioned here (as GeForce 7300/7400 are blacklisted, but i have a GeForce Go 7100) But it all kept failing. So, last resort (I should have thought of it earlier), I investigated the X-logfiles. Inside my /var/log/Xorg.0.log I found that nvidia had problems allocating the memory: [bash] [14.055] (EE) NVIDIA(0): Failed to allocate primary buffer: out of memory. [14.055] (EE) NVIDIA(0): *** Aborting *** [/bash] Apparently this is a known bug, and i had to do the following to fix this:
  • edit /etc/default/grub
  • find the option GRUB_CMDLINE_LINUX and add nopat, so for me this looked like [bash] GRUB_CMDLINE_LINUX="nopat" [/bash]
  • run sudo update-grub And then, finally, everything worked fine for me :) Hope this helps.
More ...
Uncategorized pgadmin postgresql ubuntu
fixing pgadmin3

When i try to run pgadmin3 on my ubuntu 10.04 box i now get the following error: [bash] $ pgadmin3 pgadmin3: relocation error: pgadmin3: symbol _ZN21wxMemoryFSHandlerBase19AddFileWithMimeTypeERK8wxStringPKvjS2_, version WXU_2.8 not defined in file with link time reference [/bash] I assume it has something to do with one of the latest updates. I run all the updates always when they are proposed, but i am not really sure this always is a good idea. When googling the error i found a lot of links, and ultimately, also the fix: [bash] apt-get source pgadmin3 sudo apt-get install debhelper libpq-dev libwxgtk2.8-dev libxml2-dev libxslt1-dev autotools-dev devscripts cd pgadmin3-1.10.2 dpkg-buildpackage sudo dpkg -i ../pgadmin3_1.10.2-1_i386.deb [/bash]

More ...
Uncategorized ruby rvm ubuntu
installing ubuntu for ruby development

I have made the complete switch. My home development machine is no longer Windows XP, no longer dual booting Ubuntu but a full-fledged Ubuntu. After installing the dual-boot, and my machine at work this is the third time to install an ubuntu machine, and getting everything ready for ruby development. I just want to archive my steps here, so a next time could be even faster :) Installing Ubuntu 10.04 itself is a piece of cake. My first step after the installation is to enable numlock on login screen (i always use numbers in my passwords) [bash] sudo apt-get install numlockx [/bash] Then run sudo gedit /etc/gdm/Init/Default and find the line [bash] exit 0 [/bash] and add the following code above that line [bash] if [-x /usr/bin/numlockx]; then /usr/bin/numlockx on fi [/bash] Secondly I install rvm for multiple rubies. We first need to install any ruby for that. Take the default ubuntu version (1.8). [bash] sudo apt-get install ruby rubygems [/bash] This does not install the latest version, but we don't need that yet. Rvm will solve this for us. Install rvm itself: [bash] sudo apt-get install curl bison build-essential zlib1g-dev libssl-dev libreadline5-dev libxml2-dev git-core bash < <( curl ) [/bash] Then make sure rvm will work always [bash] sudo gedit .bashrc [/bash] and replace [-z $SP1] && return with [bash] if [[! -z $SP1]]; then .. original content that was below the && return line [[-s $HOME/.rvm/scripts/rvm]] && source $HOME/.rvm/scripts/rvm fi #EOF [/bash] Then rvm should be available. Install the needed rubies. We use ree at work, i like to work with 1.9.1/2 and i want to check out rubinius. So install your rubies through rvm [bash] rvm install ree rvm install 1.9.2 rvm install rbx [/bash] Installing ruby 1.9.1 was a bit harder, when i just tried to run the standard rvm install 1.9.1, i received the following error: [bash] .rvm/src/ruby-1.9.1-p429/lib/optparse.rb:1310: [BUG] Segmentation fault [/bash] and that was caused because i use a newer gcc version, which can't handle the -O3 optimisation. It took me a while to find how you can fix it, but in the end (as always) it was easy. Just type [bash] export optflags="-O0"; rvm install 1.9.1 [/bash] To end, set your default ruby version [bash] rvm ree --default [/bash] now all your new sessions you should be using your selected default version. After installing your favourite editor (Netbeans or rubymine), your favourite database (postgreSQL, sqlite, mysql ), and your list of gems you are ready to roll some ruby! I must say as an previously avid Windows user for ages, i am very impressed by Ubuntu. This is a free operating system, and while i was aware that everything just works better being linux (meaning processes and filesystem); but not only that: it even looks better and is very user-friendly. It is way more customisable looks-wise then silly windows. In Windows 7 for instance you have to use this very large font, and in Ubuntu i can set the size to anything i want (small!!!). Awesome :) And i guess it will amaze me for the next few days and weeks whilst finding out other new stuff. [UPDATE] For me it is confusing that the minimize, maximize and close buttons are on the left-side, i think it is done to be more apple-like. But the fix to move the buttons to the right is luckily very easy once you know it :)

More ...
Uncategorized dual boot wubi ubuntu
easiest dual boot ubuntu install

I wanted to convert my XP laptop to a dual boot with Ubuntu or Kubuntu. Whichever. I want to try out linux and maybe switch altogether. Run windows inside a Virtualbox if i would really need it (e.g. for work). So i looked up different tutorials, while i was cleaning up disk-space and suddenly bumped into Wubi. I assumed i had to play with partitions and bootsectors, but the Wubi-installer manages all that for you. Just download the program (1.4MB!), run it, fill in a user and password and it takes all the work out of your hands. Completely automatic. Ideal for me ;)

More ...