Skip to content

bespsm/MidiGyver

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MidiGyver Build Status

Flexible console program to convert MIDI inputs into OSC using a YAML config file.

Suported MIDI Event types:

  • CONTROLLER_CHANGE;
  • NOTE_ON
  • NOTE_OFF

Install dependencies

In linux would be:

sudo apt install cmake

In MacOS would be:

brew install cmake git

Compile and Install

git clone https://github.com/patriciogonzalezvivo/MidiGyver.git
cd MidiGyver

mkdir build
cd build
cmake ..
make
sudo make install

Use

Devices are program using a YAML file, which is past as the only argument

midigyver config.yaml 

Try one of the examples of the examples/ folder.

Config

Each YAML file can contain the configuration of multiple devices. The configuration of a device is set under the node with it own name (note: empty spaces and other symbols are replaced with _ ).

In that node you set up the out protocols ( csv or as many osc clients you want).

Each key event happens in the following order:

[ MIDI Key IN ] -> [ shaping function (JS) ] -> [ map ] -> [ send key values to OUT ]

Each event node is compose by: * name: name of the event. This is use to construct the OSC path or the first column on the CSV output * type: could be: button, toggle, states, scalar, vector and color. * shape: shaping function to modify the original key value (between 0 and 127 from the key) to any other number. After the mapping the range still will be between 0 ~ 127. If the result is a false it doesn't map or send the key value. * map: depend on the type of the event it can map: - bottom or toggle booleans to strings (on: <something> and off: <something>) to string - states linearly from any array of strings (ex; [low, med, high] ) - scalars linearly from any array of numbers (ex: [0, 1, 100, 2, -10])
- vectors linearly from any array of vectors (ex: [ [0, 0], [0.5, 1.0]]) - colors linearly from any array of colors (ex: [ [1, 0, 0], [0, 0, 1]]) * value: here is where the final values are store so next time this YAML is reload it can send all the previous states. * out: you can specify special out puts that will over write the default one.

global:
    track: 0

out:
    -   csv
    -   osc://localhost:8000
in:
    nanoKONTROL2*:
        0:
            name: fader00
            type: scalar
            value: 1
            out:
                -   osc://localhost:8001
-
        16:
            name: knob00
            type: scalar
            map: [-3.1415, 3.1415]
            value: 3.1415

        17:
            name: knob01
            type: color
            map: [[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 1]]
            value: [1, 1, 1, 1]

        18:
            name: knob02
            type: vector
            map: [[0.0, 0.0], [-0.5, 0.0], [-0.5, -0.5], [0.5, -0.5], [0.5, 0.5], [0.0, 0.5], [0.0, 0.0]]
            value: [0, 0, 0]

        19:
            name: knob03
            type: states
            map: [low, med, high, ultra_high]
            value: ultra_high

        32:
            name: sBtns0
            type: toggle
            value: true
            map:
                on: define,DRAW_SHAPE

        58:
            name: track_back
            type: scalar
            shape: |
                function() {
                    if (global.track == 0)
                        return false;

                    if (value == 127)
                        return global.track--;
                    
                    return false;
                }

        59:
            name: track_fwd
            type: scalar
            shape: |
                function() {
                    if (value == 127)
                        return ++global.track;
                    
                    return false;
                }

Acknowledgements

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 97.1%
  • CMake 2.8%
  • Makefile 0.1%