JAudioLibs AudioServers – a PortAudio-esque Java API

The JAudioLibs’ AudioServer API is a Java library loosely inspired by PortAudio. It was initially designed early in the development of Praxis LIVE in order to provide a common callback-based interface for working with low-latency audio. This API has since found its way into a variety of other projects, primarily by people wanting to use the JACK Audio Connection Kit from Java (JAudioLibs’ JNAJack was developed at the same time). Using the AudioServer API provides an application the ability to switch easily between JavaSound and JACK at runtime. It can also make working just with JavaSound a little easier.

Praxis LIVE & JACK

Praxis LIVE & Hydrogen linked through JACK

For some time I have been considering how to extend the AudioServer API to improve runtime service discovery, provide better access to features of the underlying audio libraries, and make it easier for people to contribute new implementations. A recent email from Ollie Bown, developer of the excellent Beads audio library, prompted me to spend some time over the last week trying to finish this work (the development version of Beads has been using this API for some time).

Continue reading

Live visual development with TinkerForge

TinkerForge is an excellent and easy to use open-source hardware solution for physical computing. Praxis LIVE is an open-source visual development environment, particularly (not exclusively) designed for working with audio & video, with the ability to run projects from the command line or as standalone (NetBeans runtime) applications. So, what happens when we bring these two worlds together?

This is best watched in full-screen HD!

Experimental support for a few TinkerForge components has been in Praxis LIVE for some time.  However, in the weeks leading up to the last release, these were tidied up and expanded.  There is now a concerted effort to complete these bindings, and promote Praxis LIVE as a (maybe the?) visual development environment for TinkerForge. Praxis LIVE is great for working with other media – use an IR sensor to control an OpenGL filter, shout to switch on a light, or use an OSC controller on your Android phone to control a servo.  It’s also fun for just working with TinkerForge by itself.

Continue reading

Packaging as a .deb

If you’ve been following this blog or the Praxis code site for the last couple of months, you might be forgiven for thinking that not a lot had been happening. Actually that’s far from the case. I’ve been busy with a number of projects, one of which has seen some major additions to the Praxis code, and I’m now in the process of tidying that up for a new release. Some of the audio code has also been extracted and pushed to a separate repository (https://github.com/jaudiolibs/) of which more soon … but I digress. One thing that changed with the last Praxis LIVE release is that by default the Linux download is a .deb (Debian binary package) file, and I’ve been meaning to write up a how-to (for my benefit as much as yours!) since. So, here goes. Continue reading

Dabbling with the dark arts again

Well, the subject of dark themes seems to have come up again in the NetBeans world recently, with Geertjan blogging about Stan Aubrecht’s dark theme for Nimbus.  This looks great, though as you might have gathered from the look and feel of Praxis LIVE, I quite like dark look and feels! :-)

Unfortunately, the problem with Nimbus is it’s still not officially supported in NetBeans due to some EDT issues (though seems much more stable than the last time I tried it).  Also, to quote from Geertjan’s blog, “In Stan’s words, this is a “poor man’s” solution. There are some area that would need more tweaking, e.g., the top bar in the Options window. But it would mean changing code in NetBeans. This new module just adjust a few UIManager constants.”  Well, as I blogged about in the Dark arts of NetBeans hackery, it is possible with some devious hackery to alter things like the top bar of the Options window, and this is done in Praxis LIVE, so I thought I’d have a go at providing a plugin for this look and feel that could be used within the NetBeans IDE (or other platform application).

NetBeans IDE running with Praxis LIVE look & feel

NetBeans IDE running with Praxis LIVE look & feel

Continue reading

New year, new Praxis LIVE

A (slightly belated) Happy New Year to you all, and news of a new Praxis LIVE release.  Just squeaking in during the final fanfare of 2012 was Praxis LIVE build:121231, bringing some major work on the video pipeline, some nice UI improvements, dynamic component support, and the start of a TinkerForge binding (see video below).

Downloads – http://code.google.com/p/praxis/downloads/list
Release notes – http://code.google.com/p/praxis/wiki/ReleaseNotes

Continue reading

The Influence of the Actor Model (Praxis architecture 101)

No, not a post about my salacious exploits with a C-list Hollywood celebrity (that’s for a different blog :-) ), but a technical overview of a key aspect of the Praxis architecture. Absolutely essential to Praxis’ media neutral architecture, as well as the ability to edit everything live, is an asynchronous, shared-nothing, message-passing system. This is loosely inspired by the Actor Model and other solutions for concurrent / distributed programming (without following any particular concept to the letter). Continue reading

The dark arts of NetBeans hackery

Since before it was a NetBeans RCP based application, Praxis had its own Swing look-and-feel – a (minimal) fork of the lovely NimROD. Well, when I was transitioning to the NetBeans platform, I was determined to keep this look-and-feel. Unfortunately, this being a dark (white on black) look-and-feel, a small amount of hackery was required to get NetBeans to play nicely. I thought I’d document three of these here. What follows may be of use to any NetBeans developer working with non-default look and feels; it may not make much sense to a non-NetBeans developer!

Hack #1

I install the Praxis LAF within a ModuleInstall class’s restored() method. This makes the build process nice and simple, but it does have its drawbacks.

Praxis tabs problem

