Coder Social home page Coder Social logo

nanokontrol2's Introduction

NanoKontrol2

Interface for using Korg NanoKONTROL2 with SuperCollider.

Basic usage

n = NanoKontrol2();

// register a function to be evaluted when fader1 is changed
n.fader1.onChange = {|val| (val/127).postln; }

// overwrite the previous assignment
n.fader1.onChange = {|val| val.linexp(0, 127, 20, 20000).postln; }

n.sBtn1.onPress = { "Hello, ".post; };
n.sBtn1.onRelease = { "NanoKONTROL2!".postln; };

Incremental assignment

It is possible to incrementally assign faders, knobs, and the s/m/r buttons.

n = NanoKontrol2();

(
n.faders.do {|fader, i|
    fader.onChange = {|val|
        "This is fader % its value is %\n".postf(i+1, val);
    }
};

n.knobs.do {|knob, i|
    knob.onChange = {|val|
        "This is knob % its value is %\n".postf(i+1, val);
    }
};

n.rBtns.do {|rBtn, i|
    rBtn.onChange = {|val|
        "This is rBtn % its value is %\n".postf(i+1, val);
    }
};
)

Or just a selection of controls

// assign faders 1 .. 4
n.faders[..3].do {|fader, i| 
    fader.onChange = {|val|
        "This is fader % its value is %\n".postf(i+1, val);
    }
};

External LED control

Button LEDs can be controlled using MIDI if NanoKontrol2 is set to "external mode" in the Korg Kontrol Editor.

(
// Use \external to enable LED control.
// Remember to set "LED mode" in Korg Kontrol Editor to "external"
n = NanoKontrol2(\external);

// turn on leds
n.rBtns.do {|btn|
    btn.ledState = 1;
};

n.mBtns.do {|btn|
    btn.ledState = 1;
};

n.sBtns.do {|btn|
    btn.ledState = 1;
};
)

n.ledsOff; // turn leds off

// the button is passed as an argument for `onPress` and `onRelease`
n.rBtn1.onPress = {|val, btn|
    btn.ledState = 1;
};

Interface

Methods

onChange all controls (faders/knobs/buttons) can register a function using this method

onPress only register press on buttons

onRelease only register release on buttons

free unregisters a MIDI responder

freeAll unregisters all MIDI responders

ledsOff turn off all LEDs

Note: Cmd-. removes all MIDI responders by default in SuperCollider

Controller names

All controls on the NanoKONTROL2 are supported, see list of names below.

Faders/Knobs

  • fader1 .. 8
  • knob1 .. 8

Buttons

  • sBtn1 .. 8
  • mBtn1 .. 8
  • rBtn1 .. 8

Transport buttons

  • bwBtn
  • fwdBtn
  • stopBtn
  • playBtn
  • recBtn
  • markerSetBtn
  • markerBwBtn
  • markerFwdBtn
  • trackBwBtn
  • trackFwdBtn
  • cycleBtn

Collections

  • faders
  • knobs
  • sBtns
  • mBtns
  • rBtns

Credits

Based on NanoKontrol.sc by jesusgollonet

nanokontrol2's People

Contributors

davidgranstrom avatar pfeyz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.