WdaXU Dyn L

Fugio 1.8.0 – Serial port and Firmata plugins

Arduino Uno

Happy Fugio Friday!

Today we have two new plugins that enable Fugio to talk to hardware that uses a serial port interface, which includes the Arduino range of open source hardware (like the Arduino Uno above), which means that we can control LED lights, motors, servos, and use sensors for touch, magnetism, temperature, and many more!

The serial plugin handles the raw data communication between the Arduino and Fugio, and can be used to implement any kind of custom protocol between the two, but we can go one further and use the rather nice Firmata plugin to talk directly to the Arduino pins without writing any Arduino code at all.

Download Fugio 1.8.0 for Windows and OS X

Get the source code on GitHub

I haven’t had time to do a tutorial video (yet), but here’s some pointers to get you started:

Setting up a Serial Port

  • In the new Devices menu, choose Serial Ports
  • Add an entry for your Arduino.  Make sure you choose the right port, and set the baud rate (the speed the serial port will work at) to 57600 (bits per second)
  • Remember to press the Enable button for the entry you’ve just added

Arduino Serial Configuration

Reading from the Arduino (without Firmata)

Upload the following code to your Arduino:

void setup()
{
  Serial.begin( 57600 );
  
  while( !Serial )
  {
    // wait for serial port to connect.
  }
}

void loop()
{
  Serial.println( "Hello, World!" );
  
  delay(1000);              // wait for a second
}

Create the following:

Fugio reading from Arduino

And use the following Lua program:

fugio = require "fugio"

PinInputStrings = fugio.input( "Strings" )

function main()
	local Strings = PinInputStrings:get()

	for i = 1,#Strings do
		fugio.log( i .. ": " .. Strings[ i ] )
	end
end

Setting up Firmata

Instructable for installing Firmata on Arduino

And here’s what you have to do in Fugio:

Quit the Arduino software and load Fugio:

  • Add a Serial Input node, a Firmata node, and a Serial Output node
  • Connect the Serial input and Serial output to the Firmata node
  • Connect a button to the Reset pin

Firmata setup

If everything is connected and configured properly, you should see the pins appearing on the Firmata node.  Check the logger window for additional messages.

Firmata with pins

If this doesn’t happen first time, you may need to close the patch and reload it.

At this point you should be able to read and write to the Arduino pins!

Click the Edit Pins button to configure pins for inputs (digital INPUT (true/false) and ANALOG input (0-1023)), and outputs (digital OUTPUT (true/false), and PWM mode is supported):

Firmata pins

I’m going to be showing a couple of artworks at the prestigious V&A Museum in London for the next few days with the High Altitude Bioprospecting team (and fellow members of the Institute of Unnecessary Research) for the Digital Design Weekend as part of the London Design Festival.

23rd September: 6-8pm
24th and 25th September: 10:30am-5pm

I’ll have Fugio on hand (creating music from genomic data) so come and say hello!

Fugio Tutorial 8 – OpenGL live coding, Spout and Syphon

New Fugio video tutorial covering OpenGL shader live coding, sharing OpenGL textures between many applications in real time using Spout (Windows) and Syphon (OS X), and rendering to texture for complex, multi-stage shader processing. Not expecting to get too much coding done this week as I’m off to Ars Electronica this week in Linz, Austria this week. Have fun with the update!

Download Fugio 1.7.0 for Windows and OS X

Get the source code for compiling on Linux

NEW

  • Spout and Syphon plugins
  • Added live coding support to OpenGL shader compiler
  • Added trigger and buffer pins to Text Editor
  • Added Brew install/update script for OS X
  • Added LuaVector3D

UPDATED

  • Progress on building on Raspberry Pi 3, including cross compile

FIXED

  • Fixed some issues with MIDI Channel Input listening
  • Fixes some update issues in PinPrivate
  • Image Loader wasn’t always showing the thumbnail

Fugio Tutorial 6 – MIDI

