python framebuffer interface linux

Working on a python module for drawing in the framebuffer in linux console.

Some convenience functions like poly, line, rect, arc and a character generator added. Has a rudimentary multiple drawing-surface manager (wouldn’t call it windows yet).

All administration and access to drawing functions through python, actual drawing is done by a helper function written in c.

Wrote this as part of an audioplayer project raspberry pi/wolfson pi. needed a framebuffer audioscope, phase plotter, while being able to use curses based progs simultaneously.

I actually got my inspiration from adafruit *and*
raspberry-compote *and* karoltomala

This one is made with the fbpy module:

byyrcmnd
 
documentation of fbpy. preee alpha
 

capture output sound linux alsa python

Work in progress!!!
Not sure about all the details yet, working on it.
Without using pulseaudio etc.. I wanted to capture the output of my soundcard in python.
I used modprobe snd-aloop
and added the following to my .asoundrc :


pcm.mixin {
type dsnoop
ipc_key 5978293 # must be unique for all dmix plugins!!!!
ipc_key_add_uid yes
slave {
pcm "hw:4,1"
channels 2
period_size 220
#buffer_size 4096
#rate 44100
periods 0
period_time 0
}
bindings {
0 0
0 1
}
}

ctl.mixin {
type hw
card 4
}

That pcm hw:4.1 I got from using cat /etc/asound/cards

in python I use now

self.inp = alsaaudio.PCM(type=alsaaudio.PCM_CAPTURE,mode=alsaaudio.PCM_NORMAL,card="plug:mixin")

It is important to set the self.inp.setperiodsize to the same value as in the asoundrc file etc..

This http://wiki.ubuntuusers.de/.asoundrc article was very useful!!

How I got framebuffer working on ubuntu 12.04

Edited the file /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_GFXMODE=1024x768

It was actually the second line that got things working!

Issued command: update-grub
To find the resolution I used
hwinfo --framebuffer

In the same directory in the file console-setup

FONTFACE="Terminus"
FONTSIZE="12x6"

issued: setupcon -v
Also checked the /etc/modprobe.d/blacklist-framebuffer.conf

http://kmandla.wordpress.com/2010/04/16/a-quick-look-at-framebuffer-applications/
http://www.karoltomala.com/blog/?p=679
http://crunchbanglinux.org/wiki/howto/adjust_grub2_framebuffer

cmus with web interface

Lately I’ve been working on a web interface for the console based (curses) audioplayer cmus. I need the interface for an audioplayer project I am working on based on a raspberry pi and wolfson pi.

Cmus can be controlled via UNIX socket, using cmus-remote which makes external control easier. Having a text-based interface there is no need for display manager and GUI on the computer.

implementation

Cmus runs in tty1. I use the program vcsadump to grab to contents of tty1 and convert it to html.  I have written a python program tty2html.py, which postprocesses this html file. It adds mouse functionality and some other features like autoupdate javascript. Finally the Python webserver BaseHTTPServer generates the web interface. Will publish the code soon…