RPi osc video player

24 avril 2013

i’ve just started an OSC video player on the RPi
for now, it’s just an embryo, it plays a demo video file defined in the code,
it’s a proof of concept : it can work but it needs some work
for now the only available feature is the 4 corners perspective correction (intended to be used with a video projector)

and i made a small pd patch to control the player

when i’ll have opportunity, i will add thoses features :
- OSC message to choose video file
- OSC transport control (play, pause, speed, loop…)
- OSC message to choose shader file and control its parameters
- command line arguments to choose video file, OSC port, and parameters

it’s based on the hello_video_cube example from Raspbian, so it uses the hardware decoding capabilities of the Pi

of course, it’s open source, feel free to test it : https://github.com/avilleret/rpi_osc_video_player

video player on Raspberry Pi

30 janvier 2013

RPi sunning OpenELEC plugged in an old Sony Trinitron monitor
RPi running OpenELEC plugged in an old SONY Trinitron monitor

I made few tests with chnry on how to play movies with Raspberry Pi

we did the tests with a fresh Raspbian install and up-to-date
Raspbian comes with an integrated player dedicated to RPi : omxplayer
This uses hardware video decoding so it can play full HD h264 encoded film without lag.
The same is not possible with VLC (which only uses CPU decoding) we can’t find any codec which VLC can play smoothly but maybe it’s possible with a non CPU-expensive and small bandwidth codec.

Also we can heard some clicks on the analog output of the RPi when openning and closing omxplayer.
We guess this is due to the powering of the hardware but I think it could be handle on the software side.
For example, when Pd is sending some sound, and if we start playing a film with omxplayer we do hear clicks unless the sound card is powered.
Omxplayer seems to reset the sound card without regarding its state, so i think this is a bug.

So VLC is out on RPi, let’s try to control omxplayer over a network.
The simple way we find is using the udpreceive utility (which comes with puredata) and forwarding its output to bash.
On the RPi :
pdreceive 3434 udp | bash
and on the client :
echo omxplayer video.mp4 \& | pdsend 3434 192.168.11.11 udp

3434 is the port number
192.168.11.11 is the RPi’s IP
video.mp4 is the video we want to play (located in the RPi’s home)
\& go back to prompt just after starting omxplayer thus we can send other commands like killall omxplayer.bin to stop the player.

When no video is playing you will see either the command line or the LXDE interface.
With LXDE, you can set a black desktop, hide the menu bar and make the mouse disappear (with unclutter tool).

Next I will test how longer severals RPi can stay in sync and also I’ll take a look at XBMC with OpenELEC.

pix_freenect on Ubuntu 12.04

9 janvier 2013

pix_freenect is one of the pd/Gem objects by Matthias Kronlachner to use Kinect sensor.
It’s not so simple to make it run on Ubuntu 12.04 64bit.
Here is a sum up of what I should do to make it work.
get the last libfreenect from git and make it (as the libfreenect package seems to not work with Matthias external) :
git clone https://github.com/OpenKinect/libfreenect.git
cd libfreenect
mkdir build
cd build
cmake ..
make
sudo make install

On my 64bit system, cmake puts the libs strangly in /usr/local/lib64 instead of /usr/local/lib. I moved all the files to /usr/local/lib, you can also make symbolic links.

I have to blacklist gspca modules to use the Kinect with freenect. I had a file named blacklist-gspca-kinect.conf in /etc/modprobe.d with that :
blacklist gspca_kinect
To prevent gspca module from loading on next reboot and to remove the module without rebooting :
sudo modprobe -r gspca_kinect

Now, get the latest pix_freenect code and make it :
git clone git://github.com/kronihias/pix_freenect.git
cd pix_freenect
mv Makefile Makefile_osx
mv Makefile_linux Makefile
make PD_DIR=/path/to/pd GEM_DIR=/path/to/Gem

You can also edit the Makefile and set the variables there. For me, the build failed because of unrecognized gcc arg : –export_dynamic. I edited the Linux LDLAGS variable on line 23 and replace by :
LDFLAGS = -shared -rdynamic
Make again and it should be ok. For now, pix_freenect can’t initialize when no Kinect is connected or if a wrong ID is set with arguments.

Ubuntu on Macmini6,1

10 décembre 2012

