Home

Awesome

ArtNet for Java & Processing Build Status Build status

Art-Net DMX over IP library for Java and Processing. This library adds a lot of features to the existing artnet4j project. Including support to read dmx data.

Features

Installation

I recommend to install it from maven central. Otherwise it is also possible to use github packages, jitpack.io or just the binary download.

Maven

<dependency>
  <groupId>ch.bildspur</groupId>
  <artifactId>artnet4j</artifactId>
  <version>0.6.2</version>
</dependency>

Gradle

repositories {
    mavenCentral()
}

dependencies {
    compile 'ch.bildspur:artnet4j:0.6.2'
}

Examples

The library adds a new class called ArtNetClient, which contains easy access to the underlaying Art-Net implementation.

Send Dmx Data

To send dmx data you have to create a new client. It is possible to skip the buffer creation by passing null to the constructor.

byte[] dmxData = new byte[512];
ArtNetClient artnet = new ArtNetClient();
artnet.start();

// set data
dmxData[0] = 128;

// send data to localhost on subnet 0 and universe 0
artnet.unicastDmx("127.0.0.1", 0, 0, dmxData);

artnet.stop();

Based on SendDmxData

It is also possible to send the data via broadcast.

// to broad cast data
artnet.broadcastDmx(0, 0, dmxData);

Read Dmx Data

To read data you have to create a new client and read the bytes from the buffer. Please be aware that you have to mask the bytes with 0xFF (because they are signed).

ArtNetClient artnet = new ArtNetClient();
artnet.start();

byte[] data = artnet.readDmxData(0, 0);
System.out.println("First Byte: " + data[0] & 0xFF);
artnet.start.stop();

Based on ReceiveDmxData

Select Port

While creating the ArtNetClient, it is possible to select the specific ports for the server (incoming) and the client (outgoing).

ArtNetClient artnet = new ArtNetClient(new ArtNetBuffer(), 8000, 8000);

Based on SendOnSpecificPort

Bind Custom Network Interface

It is also possible to set a custom network interface. Here you see how to bind a custom network interface en5 to the ArtNet server:

NetworkInterface ni = NetworkInterface.getByName("en5");
InetAddress address = ni.getInetAddresses().nextElement();

artnet.start(address);

Receive Packet Events

Sometimes it is necessary to receive events when a new package was received. For this prupose you can get the underlaying ArtNetServer and add a new listener to it.

artnet = new ArtNetClient();

// add packet listener to server
artnet.getArtNetServer().addListener(
 new ArtNetServerEventAdapter() {
  @Override public void artNetPacketReceived(ArtNetPacket packet) {
   println("new packet received!");
  }
});

artnet.start();

About

The library is based on then artnet4j project.

Art-Net by Artistic Licence allows for broadcasting DMX data via IP/UDP. This library is implementing the basic protocol for Java applications.

Currently supported core features are:

This project is currently still in pre-alpha stage, so currently only source access via hg. Be also aware that large parts of the codebase are still undergoing major changes.

New features are developed by Florian.