Giter VIP home page Giter VIP logo

kboard-editor's Introduction

This is a simple editor for the kboard, primarily intended for linux users. Well, really it's intended for myself, but anyone is welcome to use it. The only functionality this offers over the official editor from KMI is opportunity to set bend to separate ranges for up and down, and some sensitivities can be set to a larger range. That and linux compatibility.

This is very unofficial and for all I know you could brick your kboard or send your children to war or something else awful so absolutely no guarantees offered or implied.

Installation

There is no installation required, as it is meant to be used in the interactive python interpreter. It should be compatible with both python2.7 and python 3, but most distros only have pygame packaged for python 2.7 even though pygame is python3 compatible. For convenience you can copy kboard.py to usr/local/lib/python2.7/dist-packages/ and it will be available regardless of where your terminal is when you run python. Otherwise you need to be sure you are in this directory when you run python.

There are a few simple dependencies for using this script. On ubuntu install them all simply by typing: sudo apt-get install python2.7 python-pygame

And it will get what you need.

Usage

Once that is done simply run the commands:

python
import kboard #this will show you the current configuration
#you can change whatever you like such as:
kboard.setOnThreshold(25) #tab will autocomplete, and tab 2x will show you what all the various set functions are.
exit() #leave python

The kboard module sends the sysex through the alsa midi_through output port, so be sure to connect that to the kboard.

Most functions allow a range of 0-127, but exceptions are noted below. Some of the ranges indicated are what the KMI app limits you to, though in this app they aren't actually limited to this range. Out of bounds values are clamped to the min or max. Here is the complete list of available functions and their description:

kboard.load("filename") # saves the current configuration sysex to a file
kboard.save("filename") # loads a saved file into the current configuration
kboard.setChannel(v) # 0-15 zero indexed midi channel
kboard.setOnThreshold(v) # threshold for turning on a note

kboard.setPadBendMax(v) # 0-12 semitones, range of upward bend from pad
kboard.setPadBendMin(v) # 0-12 semitones, range of downward bend from pad

kboard.setPressureCC(v) # CC number for pressure
kboard.setPressureChanPressureMode("v") # Yes/No send channel pressure messages instead of CC
kboard.setPressureDisabledReturn("v") # Yes/No sets whether to send a CC when Pressure is disabled
kboard.setPressureDisabledReturnValue(v) # CC value when pressure is disabled
kboard.setPressureSensitivity(v) # 60-126

kboard.setTiltBendMax(v) # 0-12 semitones, range of upward bend from tilt
kboard.setTiltBendMin(v) # 0-12 semitones, range of downward bend from tilt
kboard.setTiltBendMode("v") # Yes/No sets whether tilt sends bend or CC messages
kboard.setTiltCC(v) # CC number for tilt when tilt bend mode is off
kboard.setTiltDisabledReturn(v) # Yes/No sets whether to send a CC when Pressure is disabled
kboard.setTiltDisabledReturnValue(v) # CC value when tilt disabled
kboard.setTiltSensitivity(v) # 57-127

kboard.curves # shows list of available velocity curves
kboard.setVelocityCurve("v") # lin/log/sin/cos/exp/inv
kboard.setVelocitySensitivity(v) # 0-255

kboard.reset() # resets the current configuration to the default values

After each action the configuration is sent to the kboard and is shown such as:

Configuration to send to KBoard:

 Channel:                       0
 Pressure CC:                   1
 Pressure sends Chan. Pressure: No
 Tilt CC:                       127
 Tilt sends Bend:               Yes
 Pad Bend Max:                 +12 semitone
 Pad Bend Min:                 -12 semitone
 Tilt Bend Max:                +1 semitone
 Tilt Bend Min:                -1 semitone
 Velocity Sensitivity:          100
 Pressure Sensitivity:          100
 Tilt Sensitivity:              77

 Velocity Curve:                lin
 Return a Value...
   when Pressure Disabled:      Yes
    Disabled Pressure Value:    127
   when Tilt Disabled:          Yes
    Disabled Tilt Value:        127
 Note-On Threshold:             16

This is the conguration that was just sent or will be sent if you call kboard.send(). There is no way to read the current configuration of the kboard.

kboard-editor's People

Contributors

naught101 avatar ssj71 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

kboard-editor's Issues

question leds?

cool, how did you find the sysex?
Have you managed to light the leds programmatically? Different note/velocity values perhaps as for the qunexus keyboard?

thx.

Fails in python 3

In [1]: import kboard
ALSA lib conf.c:3009:(snd_config_update_r) Cannot access file /etc/alsa/alsa.conf
ALSA lib seq.c:935:(snd_seq_open_noupdate) Unknown SEQ default
---------------------------------------------------------------------------
MidiException                             Traceback (most recent call last)
<ipython-input-1-0b8ee74ed658> in <module>()
----> 1 import kboard

/data/documents/electronics/kboard-editor/kboard.py in <module>()
     26 #it would be nice if these were constants
     27 midi.init()
---> 28 midi_out = midi.Output(midi.get_default_output_id())
     29 hi = [0xf0, 0x7e, 0x7f, 0x07, 0x06, 0x01, 0xf7]
     30 default = [

/home/naught101/miniconda3/envs/science/lib/python3.5/site-packages/pygame/midi.py in __init__(self, device_id, latency, buffer_size)
    387 
    388         if device_id == -1:
--> 389             raise MidiException("Device id is -1, not a valid output id.  -1 usually means there were no default Output devices.")
    390 
    391         try:

MidiException: 'Device id is -1, not a valid output id.  -1 usually means there were no default Output devices.'

This kind of looks like a problem with pygame, really, because it works fine in python2, and I can't see how your code is different between versions, but I figured you may have hit this, and might know what's causing it.

Settings don't stay set in python 2: PortMidi call failed... PortMidi: `Bad pointer'

When I follow the example in the README, the lights flash on the K-board (both when I import kboard, and when I change a setting), and the settings appear to change, but when I exit python after making a change, I get an error, and the next time I open python and import kboard, I get the default settings - nothing is changed.

Is there some "save settings" call that's required or something?

Example:

In [1]: import kboard

Current KBoard Configuration:
...
 Velocity Curve:                lin
...

In [2]: kboard.setVelocityCurve('log')

Current KBoard Configuration:
...
 Velocity Curve:                log
...

In [3]: kboard.midi.quit()

In [4]: exit()
PortMidi call failed...
  PortMidi: `Bad pointer'
type ENTER...

$ ipython                

In [1]: import kboard

Current KBoard Configuration:

 Channel:                       0
 Pressure CC:                   1
 Pressure sends Chan. Pressure: No
 Tilt CC:                       127
 Tilt sends Bend:               Yes
 Pad Bend Max:                 +12 semitone
 Pad Bend Min:                 -12 semitone
 Tilt Bend Max:                +1 semitone
 Tilt Bend Min:                -1 semitone
 Velocity Sensitivity:          100
 Pressure Sensitivity:          100
 Tilt Sensitivity:              77

 Velocity Curve:                lin
 Return a Value...
   when Pressure Disabled:      No
    Disabled Pressure Value:    127
   when Tilt Disabled:          No
    Disabled Tilt Value:        127
 Note-On Threshold:             16

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.