I need to install Ubuntu on a Macmini 6,1 machine (late 2012) and as it was not without pain, I think it’s good to share my experience…
The first steps to create a partition and a boot system for Ubuntu were quite easy.
Here is a quick sumup :

  • boot on Mac OS
  • download rEFIt http://http://refit.sourceforge.net/ and install it (you have to manually install it because non-verified package installer could not start)
  • resize the Mac OS X partition with the Disk Utility
  • boot on a Ubuntu 12.10+mac 64 bit DVD (thanks to rEFIt) and install it on the new partition

At this step, the system is not working fine. There is no video acceleration, display is not recognized, no network driver…

The first thing I fixed is the network, so I can do update more easily.
I used my Samsung Galaxy SII to share a WIFI through USB and get the Macmini connected.
To make wireless working I followed the procedure explained here : https://help.ubuntu.com/community/Macmini5-1/Precise#Wireless_.28AirPort.29.
And to fix ethernet, I followed this : http://ubuntuforums.org/showthread.php?t=2078320 and made change like in post #5 then reboot.

To fix video I ran :
sudo add-apt-repository ppa:glasen/intel-driver
sudo apt-get update
sudo apt-get install xserver-xorg-video-intel intel-microcode mesa-utils

The intel-microcode may be useless.
The Intel HD4000 is now working but my full HD display attached to thunderbold with a miniDP to VGA adaptor is still in 1024×768.

To fix the last point I followed this : http://shanereustle.com/blog/force-screen-resolutions-on-ubuntu.html. This method is more convienent than manually modifying xorg.conf but this is not persistent so i made a small script that run thoses 2 commands on startup.

Pianophone

25 novembre 2012

Hi,

Last week-end was rainy so I took the time to turn an old phone into a digital instrument.
The old phone has a piano shape and 17 keys, black and white. One octave and a third.

Pianophone

The original phone keyboard has two functionalities : dialing phone number and playing cheap synth.
The synth isn’t working anymore and I don’t care about the phone function.
Only 11 keys are used for dialing but fortunately, all the keys are connected to a keypad array easily available on the PCB.
This is a 4×4 array plus 2 discrete switch circuits.

Keypad and Rpi

I sold an old flat cable found into a computer of the last century (less powerful than a Rpi :-) ) and plug it in directly on the GPIO header on the Raspberry Pi.

Thanks to the libbcm2835 and the liblo I wrote a small program that scans the keyboard and sends OSC data on a multicast group.
I receive those data in puredata. Multicast is useful to develop synth : the same patch runs on my notebook and on the Rpi without any change in the configuration.
I used the Miller’s Raspbian image (http://pd-la.info/pdpi/) and the simplepolysynth.pd patch.
I will add an LCD screen and some push buttons to choose the patch to load.

All sources files are available here : https://github.com/avilleret/pianophone

Cheapest way to get analog input on Raspberry Pi

11 octobre 2012

With Cyrille, we added 8 analog input to our synth on RPi for only 13€ thanks to the Byron !
More info here : http://www.1010.co.uk/org/byron.html

Here is how to get started with Byron on RPi.
Prepare the system :
sudo apt-get install libusb-dev avrdude avr-libc

Change the permissions settings to allow access to byron to normal user :
sudo leafpad /etc/udev/rules.d/41-byron.rules
add this :
ATTRS{idVendor}=="16c0",ATTRS{idProduct}=="27d8",MODE="6666",GROUP="pi"
save
unplug / replug the byron

Download byron (the address in the first line might be tuned if a newer version is available, see the link above) :
wget http://1010.co.uk/byron005.tar.gz
uncompress the file, change to the directory and make :
tar -xzf byron005.tar.gz
cd byron/bootloader/byronjump
make clean
make
cd ../../programmer/firmware
make clean
make main.hex
cd ../../bootloader
./byron.sh

choose byron mode

cd ../puredata
rm byron.pd_linux
leafpad byron.c

change in line 129 10 to 19
change in line 11 40 to 20 (to speed things up)
make
pd byron.help.pd

That’s all !
Have fun !

Analog synth emulation with puredata on Raspberry Pi

16 septembre 2012

Here is a step by step on how to make a analog synth emulation with an RPi :-) :

1. installing raspbian on a SD card

see instruction :
http://www.raspbian.org/
http://elinux.org/RPi_Easy_SD_Card_Setup

