Giter Site home page Giter Site logo

Comments (14)

gbevin avatar gbevin commented on July 17, 2024 2

Please provide me with feedback about how well it works for you, I'm posting a beta release now.

from receivemidi.

l0s avatar l0s commented on July 17, 2024

@dwojdak, what command would you like to launch? You can most likely just pipe the output of receivemidi to the command (if it can read multiple entries from stdin) or to a shell script that reads from stdin and launches the command for each line. Here is an example of what such a (POSIX) shell script would look like:

#!/bin/sh
# handle-midi-events.sh

while read -r line
do
  note=$(echo "$line" | awk '{ print $4 }')
  # if the command takes the events as parameters, use this
  # the command in the example is `echo`
  echo $note
  # if the command takes reads the vents from stdin, use this
  # the command in the example is `cat`
  echo "$note" | cat
done

To use it, run:

receivemidi dev "My MIDI Device Output" | sh handle-midi-events.sh

from receivemidi.

essboyer avatar essboyer commented on July 17, 2024

Hi! I've forked and modified receivemidi to do exactly what you're looking for. My fork allows you to add "hooks" which are simply a command line argument like this: hook "cc 1 2 3 {command}".

You can find it here: https://github.com/essboyer/ReceiveMIDI

from receivemidi.

gbevin avatar gbevin commented on July 17, 2024

@dwojdak can you give me a few examples of what you would like to execute as commands?

from receivemidi.

tillhanke avatar tillhanke commented on July 17, 2024

I would like to do something similar with windows. I would like to write a script that issues a command if I press a Midi Button.
Under Linux @l0s script worked really good. But is there a way to do this under windows as well?

from receivemidi.

gbevin avatar gbevin commented on July 17, 2024

Can you describe exactly what you would like to do?

from receivemidi.

tillhanke avatar tillhanke commented on July 17, 2024

I am working with live streaming Blackmagic Equipment (ATEM Switcher) these are able to controll through powershell commands (stuff like cut, set preview, play media etc.)
I had the idea to just use my MIDI Board and send these commands everytime I press a designated button on the board. I wanted to just write a small script an run it in the background.

from receivemidi.

gbevin avatar gbevin commented on July 17, 2024

Could you give me concrete examples of which MIDI data you want to launch what kind of command with?

from receivemidi.

tillhanke avatar tillhanke commented on July 17, 2024

well easiest would be something like:

if ($buttontriggernumber -eq "1"){
  $me[0].Cut()
}
if ($buttontriggernumber -eq "2"){
  $me[0].Autotransition()
}

this could be called on every event from the midi board

from receivemidi.

gbevin avatar gbevin commented on July 17, 2024

I added support for executing JavaScript for each received MIDI message, and the JavaScript support includes launching an external command. This makes it possible to add any kind of conditions around the command execution and to provide the arguments any which way you want.

from receivemidi.

timtraversy avatar timtraversy commented on July 17, 2024

The JS Util commands are not working for me. I'm running:

receivemidi dev "MPD218" js "Util.println('hello');"

But the output is just the normal statements:

channel 10   note-on          C#2  71
channel 10   note-off         C#2   0
channel 10   note-on          C#2  56
channel 10   note-off         C#2   0
channel  1   control-change     9  24
channel  1   control-change     9  25
channel  1   control-change     9  26
channel  1   control-change     9  27
channel  1   control-change     9  28

from receivemidi.

gbevin avatar gbevin commented on July 17, 2024

@timtraversy Are you sure you're using the 1.1.0-beta1 version?

from receivemidi.

gbevin avatar gbevin commented on July 17, 2024

@timtraversy it works fine for me:

gbevin@sycamore ~ % receivemidi dev one js "Util.println('JavaScript got this: ' + MIDI.getDescription());"
JavaScript got this: Note on C1 Velocity 65 Channel 1
channel  1   note-on           C1  65
JavaScript got this: Note off C1 Velocity 105 Channel 1
channel  1   note-off          C1 105
JavaScript got this: Controller Data Entry (coarse): 108 Channel 1
channel  1   control-change     6 108
JavaScript got this: Controller Data Entry (fine): 69 Channel 1
channel  1   control-change    38  69
JavaScript got this: Controller Data Entry (coarse): 108 Channel 1
channel  1   control-change     6 108
JavaScript got this: Controller Data Entry (fine): 94 Channel 1
channel  1   control-change    38  94
JavaScript got this: Controller Data Entry (coarse): 108 Channel 1
channel  1   control-change     6 108
JavaScript got this: Controller Data Entry (fine): 103 Channel 1
channel  1   control-change    38 103

from receivemidi.

michaelsjackson avatar michaelsjackson commented on July 17, 2024

Here it works nicely as well, just compiled and tried today.

I would like to have interesting ideas here, what we could trigger via incoming midi events.

First thing I will try is using my k-boards 25 midi notes, for triggering various programs, independently of selected windows, which I see as the main advantage of midi event triggering.

Another interesting idea would be using a usb midi foot pedal (which I have to buy first, I have a huge mfb-1010, but this is not mobile, if you want to travel and take your foot controller with you, it has to be something small, suggestions are welcome), imagine using a foot pedal as "Control" key maybe, or "Esc" key. Or anything else which you need very frequently in some environment.
While working it DAWs (digital audio workstations, like Reaper) this could be useful for doing "fine value changes" while holding the pedal, and without pedal doing coarse changes.

Or using x360 joystick, via midi conversion first, its signals for controling various things, like zooming in out in some programs, like "eaglemode", or turning around objects in "blender".

Not sure where more fluid commands like cc or pitchbend could be used successfully? More for shifting effects maybe, like scrolling lines in a text editor, one needs to test how well this translates, e.g. in emacs or any other text editor.

from receivemidi.

Related Issues (20)

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.