Here you can see an early attempt at installing the Praxis look and feel.  hmm … the look and feel doesn’t have any green in it, so where did that green tab come from?

NetBeans has some code (in the org.netbeans.swing.plaf module) that handles changing the look and feel at runtime, switching out values from the old look and feel. Unfortunately, a few values set in AllLFCustoms are never removed and are set using a class called GuaranteedValue. Most of the GuaranteedValues delegate to another value in the UI table – unfortunately, they only delegate at creation time, which means the old values (in this case the green from my GTK theme) hangs about.

So, what do I do about it? In the code below from my ModuleInstall I take the nuclear option, completely clearing the UIDefaults table before installing my look and feel, then make sure all the necessary values are set in my LFCustoms subclass.

public void restored() {
 try {
   EventQueue.invokeAndWait(new Runnable() {
     public void run() {
       ClassLoader cl = Lookup.getDefault().lookup(ClassLoader.class);
       UIManager.put("ClassLoader", cl);
       UIManager.put("Nb.PraxisLFCustoms", new PraxisLFCustoms());
       try {
         LookAndFeel laf = new PraxisLookAndFeel();
       } catch (UnsupportedLookAndFeelException ex) {}
 } catch (Exception ex) {}

Hack #2

So, now the main text and tabs in my look and feel are looking OK. However, there are still a few issues. Firstly, notice the help pane in the Property component here –

Praxis Property TopComponent visual problem

This isn’t used much in Praxis yet, but that text that currently says “Unrecognized File” is not meant to be black and barely readable! This component is a JEditorPane, and unfortunately JEditorPane’s don’t care much about your default colour scheme. There is a client property for JEditorPane to get it to play ball, but how to get access to this component in order to set it when it’s hidden inside non-public code?

Well, to do this I create a custom UI delegate for JEditorPanes and register it in my LFCustoms class (from #1). In this I set the required client property.

public class HonorDisplayEditorPaneUI extends BasicEditorPaneUI {

  public static ComponentUI createUI(JComponent c) {
    c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
    return new HonorDisplayEditorPaneUI();

Problem solved!

Praxis Property TopComponent fixed

Hack #3

The third and final hack I’m going to demonstrate is with the Options dialog. Here you can see the problem – the Options dialog buttons along the top have colours and borders hard-coded in that don’t fit well with our colour scheme.

Praxis Options dialog with problem

So, apart from wanting to scream why, why, why, why, why??? :-) what can be done about it? The buttons are a hidden inner class, which is inaccessible, and subclass JLabel – ah, there’s our answer, in similar fashion to #2 we can create a custom UI delegate and override some of the behaviour.

In this class I create a custom UI delegate just for JLabel subclasses from the Options module, and listen in and override properties being set.  I also make sure the parent JPanel has its background set to black.

public class OptionsAwareLabelUI extends MetalLabelUI {

  private static final Color oldHighlighted = new Color(224, 232, 246);
  private final Color fgNormal = MetalLookAndFeel.getBlack();
  private final Color bgNormal = MetalLookAndFeel.getWhite();
  private final Color bgSelected = MetalLookAndFeel.getPrimaryControlShadow();
  private final Color bgHighlighted = bgSelected.darker().darker();
  private final Border normalBorder = new EmptyBorder(6, 8, 6, 8);
  private final Border highlightBorder = new CompoundBorder(
    new CompoundBorder(
      new LineBorder(bgNormal),
      new BevelBorder(BevelBorder.LOWERED)),
    new EmptyBorder(3, 5, 3, 5));
  private boolean ignoreChanges;

public void propertyChange(PropertyChangeEvent e) {
  if (ignoreChanges) {
  if (!(e.getSource() instanceof JLabel)) {
  JLabel c = (JLabel) e.getSource();
  if ("background".equals(e.getPropertyName())) {
    ignoreChanges = true;
    Color bgCurrent = c.getBackground();
    if (Color.WHITE.equals(bgCurrent)) {
    } else if (oldHighlighted.equals(bgCurrent)) {
    } else if (!bgNormal.equals(bgCurrent)) {
    ignoreChanges = false;
  } else if ("foreground".equals(e.getPropertyName())) {
    ignoreChanges = true;
    if (!fgNormal.equals(c.getForeground())) {
    ignoreChanges = false;
  } else if ("border".equals(e.getPropertyName())) {
    ignoreChanges = true;
    Border current = c.getBorder();
    if (current instanceof EmptyBorder) {
    } else {
    ignoreChanges = false;
  } else {

private void checkParent(JComponent c) {
  Component parent = c.getParent();
  if (parent instanceof JPanel) {
    if (!bgNormal.equals(parent.getBackground())) {

public static ComponentUI createUI(JComponent c) {
  if (c.getClass().getName().startsWith("org.netbeans.modules.options")) {
    return new OptionsAwareLabelUI();
  } else {
    return MetalLabelUI.createUI(c);

And now we get this – not perfect yet, but at least it’s the right colour-scheme!

Praxis Options dialog fixed


Well, a rather long first post about NetBeans but hopefully this is of use to someone else.  Just remember, they’re hacks and rely on underlying behaviour of non-public code so will need checking against new versions of the NetBeans platform.

You can find all this code in LAF module in the Praxis LIVE repository.

Now, I’m off to write some RFE’s so hopefully these hacks won’t be needed in future! :-)