This Fugio Friday we have two new plugins that provide MIDI input and output for integrating with musical instruments, MIDI controllers, and the huge range of MIDI enabled software and hardware.

Use the maintenance tool to update your existing installation, or download the updated installers.

NEW

  • PortMidi plugin for cross-platform MIDI support on Windows/OS X/Linux
  • MIDI plugin with a range of creating nodes for MIDI input, output, and processing
  • Example: Core/Envelope
  • Lots of new methods for qt.color()
  • Added connected pin to TCPReceiveRaw
  • Added reset pin to SLIPEncoder
  • Added shift pin to FFT for sliding windows
  • Added clear feature to log window – right-click or control-click to bring up the context menu (suggestion: @braedenf)
  • Added –clear-settings command line argument that will remove all settings
  • Settings colours is now undo-enabled

UPDATED

  • Added more user feedback in TCPReceiveRaw
  • EnvelopeNode uses paired pins
  • NumberMonitorNode updates:
    • Set default range to 0.0 – 1.0
    • Changing the node name updates the dock widget name
    • Added an update trigger rather than just hard-coding 25fps
    • Setting auto rename to input pins

FIXED

  • PortAudio input wasn’t working so well after last week’s update
  • Fixed crash when trying to copy groups (reporter: @braedenf)
  • Fixed many grouping issues!
  • Fixed Number Monitor rendering
  • Smooth fixed
  • SLIPEncoder wasn’t enabled
  • TCPSendRaw wasn’t working
  • Fixed crash on exit due to network manager
  • The recent files menu was displaying placeholder entries

Fugio Tutorial 5 – Lua Scripting

This tutorial introduces Lua scripting for making your own custom nodes within Fugio.  From simple data processing to complex logic, Lua is an easy to learn language (that’s also widely used in commercial game development because of its speed) and many other software packages.

You need Fugio 1.3 or later to have Lua support.

Fugio Tutorial 4 – Networking and Open Sound Control (OSC)

Happy ‪#‎FugioFriday‬! Bit late today because I was up late watching the UK EU referendum results come in. Personally I’m very disappointed with the result but regardless of the outcome, we have to continue to work together across the planet and create many wonderful, inspiring things!

In the spirit of sharing and cooperation, I have TWO new plugins for you today! There’s a network one, for sending data between computers, and an Open Sound Control (OSC) one so you can start linking Fugio up with other software and hardware.

If you’ve already installed Fugio, choose “Check for updates…” in the help menu, else download the latest version from http://www.bigfug.com/software/fugio

In this tutorial video I show you how to connect the mobile app TouchOSC (Android and iOS) to Fugio so you can add a very cool touch screen interface to your patches.

Please like and share the video!

I’m off to Vienna on Sunday for a few days work but will catch up with you next week.

Have a good weekend…

Fugio Video Tutorial #2 – Audio Output

In this tutorial we’ll start to explore audio output using a simple signal generator.

We cover controlling different types of pins, and using number range mapping to scale the value of numerical pins.

Also, check out the Patreon page I made for Fugio if you’d like to help support the project.

Fugio Alpha Release

It’s time to begin the process of getting Fugio out into the world.

If you’ve not been following its progress so far, Fugio is a visual programming system primarily designed for rapid development of digital art projects, with a view to being a highly flexible and educational platform that builds transferrable knowledge while not forcing anyone to write a single line of code (unless they want to!)

Fugio is completely free for anyone to use (and will be fully open source soon).  It has taken me two years of hard work, time, and money to get it to this stage, and I’m very excited to finally share everything that I’ve been making.

As a lone developer, I haven’t had the luxury of a QA department testing all the code, so there’s definitely going to be some rough edges to begin with, hence this alpha release, which is aiming to catch as many common issues as possible before its full launch.

This first release is an extremely cut down version that only includes 42 basic nodes (the full version has around 200 nodes), but there is enough that we will be able to run through a short tutorial (below).