connect a keyboard, a mouse, an HDMI screen and an ethernet cable with DHCP (to get internet access) and boot on the SD card to configure the OS :
- expand root
- change keyboard
- change password
- change local (fr utf8)
- change memory split : minimum allocated to video
- enable ssh
- boot : no desktop
- update

sudo apt-get update
sudo apt-get upgrade
sudo reboot

install rpi-update and update the firmware (needed to improve sound quality !!)
(instruction here : http://www.framboise314.fr/maintenir-la-framboise314-a-jour-rpi-update-pour-raspberry-pi/)

sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
sudo rpi-update
sudo reboot

log in and start graphical interface :
startx

2. installing puredata

sudo apt-get install git tk8.5-dev libasound2-dev subversion autoconf libtool gettext

downloading latest pd :

git clone git://pure-data.git.sourceforge.net/gitroot/pure-data/pure-data pure-data
cd pure-data/src
./autogen.sh
./configure CFLAGS="-mfpu=vfp -mfloat-abi=hard"
make
sudo make install

It takes around 20min to build, be patient.
you can start pd using the « pd » command

3. optimising the system for pd :

sudo leafpad /etc/security/limits.conf
or try nano if you don’t start an X server
add
* - rtprio 99
* - memlock 1000000000

Start pd and go to media > preference > startup
add the following flag in the startup flag field :
-rt -alsa -noadc -audiobuf 25

then apply and restart pd.

4. test

download analog synth emulation patch by Cyrille Henry here :
svn checkout https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/externals/nusmuk/nusmuk-audio/ ~/nusmuk-audio
cd ~/nusmuk-audio
make
cd examples
pd analog_synth_emulation.pd

5. Performance :

The analog output of RPi has been improved but it is still quite noisy. Man can output some audio through HDMI. We use an HDMI display to convert audio and to send it to good quality loudspeaker. We later tried a USB soundcard (Edirol UA-1A) which works out-of-the-box.

We tried to reduce latency without hearing click with the Cyrille’s patch, here are the results :
10 ms latency with USB soundcard
20 ms latency with integrated HDMI audio
We also tried to input audio with USB soundcard but audio is crackly as soon as input is enable (with output too).

6. Getting data from real world

Most of MIDI-USB interface should work out-of-the-box.
With Edirol UM-1EX we get a MIDI loopback between 30 and 35ms.

HID works great.
svn checkout https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/externals/hid/ ~/hid
cd hid/
make
pd hid-help.pd

The Byron interface (http://www.1010.co.uk/org/byron.html) is one of the cheapest way to make a CV-to-computer interface.

A TCP loop on a local computer takes less than 1.5 ms.

7. Autologin

To enable auto login, we follow this : http://elinux.org/RPi_Debian_Auto_Login. And to start pd at startup, we follow the steps on the same page but replace startx by ~/autostart.sh wich is a script like this :
pd -nogui -audiodev 3 -open ~/nusmuk-audio/examples/analog_synth_emulation.pd

7 segments

5 avril 2012

Réalisation pour le collectif Ivan Mosjoukine <http://lepointtriple.blogspot.fr/p/ivan-mosjoukine_14.html> : afficheur à 3 chiffres de 7 segments grand format.
C’est un accessoire utilisé dans leur spectacle Note on circus.
Ingrédients : chipKit Uno32, quelques résistances et transistors, chutes de ruban de LED RGB chinois, boite en carton et bois recyclés, télécommande 3 boutons à fil

photo : Ivan Mosjoukine
photo : Ivan Mosjoukine

Dispositif de mapping dynamique

24 février 2012

Mis au point dans le cadre du spectacle Les Fuyantes de la compagnie les Choses de RIen, ce dispositif de mapping dynamique permet notamment de projeter de la vidéo sur des objets / personnes en mouvement sur le plateau.
Je me suis occupé de la conception et du prototypage, le dispositif a ensuite été entièrement programmé en PureData par Cyrille Henry.
La vidéo ci-dessous montre quelques-unes de ses possibilités.

les fuyantes from chnry on Vimeo.

Arduino sends temperature & humidity to Google spreadsheet

25 décembre 2010

Here is an Arduino code that sends some values to a Googledocs spreadsheet.
This is based on a RobertMParker’s code found here : http://asynclabs.com/forums/viewtopic.php?f=16&t=489
It uses an Ethernet shield to connect to the internet instead of a WiShield.

You just have to put the key of your own form into the url.

The code is downloadable on github : EthernetShield_to_google/EthernetShield_to_google.pde