Python

EuroPython training checklist

Veröffentlicht in Kategorie Coding, Computer, Python am 22. Juli 2014 von Chris – Ersten Kommentar schreiben

Here’s a checklist for participants of my training session Interactive experiments in sound synthesis with Nsound, numpy and matplotlib at EuroPython 2014 in Berlin.

  1. Have/bring a laptop with Linux (preferred), Windows, or OS X and good headphones.
    An external audio interface may help with audio performance but is not essential.
  2. Download and install my virtual machine appliance for the course
    or follow the instructions to set up your own environment for the course.
  3. Get the initial course material from my Git repository (the $ denotes the shell prompt):
    $ git clone http://chrisarndt.de/git/soundxp-ep2014.git soundxp

    If you use my virtual machine, do this instead:

    $ cd ~/work/soundxp
    $ git pull
  4. Test that audio output over your headphones works by playing the file audio/mynameis.wav from the course material with any audio player provided by your system (for example on my virtual machine you can use aplay from the command line).
  5. Test that your Nsound installation works by activating the virtual environment in which you installed it (see step 2) and running:
    $ cd soundxp
    $ ipython -i startup.py
    Python 2.7.8 (default, Jul  1 2014, 17:30:21)
    Type "copyright", "credits" or "license" for more information.
    IPython 2.1.0 -- An enhanced Interactive Python.
    [...]
    In[1]: /pl mynameis

We will quickly do steps 3 – 5  at the beginning of the course again for all participants to get up-to-date.

I’m looking forward to meeting you all at the training session, let’s have fun making noise!

Setting up a virtualenv for IPython and Nsound

Veröffentlicht in Kategorie Coding, Computer, Python am 22. Juli 2014 von Chris – Ersten Kommentar schreiben

These instructions detail how to create a working environment for participants of my training session Interactive experiments in sound synthesis with Nsound, numpy and matplotlib at EuroPython 2014 in Berlin who do not want to or cannot use the virtual machine appliance I created for the course. These instructions are geared to Linux users, though with a bit of knowledge and adaptation on your part, they can also be applied to Microsoft Windows or Mac OS X systems. Inexperienced users are strongly encouraged to use the virtual machine appliance instead!

Weiter lesen »

Virtual machine for my EuroPython 2014 sound experimentation training

Veröffentlicht in Kategorie Ankündigungen, Coding, Computer, Python am 19. Juli 2014 von Chris – Ersten Kommentar schreiben

I have created a virtual machine for virtualbox for the participants of my training session Interactive experiments in sound synthesis with Nsound, numpy and matplotlib at EuroPython 2014 in Berlin. It provides a ready to run Manjaro Linux System with an XFCE desktop and all the software necessary to follow the course.

Update (2014-07-22): if you already are at EuroPython and downloading the virtual machine appliance is too slow, please contact me via email (see below) or on Twitter (@TheUnifaun) and we’ll meet and I’ll transfer the file to you via USB stick or SD card.

Here are the instructions on how to get your environment for the training session up and running. These instructions should work regardless of whether you use Windows, OS X or Linux:

Weiter lesen »

Select a Python code block in Geany with Lua

Veröffentlicht in Kategorie Coding, Computer, Lua, Python am 4. April 2014 von Chris – Ersten Kommentar schreiben

Here’s a nifty little Lua script for the Geanylua plug-in for the Geany text editor: install it into your ~/.config/geany/plugins/geanylua folder and add the name of the script to ~/.config/geany/plugins/geanylua/hotkeys.cfg to allow binding it to a keyboard shortcut (I use Ctrl-Alt-b, see the Geanylua documentation for more information on assigning keys to scripts).

When the script is activated, it will select the block corresponding to the current code folding level of the line the cursor is on in the active document. E.g. if you place the cursor in the body of a Python function on a line that is on the same indentation level as the first line of the body of the function, it will select the whole function. Also, if the cursor is on the opening line of a block, e.g. a line starting with class, def, if, etc., the script will select the block started by this line.

Note: this strategy does not work well in conjunction with functions preceded by a decorator, since the selection will not include the decorator line. For this reason, the selection is inverted, i.e. it starts at the end of the block and ends at the beginning. This means you can hold down shift and move the cursor backwards, and the selection will extend from the beginning of the block backwards, instead of the end of the selection being shortened as it would be for a normal selection.

Here’s the code of the Lua script as a Gist:

The script makes use of some Scintilla messages, which are only accessible in Geanylua via the geany.scintilla() function. The available messages are documented here.

Get the gist of it

Veröffentlicht in Kategorie Coding, Computer, Python am 11. Februar 2014 von Chris – Ersten Kommentar schreiben

Some months ago I finally caught up with modern development practices and switched to Git for new software projects. I even now use my GitHub and Bitbucket accounts more often, e.g. for collaboration projects, though I host my own projects on my own server with the help of Trac and gitosis.