Please let me know if it does or doesn’t work.  Also, all feedback (good and bad) is really important at this stage, so do please tell me!

Download

Click here to download Fugio

Installation for Windows

Double-click on the Fugio-1.x.x-WIN.zip to open the archive, which contains FugioInstaller.exe – run this to install.

Follow each stage of the installer.  At this point you should just be able to accept the defaults.

Once the installer has finished, you can run Fugio by clicking on your Windows start button, going to the new Fugio entry, and clicking on the program icon to start the application.

If the application doesn’t start, try installing the Microsoft runtime that is included in the zip archive called vcredist_msvc2013_x86.exe

Installation for OSX

Double-click on the Fugio-1.x.x-OSX.dmg to open the archive, which contains FugioInstaller – run this to install.

Follow each stage of the installer.  At this point you should just be able to accept the defaults.

Once the installer has finished, you can run Fugio by going to your Applications folder in Finder, going to the new Fugio directory, and clicking on the program icon to start the application.

If OSX complains that the application hasn’t been signed (it hasn’t) then either right-click on the application icon (or Ctrl+Left Click) and select Open from the menu.  You’ll then see the same warning but this time with the option to run the application anyway.

Our First Patch

When you start Fugio you will see a welcome window.  Click the OK button to continue.

You’ll be presented with the main editor window:

Fugio-Alpha-Tutorial-01

To start a new patch, go to the File Menu and click on New (or press Ctrl+N on Windows, or Command+N on OSX)

The new patch will open a window, where we can now add nodes.

There are several ways to do this but for now we’ll just double-click in the middle of the patch window.  A new “Insert Node” window will appear.  The first time you do this it will be completely blank.  Start typing “Audio Output” (without the quotes) and you’ll see the names of nodes that match what you’re typing.  Once you see “Audio Output (PortAudio)” at the top of the list, you can press return to add the node to the patch.

Fugio-Alpha-Tutorial-02

The node will appear in the middle of the patch.  A node is a self-contained piece of code that has inputs and outputs.  The one we have just added is for sending audio to your speakers or headphones.

Fugio-Alpha-Tutorial-03

It has two inputs (the little blocks on the left hand side, which we call pins), one for audio data, and one to set the overall volume of the audio being played.  There is also a dropdown control to select which audio device on your computer to send the audio data to.  This will almost certainly be different from the one in the picture above.  You should be able to leave it as the default but feel free to change it if you need to.

You can move nodes around by dragging them around by their white title bars.

Add another node by double-clicking on the white space in the patch window.  Make sure you don’t double-click on the node you’ve already added as this won’t work.

Fugio-Alpha-Tutorial-04

We’re going to add a slider to control the output volume.  Start typing “Slider” into the window until “Slider (GUI)” appears at the top of the list.  GUI stands for Graphical User Interface and means that it contains some type of thing you can visually control.

Fugio-Alpha-Tutorial-05

The slider has a single output pin (inputs are always on the left, outputs are always on the right), which is a number between 0 (zero) and 1.  Hold the mouse cursor over the gray pin (not its name) and you should see a little popup that tells you some information about the pin, and in the case of numbers, it’s value, which is currently zero (as the slider control is all the way to the left).

Move the slider control to the middle, and hold the mouse cursor over the Number pin again, you’ll see the value has changed.

We’re now going to connect the output pin of the slider to the volume control of the audio output node.

Press the mouse cursor onto the slider’s Number gray pin and, while you keep your button pressed, drag the mouse away from the pin.  If you have done this correctly, you’ll see a new link following the mouse cursor:

Fugio-Alpha-Tutorial-06

Drag the mouse to the Volume input pin of the Audio Output node.  When you’re in the right place the link will turn gray (rather than red) to show that you can make this link.  Release the mouse cursor.

Fugio-Alpha-Tutorial-07

