All Articles DIY & Hacking
How To Hack ROLI Lightpad Block Into An 8-Step MIDI Sequencer
Liam Lacey on Tue, January 9th 0 comments
ROLI's Lightpad Block is fully customisable, and you don't need to be a coding expert to do it. Liam Lacey shows you how to hack this powerful hardware.

The ROLI Lightpad Block – released in 2016 – is a wireless, multitouch, pressure-sensitive MIDI touchpad device with a backlit display of 15x15 LEDs. The Lightpad has a very tactile and flexible surface that is more ergonomic than a touch screen for applying pressure, plus the new 2017 Lightpad Block M includes small waves on its surface offering a tactile ‘guide’ for your fingers; both of these features offering more precise control and a more satisfying experience compared to similar products.

The ROLI Lightpad Block

The ROLI Lightpad Block

The BLOCKS Dashboard application allows the Blocks hardware to be fully customized for integration with a number of different DAWs and plugins as well as to allow the hardware to operate as a range of different devices such as XY pads, drum pads, mixers, and even games. However a lesser-known feature of Blocks is that they can be easily programmed and hacked, allowing the 94mm x 94mm touch surface and the 225 LEDs of the Lightpad Block to do exactly what you want. In this tutorial, I’m going to introduce you to how you can go about hacking and developing software for the ROLI Lightpad Block as a complete beginner to software development. It is worth mentioning that all of the other Blocks hardware can also be hacked, as well as being able to program the exact behaviour of multiple Blocks connected together, however this tutorial will just focus on using a single Lightpad Block.

The BLOCKS Dashboard application

The BLOCKS Dashboard application

Before we start, here is an example video of what we’ll be making – a simple 8-step monophonic MIDI step-sequencer where pressure is used to set note velocity:

A demonstration of the custom sequencer Lightpad app connected to Ableton Live

The Hacking Options

There are two options when it comes to developing software for the ROLI Blocks:

  • 1. Developing applications for macOS/Windows/Linux that communicate with Blocks via USB-MIDI or Bluetooth-MIDI'ยจ
  • 2. Developing software that runs directly on the Blocks hardware 

The first option involves using the Blocks C++ programming language SDK (software development kit) which is most useful when used as part of the JUCE framework, and comes with a couple of example applications. While the Blocks SDK and JUCE framework provide you with the most options for developing custom software, they require third-party IDE (Integrated Development Environment) software to use and therefore may be a bit daunting if you’re new to the world of software development and coding.  

The second option involves using a simple programming language - developed specifically for Blocks - called Littlefoot, which provides basic functions for controlling all aspects of the Blocks hardware – all without relying on an external computer application. Possibly the biggest advantage of this option is that it is all done using ROLI’s own BLOCKS Code application, making it a lot easier and less daunting for coding beginners. 

Due to the simplicity of the second option, this tutorial is going to focus on using Littlefoot and the BLOCKS Code software for developing Blocks software, turning a Lightpad Block into custom standalone MIDI controller. However if you’d like to explore the other option please see the ROLI Developer webpage.   

What You Will Need 

An Introduction to the Littlefoot Language and Functions 

The Littlefoot programming language provides basic functions for controlling the Lightpad’s LED grid, customizing touch and button interactions, sending and receiving MIDI messages, and supporting multiple interconnected devices. There are a large number of Littlefoot functions that are all documented here, however below I’ve briefly described a number of the most common functions you may use in your Littlefoot scripts, to give you an idea of the different types of things you can program a Lightpad Block to do:

  • touchStart, touchMove, touchEnd – These three functions are called when a touch event on the Lightpad’s surface starts, moves, or ends respectively; providing data about the touch such as the x, y, and z positions and the finger index. Add these functions to your Littlefoot script to program what happens when you touch the Lightpad’s surface.
  • handleButtonDown, handleButtonUp – These two functions are called when the ‘Mode’ button on the side of the Lightpad is pressed or released. By default this button is used to cycle between saved ‘modes’ (or configurations of parameters set within BLOCKS Dashboard), however this button is freely assignable via Littlefoot scripts. Include these functions in your script to program custom actions for this button.
  • repaint – This function is designed to draw/update the LED grid, and you need to add this function to your script in order to program the Lightpad’s display. However as the function is called approximately 25 times per second it can also be used to program other time-related tasks (e.g. running a sequencer).
  • fillPixel – Call this function to set a pixel/LED on the Lightpad’s surface to a specific colour. You will mostly likely call this function from the repaint function.
  • fillRect, blendRect – Call these functions to draw/fill a rectangle of pixels/LEDs on the Lightpad’s surface with a specific colour, where blendRect allows you to provide an alpha/transparency value. You will mostly likely call these functions from the repaint function.
  • addPressurePoint – Call this function to draw a default ‘pressure point’ on the Lightpad’s display with a specific location and colour. You will mostly likely call this function from a touch event.
  • Sending MIDI messages – There are currently nine functions for programming the Lightpad Block to send different types of MIDI messages (e.g. sendNoteOn for sending note-on messages). Call these functions when you want a MIDI message to be sent, most likely from a touch or time-based event.
  • handleMIDI – This function is called when the Lightpad receives a standard MIDI message (such as a note or CC message). Include this function in your script to program what happens when MIDI messages are received. 
  • initialise – This function is called when the app on the Lightpad starts. Add this function to your script to program what happens on startup. 

For more information on using the Littlefoot language, see here.

Getting Started With The BLOCKS Code Application

BLOCKS Code is ROLI’s new Littlefoot code editor & compiler for the Blocks hardware, and it provides you with everything you need to develop and upload custom apps to your Blocks. 