One thing I do like about GitHub though, are Gists. Like many good ideas this one makes one wonder, why nobody came up with it before. Basically Gists are code snippets you publish on the web (like in a pastebin) but they are under version control and each Gist is its own mini git repository. They let you share programming ideas and nifty little tools with the rest of the world with ease and others can easily take them and comment, expand or correct them. The revision control makes it clear, what developed from where and who did what. Finally, your Gist page on GitHub serves as a central place, where you can browse, search and present all these digital scrap notes.

It is also very easy to include Gists in your blog, which is what I’m starting with this post.

Weiter lesen »

Audiosignalverabeitung mit Python

Veröffentlicht in Kategorie Coding, Computer, Musik, Python, Verschiedenes am 28. Februar 2011 von Chris – Ersten Kommentar schreiben

Wie man an einzelnen Beiträgen in diesem Blog sehen kann, beschäftige ich mich seit einiger Zeit verstärkt mit Soundsynthese und Audioprocessing. Als bekennender Fan von Python habe ich mich mal nach Tools für die mathematische Analyse und Verarbeitung von Audiosignalen in Python umgesehen und möchte hier mal meine Recherche-Ergebnisse vorstellen.

Weiter lesen »

Impromptu first beta

Veröffentlicht in Kategorie Ankündigungen, Coding, Computer, Python am 21. Januar 2011 von Chris – Ersten Kommentar schreiben

I was recently researching into GUI libraries for PyGame when I found pyglet, which is an alternative to PyGame for 2D/3D graphics programming with Pyython. It has no dependencies other than a standard Python installation and OpenGL, the API is well-structured and the documentation clean and extensive.

So I wrote a little demo application, which displays a pseudo-HTML file in a window and scrolls it up- or downwards with speed controllable by simple keyboard commands. Sort of like a teleprompter. You can use different fonts, colors and sizes through the subset of HTML4 supported by pyglet.

I thought this made be useful for others, for example when recording a podcast, webcast or an audiobook or when doing a presentation, so I baked a Python distribution package and put it on the Python Package Index.

So here’s to you: Impromptu 0.1b

Impromptu running in window mode under Ubuntu Linux

Impromptu running in window mode under Ubuntu Linux

Share & Enjoy!

Python BarCamp Köln am Samstag, 17.4.2010

Veröffentlicht in Kategorie Ankündigungen, Events, Python am 14. April 2010 von Chris – 2 Kommentare

Am diesem Samstag organisiert unsere lokale Python User Group den ersten Python BarCamp in Köln. Da dies eine sogenannte Unkonferenz sein soll, bei der die Teilnehmer das Programm größtenteils selbst organisieren, wäre es schön, wenn einfach jeder, der Lust hat teilzunehmen, vorbeikommen könnte. Leider müssen wir aber aufgrund der Beschränkungen der Räumlichkeiten die Teilnehmerzahl auf 30 begrenzen. Es sind aber noch einige Plätze frei! Deshalb habe ich gerade folgende Nachricht an verschiedene deutsche Python-Mailinglisten und Gruppierungen geschickt:
Weiter lesen »

How to create a new ticket in Trac from a script

Veröffentlicht in Kategorie Coding, Python am 26. Februar 2010 von Chris – Ersten Kommentar schreiben

This is just a note to myself and to spare someone, who faces the same task, going through the Trac sources to find out how to do this:

from trac.env import open_environment
from trac.ticket.model import Ticket

# A list of email addresses or trac user names
NOTIFICATION_LIST = ['randomhacker', 'boss']

ticket = Ticket(open_environment('/path/to/trac/env'))
ticket.populate(dict(
    component = u'My component',
    type = u'task',
    status = u'new',
    summary = u'Make the world a better place',
    reporter = u'me',
    # Set owner to default for given component
    owner = None,
    # You can use Trac wiki syntax here
    description = u"Don't ask '''me''' how to do it...",
    cc = ",".join(NOTIFICATION_LIST))
)
ticket_id = ticket.insert()

That’s all!

Update 2010-03-01: Naturally, after I figured this all out by myself by looking through the Trac source, I found this similar explanation on the trac wiki.

TurboGears 1.1 final(ly) released into the wild!

Veröffentlicht in Kategorie Coding, Python, TurboGears am 5. Oktober 2009 von Chris – 1 Kommentar

(A note to German readers: Artikel über Open Source, Programmieren und Software im Allgemeinen werde ich auf Englisch schreiben, da dies in meinem Kopf irgendwie so verdrahtet ist. Darüber kann ich gar nicht auf Deutsch schreiben ;) )

After releasing the 1.1rc1 release candidate two weeks ago, which seemed to have no major issues, and fixing a few remaining stumbling blocks, I am now proud and relieved to say, that TurboGears 1.1 final is finally out the door!

Weiter lesen »