If you’ve done this correctly, you’ll see the new link turn yellow (showing it’s now selected).  Make sure it’s connected to the Volume pin (as above) and not the Audio pin.

As it’s currently selected, if you had made a mistake, you can press the Delete key (or Backspace on OSX) to delete the link.

Slide the slider all the way to the left (as above) to make sure the volume is set to zero (for now).

Double-click in the patch window to create a new node:

Fugio-Alpha-Tutorial-08

We’re going to add an audio signal generator.  Double-click on the “Signal (Audio)” node in the list.  If you add the “Signal (Number)” node by mistake, just press Delete/Backspace to delete it.

Fugio-Alpha-Tutorial-09

The new Signal node is going to generate an audio signal that we will be able to hear via the Audio Output node.  Connect the Signal’s Audio pin to the Audio Output’s input pin, so it looks like this:

Fugio-Alpha-Tutorial-10

If everything is working, you should now be able to slowly move the Slider towards the right, and you should hear a tone playing.  If you don’t, make sure your speakers/headphones are turned on and their volume isn’t set to zero.  Alternatively try a different audio output device using the drop-down in the Audio Output node.

The Signal node can generate several kinds of audio signals.  Let’s experiment with them.  Add a new node (double-click on the path window) and add a “Choice” node:

Fugio-Alpha-Tutorial-11

Connect the Choice pin to the Signal Type pin:

Fugio-Alpha-Tutorial-12

The Choice node now lists the different kinds of signals that you can generate.  Try selecting the different options.  Put it back to Sine when you’re ready to move onto the next step.

We’re now going to play with the Frequency of the generated signal.  Unlike the volume slider, the frequency value doesn’t go between zero and one.  In fact, average human hearing lies between 20Hz and 20,000Hz (20kHz).  Hertz (Hz) is the unit we use to count ‘cycles per second’.

We need to take the output of the slider and map its range to the frequency range we want to cover.  We’ll use a “Number Range Map” node to achieve this.

Fugio-Alpha-Tutorial-13

Here we’re going to use a slightly lower range (20-8,000 Hz), but feel free to experiment.

Fugio-Alpha-Tutorial-14

Number Range Map takes an “Input Value” (which will be our slider value) that it expects to be within the range between “Input Min” and “Input Max”.  By default these are set to zero and one respectively, which perfectly match the range of our slider, so we don’t need to change these values.  What we do need to do is change the output range.

Move the mouse cursor over the input pin called “Output Min” and you’ll see its default value, which is currently zero.  Right-click (or Ctrl+Click on OSX) on the pin’s gray box to bring up its menu, and choose “Edit Default”.  Change the value to 20 and click on OK.

Fugio-Alpha-Tutorial-15

We now do the same with the “Output Max” pin and change the default value to 8000:

Fugio-Alpha-Tutorial-16

To see the effect of what we have just done, let’s add “LCD Number” node and connect it to the Output Value.

Fugio-Alpha-Tutorial-17

Add a new slider and connect it to the “Input Value”:

Fugio-Alpha-Tutorial-18

As you move this new slider, you will see the output number is 20 when the slider is at the far left, and 8000 when the slider is at the far right.  Don’t worry if this is not entirely clear at this point – it’s not the most straightforward node to use but you will find it useful to quickly convert values between nodes.

Fugio-Alpha-Tutorial-19

We can now add a second link from the “Output Value” and connect it to the Signal’s Frequency input.  Move the slider and hear the change in the sound.

The full patch should look like this (click on the image to zoom in):

Fugio-Alpha-Tutorial-20

That’s it for this first tutorial but even at this early stage there are plenty of other nodes to try out if you want to explore further.

In the Nodes window on the left of the editor is a full list of all the currently available nodes.  Click on their names once to get further information and links to documentation.  Double-click on the name to add it to the current patch window, or you can drag and drop it into the window.

If you have any feedback or questions, or were unable to complete the tutorial, please let me know via the comments of this post, or contact me here.