The BLOCKS Code application

The BLOCKS Code application

The simple interface of the app comprises of the following sections: 

  • Text editor (right section) – This is the area where you write the code of your Littlefoot scripts, and one very useful feature of the editor is the option to insert common and template code fragments via a right-click menu.
  • Parameters – Displays the controls of all the user-definable parameters/settings of your app that you’ve included in your code.
  • Logging – If you have included any logging in your code (useful for debugging problems with your code), this will be displayed here.
  • Targets – Displays a list of all your connected Blocks.
  • Project – Lists all the separate files of a project, where each file is a Littlefoot script/app.
  • Error Console (below text editor) – This section will display any errors with your code.

One very useful feature of BLOCKS Code is that it can automatically compile your code (turn your code into an app) and upload the app to the Blocks hardware as you make changes - creating a seamless development process - however this can be turned off from the ‘Compiler’ menu if desired. 

Developing, Compiling, and Uploading a Custom App

Once you have installed BLOCKS Code onto your computer, complete the following steps:

1. Connect your Lightpad Block to your computer via USB, and press the ‘on’ button to turn it on. 

2. Launch the BLOCKS Code application.

3. Check that you can see your Lightpad in the list of devices within the ‘Targets’ section of the application and that the ‘Interact’ and ‘Target’ options are ticked. If you Block is not appearing, make sure BLOCKS Dashboard isn’t running.

4. In the ‘Compiler’ menu make sure that ‘Auto Compile’ and ‘Auto Upload’ are ticked.

5. Go to ‘File -> New File’. This will create a ‘New/Unsaved File’ file within the ‘Projects’ section.

6. Copy the code from this text file into the text editor. The code should then be automatically compiled and uploaded to you Lightpad Block - resulting in ‘No errors’ displayed under the text editor, and your Lightpad now displaying the sequencer app’s default interface. If not, check you copied over the entire code.

To see a description of the code to understand how it is working, see the comments (lines beginning with ‘//’ or sections enclosed in ‘/* */’) within the code. To see more examples of Littlefoot scripts see here.

Using the Custom App 

Once the custom app is uploaded onto your Lightpad, it is ready to be used. Open up your DAW or MIDI instrument and connect to the ‘Lightpad BLOCK’ MIDI device. I have programmed the app to work and be used in the following way: 

  • On the left-hand side are two rows of four sliders, where each slider represents a note/sequence step. 
    • Set the MIDI note number of a step with the slider value
    • Turn off the step/note by pressing underneath the slider
    • Set the note velocity of a step by holding the top-right section of the Lightpad and applying pressure to slider/step you want adjust
  • Start/stop the sequencer using the ‘Mode’ button on the side of the Lightpad
  • Set the tempo of sequence using the slider on the bottom right-hand corner
  • The app has four parameters/settings that can be found in BLOCKS Code within the ‘Parameters’ section:
    • MIDI Channel – sets the MIDI channel of the sequence
    • Scale – sets the scale of notes that can be played
    • Root Note – sets the root note of the scale
    • Sync to MIDI clock – when ‘on’ the sequence will sync to an external MIDI clock, where the sequence transport and tempo is set by incoming MIDI clock messages. 

Exporting to and Integrating with BLOCKS Dashboard 

The final thing you may want to do is allow you custom Lightpad App to appear in BLOCKS Dashboard for easy access. This just requires saving your Littlefoot script into a certain location on your computer, and can be done by completing the following steps in BLOCKS Code:

1. Go to ‘File -> Save As…’ (not ‘Save Project As’)
2. Navigate to Documents/ROLI/Littlefoot
3. Give your app a name and save it 

If you now close BLOCKS Code and open BLOCKS Dashboard you should see your app appear in the list of apps.

The Custom Lightpad App within BLOCKS Dashboard

The Custom Lightpad App within BLOCKS Dashboard 

However there are also some elements of the code that have configured how the custom app appears in BLOCKS Dashboard:

  • Near the start of the code there is a section beginning with ‘<metadata’ which does the following:
    • Sets the apps description
    • Sets the apps tags
    • Creates the user-definable parameters (e.g. MIDI Channel)
  • At the bottom of the code there is a section beginning with ‘<display’ which sets the background colour, text colour, and logo/image of the app within the Dashboard. BLOCKS Code provides a useful ‘Image Importer’ Tool (found in the ‘Tools’ Menu) that allows you to set all of these things using a graphical interface and then export it into your code.
The BLOCKS Code image importer tool

The BLOCKS Code image importer tool


So that’s how you can develop your own apps for the ROLI Lightpad Block. The sequencer app we created here may be fairly simple in regards to what the Lightpad Block can do, however hopefully it provides a good introduction to developing software for Blocks so that you can go on to develop more complex, useful, and unique apps. 

You can download the source code for this project using this link. 

Learn more about MIDI development in the Ask.Audio Academy here.  
Related Videos
Comments (0)

You must be logged in to comment.

Logic Pro Templates and Project Management
Logic Pro 314
Dream It. Do It.
Do you want to learn Logic Pro Templates and Project Management?
Yes, I want to learn!
No Thanks, I just want to read the article.
Course Advisor
Don't Know Where To Start?
Ask A Course Advisor
Ask Us!
Copy the link below and paste it into an email, forum, or Facebook to share this with your friends.
Make money when you share our links
Become an Ask.Video Affiliate!
The current affiliate rate is: 50%
Classes Start Next Week!
Live 8-week Online Certification Classes for: