Skip to content

antonhornquist/Grrr-sc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grrr-sc

Grid controller UI toolkit for SuperCollider.

Description

Grrr-sc provides high level UI abstractions for grid based controllers such as monome 40h, 64, 128 and 256 devices. Widgets, ie. buttons and toggles, are placed on controllers. Widgets can be nested in containers which allows for modes and paging. Grrr reuses principles of the standard SuperCollider GUI class library.

Usage

Grrr can be used as a framework for building full featured apps or in live coding.

Examples

Hello World

a=GRScreenGrid.new; // creates a virtual grid which shows up in a separate window
b=GRButton(a, 0@0); // places a 1x1 button at top left key
b.action = { |view, value| (value.if("Hello", "Goodbye") + "World").postln }; // sets an action to be triggered when the button is pressed

// pressing the top left grid button of the grid will change led state and output to the Post Window

An Example With Sound

s.boot;
a=GRMonome.new; // creates a monome
b=GRButton(a, 0@0); // places a 1x1 button at top left key
b.action = { |view, value| if (value) { c = {SinOsc.ar}.play } { c.release } }; // sets an action to be triggered when the button is pressed
a.spawnGui; // spawns a virtual grid

// pressing the top left grid button of the grid will change led state and audition a sine oscillator

A Simple Step Sequencer

s.boot;
a=GRMonome.new; // creates a monome
b=GRStepView.new(a, 0@7, a.numCols, 1); // the step view defines when to play notes 
c=GRMultiToggleView.new(a, 0@0, a.numCols, 7); // toggles representing note pitch
c.valuesAreInverted=true;

(
    // sequence that plays a note for steps that are lit
    fork {
        b.playhead = 0;
        inf.do {
            if (b.stepValue(b.playhead)) { (degree: c.toggleValue(b.playhead)).play };
            0.15.wait;
            b.playhead = (b.playhead + 1) % b.numCols;
        }
    }
)

a.spawnGui; // spawns a virtual grid

(
// randomize pattern
b.numCols.do { |index|
	c.setToggleValue(index, (c.numRows).rand);
	b.setStepValue(index, [true, false].choose);
};
)

Requirements

Grrr-sc requires the SerialOSCClient-sc library. The library has been developed and tested in SuperCollider 3.8.0.

Installation

Install the SerialOSCClient-sc dependency.

Copy the Grrr-sc folder to the user-specific or system-wide extension directory. Recompile the SuperCollider class library.

The user-specific extension directory may be retrieved by evaluating Platform.userExtensionDir in SuperCollider, the system-wide by evaluating Platform.systemExtensionDir.

Documentation

Reference documentation in SCDoc help format is available in the SuperCollider IDE once the Grrr library is installed.

Tests

An automated test suite for Grrr-sc is available separately: GrrrTests-sc

Implementation

Code readability has been favored over optimizations.

The grrr-rb library is a Ruby port of this library. The SuperCollider and Ruby classes are generated using the rsclass-rb class generator based on meta data defined in the grrr-meta-rb repository.

Classes

  • GRView - Abstract superclass. Represents a 2D grid of backlit buttons.
    • GRContainerView - Abstract class for views that may contain other views.
      • GRTopView - This is the topmost view in a view tree and typically the view to which controllers attach. The view cannot be added as a child to any other view.
    • GRButton - A button that may span over several rows and columns.
    • GRAbstractToggle - Abstract class for toggles.
      • GRToggle - A toggle.
        • GRVToggle - Vertical oriented toggle.
        • GRHToggle - Horizontal oriented toggle.
    • GRMultiButtonView - A grid of buttons of the same size.
    • GRMultiToggleView - An array of vertical or horizontal toggles of the same size.
    • GRStepView - A grid of buttons of the same size referred to by index. One of the steps may be indicated as the playhead position. Suitable for step sequencing.
    • GRKeyboard - A virtual keyboard.
  • GRController - Abstract superclass. Represents a grid based controller device that may attach to and control part of or an entire view.
    • GRMonome - Generic monome controller.
      • GRMonome64 - 8x8 monome.
      • GRMonomeV128 - 8x16 monome.
      • GRMonomeH128 - 16x8 monome.
      • GRMonome256 - 16x16 monome.
    • GRScreenGrid - An on-screen controller of user definable size. Button events may be triggered with mouse and keyboard.

Extending Grrr

It's possible to create custom widgets and add support for additional grid controllers by subclassing base classes in the Grrr library. Refer to section "Extending Grrr" in the bundled documentation for details on extending Grrr.

License

Copyright (c) Anton Hörnquist

About

Grid controller UI toolkit for SuperCollider

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published