Csound and FLTK

FLTK GUI Toolkit for Csound

My subject today is the Csound FLTK (stands for “Fast Light ToolKit”) opcodes. FLTK gives you a method to build simple, fast, lightweight GUIs for your Csound instruments.

It contains commands to build panels with sliders, knobs, buttons or banks of the above. At the end of this post is a simple example that creates a little tool that lets you change the frequency of your sine oscillator using a GUI.

Some of the nice things about this are: you don’t need Java or some other layer of software to accomplish it, and it ought to be relatively portable between Mac, Windows and Linux users.

Just to give a feeling for it, here’s an overview of the FLTK opcodes and system pretty much lifted from the v5 Csound manual:


FLTK Containers are widgets that contain other widgets such as panels, windows, etc. Csound provides the following container objects:

  • Panels
  • Scroll areas
  • Pack
  • Tabs
  • Groups


The most useful objects are named FLTK Valuators. These objects allow the user to vary synthesis parameter values in real-time. Csound provides the following valuator objects:

  • Sliders
  • Knobs
  • Rollers
  • Text fields
  • Joysticks
  • Counters

There are other FTLK widgets that are not valuators nor containers:

  • Buttons
  • Button banks
  • Labels
  • Keyboard and Mouse sensing

Also there are some other opcodes useful to modify the widget appearance:

  • Updating widget value.
  • Setting primary and selection colors of a widget.
  • Setting font type, size and color of widgets.
  • Resizing a widget.
  • Hiding and showing a widget.

There’s also a simple example in the manual showing how to make use of a FLTK control (I hope this displays properly; wordpress does filter out certain character combinations.

; Select audio/midi flags here according to platform
; Audio out Audio in No messages
-odac -iadc ; -d ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o linseg.wav -W ;;; for file output any platform
FLpanel "Panel1",450,550,100,100 ;***** start of container
gk1,iha FLslider "FLslider 1", 500, 1000, 0 ,1, -1, 300,15, 20,50
FLpanelEnd ;***** end of container
FLpanel "Panel2",450,550,100,100 ;***** start of container
gk2,ihb FLslider "FLslider 2", 100, 200, 0 ,1, -1, 300,15, 20,50
FLpanelEnd ;***** end of container
FLrun ;***** runs the widget thread, it is always required!
instr 1
; gk1 and gk2 variables that contain the output of valuator
; widgets previously defined, can be used inside any instrument
printk2 gk1
printk2 gk2 ;print the values of the valuators whenever they change
f 0 3600 ;dummy table for realtime input

Lately (May 09), I’ve been trying to understand a new tool called QuteCsound that has a facility for manipulating widgets. Also, I think blue has this capability.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: