├── .gitignore ├── ArtNetListener.pde ├── LICENSE.md ├── README.md ├── artnetP5.pde ├── code └── artnet4j-0001.jar └── docs ├── artnet4j-installation.md └── images ├── apple-usb-ethernet-config.png ├── enttec-opendmx-ethernet-config.png ├── madmapper-and-artnetp5-listenining-to-dmx.png ├── sample-dmx-console-state.jpg └── sample-matching-artnetp5-display.png /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | applet 3 | application.linux32 4 | application.linux64 5 | application.windows32 6 | application.windows64 7 | application.macosx 8 | -------------------------------------------------------------------------------- /ArtNetListener.pde: -------------------------------------------------------------------------------- 1 | import java.net.SocketException; 2 | import artnet4j.ArtNetException; 3 | import artnet4j.ArtNetServer; 4 | import artnet4j.events.ArtNetServerListener; 5 | import artnet4j.packets.ArtDmxPacket; 6 | import artnet4j.packets.ArtNetPacket; 7 | 8 | class ArtNetListener { 9 | public static final int DMX_CHANNELS_COUNT = 512; 10 | 11 | private static final int SUBNET_COUNT = 16; 12 | private static final int UNIVERSE_COUNT = 16; 13 | 14 | private int inPort = ArtNetServer.DEFAULT_PORT; 15 | private int outPort = ArtNetServer.DEFAULT_PORT; 16 | private String broadcastAddress = ArtNetServer.DEFAULT_BROADCAST_IP; 17 | private int currentSubnet = 1; 18 | private int currentUniverse = 0; 19 | private int sequenceId = 0; 20 | 21 | private byte[][][] inputDmxArrays = new byte[ SUBNET_COUNT][ UNIVERSE_COUNT][ DMX_CHANNELS_COUNT]; 22 | 23 | private ArtNetServer artNetServer = null; 24 | 25 | ArtNetListener() { 26 | try { 27 | startArtNet(); 28 | } catch( SocketException e) { 29 | println( e); 30 | } catch( ArtNetException e) { 31 | println( e); 32 | } 33 | } 34 | 35 | public void startArtNet() 36 | throws SocketException, ArtNetException { 37 | if( this.artNetServer != null) { 38 | stopArtNet(); 39 | } 40 | 41 | this.artNetServer = new ArtNetServer( this.inPort, this.outPort); 42 | this.artNetServer.setBroadcastAddress( this.broadcastAddress); 43 | this.artNetServer.start(); 44 | initArtNetReceiver(); 45 | 46 | println( "ArtNet Started (broadcast: " + this.broadcastAddress 47 | + ", in: " + this.inPort + ", out: " + this.outPort + ")"); 48 | } 49 | 50 | public void stopArtNet() { 51 | if( this.artNetServer != null) { 52 | this.artNetServer.stop(); 53 | this.artNetServer = null; 54 | println( "ArtNet Stopped"); 55 | } 56 | } 57 | 58 | private void initArtNetReceiver() { 59 | this.artNetServer.addListener( 60 | new ArtNetServerListener() { 61 | @Override 62 | public void artNetPacketReceived( final ArtNetPacket artNetPacket) { 63 | switch( artNetPacket.getType()) { 64 | case ART_OUTPUT: 65 | ArtDmxPacket artDmxPacket = (ArtDmxPacket) artNetPacket; 66 | int subnet = artDmxPacket.getSubnetID(); 67 | int universe = artDmxPacket.getUniverseID(); 68 | System.arraycopy( 69 | artDmxPacket.getDmxData(), 0, 70 | inputDmxArrays[ subnet][ universe], 0, 71 | artDmxPacket.getNumChannels()); 72 | println( "Received packet in universe " + universe 73 | + " / subnet " + subnet + " containing " 74 | + artDmxPacket.getNumChannels() + " channel values:"); 75 | printArray( artDmxPacket.getDmxData()); 76 | break; 77 | 78 | default: 79 | break; 80 | } 81 | } 82 | 83 | @Override 84 | public void artNetServerStopped( final ArtNetServer artNetServer) { 85 | } 86 | 87 | @Override 88 | public void artNetServerStarted( final ArtNetServer artNetServer) { 89 | } 90 | 91 | @Override 92 | public void artNetPacketUnicasted( final ArtNetPacket artNetPacket) { 93 | } 94 | 95 | @Override 96 | public void artNetPacketBroadcasted( final ArtNetPacket artNetPacket) { 97 | } 98 | }); 99 | } 100 | 101 | public byte[] getInputDmxArray( final int subnet, final int universe) { 102 | return inputDmxArrays[ subnet][ universe]; 103 | } 104 | 105 | public byte[] getCurrentInputDmxArray() { 106 | return getInputDmxArray( this.currentSubnet, this.currentUniverse); 107 | } 108 | 109 | public Integer toInt( Byte dmxChannelValue) { 110 | int intValue = dmxChannelValue.intValue(); 111 | return intValue < 0 ? intValue + 256 : intValue; 112 | } 113 | 114 | public Integer getValueAt( final int index) { 115 | return toInt((Byte) getCurrentInputDmxArray()[ index]); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Licence Creative Commons 2 |
ArtnetP5 de Olivier Lange est mis à disposition selon les termes de la licence Creative Commons Attribution - Partage dans les Mêmes Conditions 4.0 International. 3 |
Fondé(e) sur une œuvre à https://github.com/olange/artnetP5. 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ArtnetP5 2 | 3 | A Processing sketch that listens to ArtNet DMX Input packets and displays the values of the 6 first channels as a graph bar. 4 | 5 | Uses the [Artnet4j-Elios](https://github.com/Eliosoft/artnet4j-elios) library to listen to the ArtNet network. This library is a fork supporting DMX Input, based on [ArtNet4j](https://code.google.com/p/artnet4j/) by Karsten Schmidt (toxilibs). 6 | 7 | ## Sample output 8 | 9 | 10 | 11 | 12 | ## Motivations 13 | 14 | I wrote this small Processing application to: 15 | 16 | 1. Test receiving DMX Input events from the 6 DMX channels of a [Cameo Control6](http://www.cameolight.com/en/products/dmx-controllers/control-6-6-channel-dmx-controller/) DMX lightning console received as ArtNet datagrams thru [Enttec's OpenDMX Ethernet](http://www.enttec.com/ode) (pictured above) 17 | 2. Understand the content of ArtNet datagrams, namely how and when the DMX channel values were transmitted 18 | 3. Check whether or not it was possible to have multiple applications reacting to the same DMX Input events. 19 | 20 | ## What I found out 21 | 22 | That for the illustrated setup, the ArtNet datagrams were: 23 | 24 | * either containing the values of the 6 DMX channels of the lightning console, being sent when changing the positions of the cursors 25 | * or the values of all 512 DMX channels of the universe/subnet, being sent from time to time. 26 | 27 | And that it was indeed possible to have multiple application listen to the same DMX Input events, provided the ArtNet4j library was [patched to set the SO_REUSEADDR socket option](https://github.com/olange/artnet4j-elios/commit/67f4a3362d602cc97cc5849a13d64fa58124abb3) of the ArtNetServer socket listener. Otherwise only one of the two apps would see and react to the ArtNet datagrams. 28 | 29 | 30 | 31 | ## See also 32 | 33 | * [Artnet4j installation](docs/artnet4j-installation.md) _Describes how to build Artnet4j JAR and configure Enttec's OpenDMX Ethernet_ 34 | -------------------------------------------------------------------------------- /artnetP5.pde: -------------------------------------------------------------------------------- 1 | final static int NUM_CHANNELS_DISPLAYED = 6; 2 | 3 | ArtNetListener artNetListener; 4 | byte[] inputDmxArray; 5 | 6 | void setup() { 7 | size( 800, 250); 8 | if( frame != null) { frame.setResizable( true); } 9 | textSize( 16); 10 | 11 | println( "Starting ..."); 12 | artNetListener = new ArtNetListener(); 13 | } 14 | 15 | void exit() { 16 | println( "Exiting ..."); 17 | artNetListener.stopArtNet(); 18 | super.exit(); 19 | } 20 | 21 | void draw() { 22 | background( 0); 23 | inputDmxArray = artNetListener.getCurrentInputDmxArray(); 24 | displayDMXInput(); 25 | displayStatus(); 26 | } 27 | 28 | void displayDMXInput() { 29 | float barH, barW; 30 | 31 | stroke( 32, 192); 32 | fill( 128, 192); 33 | 34 | barW = float( width - 41) / NUM_CHANNELS_DISPLAYED; 35 | for( int i = 0; i < NUM_CHANNELS_DISPLAYED; i++) { 36 | barH = floor( map( artNetListener.toInt( inputDmxArray[ i]), 37 | 0, 255, 0, height - 40)); 38 | rect( 19 + barW * i, height - 20 - barH, barW, barH); 39 | } 40 | } 41 | 42 | void displayStatus() { 43 | fill( 255); 44 | text( inputDmxArray.length + " DMX channels, " + NUM_CHANNELS_DISPLAYED + " displayed\n" 45 | + width + " x " + height + "px (" + str( int( frameRate)) + " fps)" 46 | , 50, 50); 47 | } 48 | 49 | -------------------------------------------------------------------------------- /code/artnet4j-0001.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olange/artnetP5/32a4a75d35d2ce12a534c2f00d9023bde10a16cf/code/artnet4j-0001.jar -------------------------------------------------------------------------------- /docs/artnet4j-installation.md: -------------------------------------------------------------------------------- 1 | # ArtNet4j and Enttec OpenDMX Ethernet 2 | 3 | Using [Artnet4j-Elios](https://github.com/Eliosoft/artnet4j-elios) by Alexandre Collignon and Jérémie Gaston-Raoul 4 | 5 | ... which is a fork supporting DMX Input, based on [ArtNet4j](https://code.google.com/p/artnet4j/) by Karsten Schmidt (toxilibs) 6 | 7 | Source: [Issue 2: ArtNetServer doesn't receive ArtDmx packets, so can't recieve DMX data via ArtNet](https://code.google.com/p/artnet4j/issues/detail?id=2) 8 | 9 | ## How to add a JAR to a Processing project? 10 | 11 | 1. create "code" folder in your sketch folder. 12 | 2. put jar file (library) into this folder 13 | 3. if you dont have jar library file, put java souce files in your sketch folder 14 | 4. initiate library object in your sketch 15 | 16 | Source: [Processing forums / ArtNet4j](http://forum.processing.org/one/topic/artnet4j.html) 17 | 18 | ## How to use ArtNet4J to receive DMX packets? 19 | 20 | See for instance [ArtNetServerManager.java](https://github.com/Eliosoft/elios/blob/master/src/main/java/net/eliosoft/elios/server/ArtNetServerManager.java)'s source code. 21 | 22 | ## Network configuration 23 | 24 | Enttec OpenDMX Ethernet: 2.0.0.101 / 255.0.0.0 25 | 26 | 27 | 28 | Computer USB Ethernet: 2.0.0.100 / 255.0.0.0 29 | 30 | 31 | 32 | ## Building and testing Artnet4j 33 | 34 | Build JAR file 35 | 36 | hg clone https://code.google.com/p/artnet4j/ 37 | cd artnet4j 38 | ant jars 39 | 40 | Test 41 | 42 | javac -cp ./bin -d ./bin src.test/artnet4j/test/PollTest.java 43 | java -cp ./bin artnet4j.test.PollTest 44 | 45 | If it works: 46 | 47 | ~/Sources/artnet4j $ java -cp ./bin artnet4j.test.PollTest 48 | août 31, 2014 8:17:58 PM artnet4j.ArtNet 49 | INFO: Art-Net v0001-20091119 50 | août 31, 2014 8:17:58 PM artnet4j.ArtNetServer start 51 | INFO: Art-Net server started at port: 6454 52 | août 31, 2014 8:17:58 PM artnet4j.ArtNetNodeDiscovery discoverNode 53 | INFO: discovered new node: /2.0.0.101 54 | août 31, 2014 8:17:58 PM artnet4j.ArtNetNode extractConfig 55 | INFO: updated node config 56 | found net lynx 57 | 1 nodes found: 58 | node: ST_NODE /2.0.0.101 Open DMX Ethernet, 1 ports, subswitch: 00 59 | ... 60 | 61 | ## Building ArtNet4j-Elios 62 | 63 | Build JAR File 64 | 65 | git clone https://github.com/Eliosoft/artnet4j-elios.git 66 | cd artnet4j-elios 67 | mvn package 68 | 69 | Documentation 70 | 71 | mvn javadocs:javadocs (or mvn site) 72 | open target/site/apidocs/index.html 73 | 74 | Test 75 | 76 | java -cp target/artnet4j-0001.jar:target/test-classes/ artnet4j.test.PollTest 77 | 78 | If it works, using Enttec's OpenDMX Ethernet, you'll get something along the lines of: 79 | 80 | ~/Sources/artnet4j-elios (master)$ java -cp target/artnet4j-0001.jar:target/test-classes/ artnet4j.test.PollTest 81 | août 31, 2014 8:04:08 PM artnet4j.ArtNet 82 | INFO: Art-Net v0001-20091119 83 | août 31, 2014 8:04:08 PM artnet4j.ArtNetServer start 84 | INFO: Art-Net server started at port: 6454 85 | août 31, 2014 8:04:08 PM artnet4j.ArtNetNodeDiscovery discoverNode 86 | INFO: discovered new node: /2.0.0.101 87 | août 31, 2014 8:04:08 PM artnet4j.ArtNetNode extractConfig 88 | INFO: updated node config 89 | found net lynx 90 | 1 nodes found: 91 | node: ST_NODE /2.0.0.101 Open DMX Ethernet, 1 ports, subswitch: 00 92 | ... 93 | 94 | If it doesn't see any ArtNet device, you'll get: 95 | 96 | ~/Sources/artnet4j-elios (master)$ java -cp target/artnet4j-0001.jar:target/test-classes/ artnet4j.test.PollTest 97 | août 31, 2014 2:11:53 PM artnet4j.ArtNet 98 | INFO: Art-Net v0001-20091119 99 | août 31, 2014 2:11:53 PM artnet4j.ArtNetServer start 100 | INFO: Art-Net server started at port: 6454 101 | 0 nodes found: 102 | 0 nodes found: 103 | 0 nodes found: 104 | ... 105 | 106 | ## Installing Mercurial, Git, Ant and Maven 107 | 108 | brew install hg (for Artnet4j) 109 | brew install ant (for ArtNet4j) 110 | 111 | brew install git (for ArtNet4j-Elios) 112 | brew install maven (for ArtNet4j-Elios) 113 | -------------------------------------------------------------------------------- /docs/images/apple-usb-ethernet-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olange/artnetP5/32a4a75d35d2ce12a534c2f00d9023bde10a16cf/docs/images/apple-usb-ethernet-config.png -------------------------------------------------------------------------------- /docs/images/enttec-opendmx-ethernet-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olange/artnetP5/32a4a75d35d2ce12a534c2f00d9023bde10a16cf/docs/images/enttec-opendmx-ethernet-config.png -------------------------------------------------------------------------------- /docs/images/madmapper-and-artnetp5-listenining-to-dmx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olange/artnetP5/32a4a75d35d2ce12a534c2f00d9023bde10a16cf/docs/images/madmapper-and-artnetp5-listenining-to-dmx.png -------------------------------------------------------------------------------- /docs/images/sample-dmx-console-state.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olange/artnetP5/32a4a75d35d2ce12a534c2f00d9023bde10a16cf/docs/images/sample-dmx-console-state.jpg -------------------------------------------------------------------------------- /docs/images/sample-matching-artnetp5-display.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olange/artnetP5/32a4a75d35d2ce12a534c2f00d9023bde10a16cf/docs/images/sample-matching-artnetp5-display.png --------------------------------------------------------------------------------