Comments (14)
Please provide me with feedback about how well it works for you, I'm posting a beta release now.
from receivemidi.
@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.
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.
@dwojdak can you give me a few examples of what you would like to execute as commands?
from receivemidi.
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.
Can you describe exactly what you would like to do?
from receivemidi.
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.
Could you give me concrete examples of which MIDI data you want to launch what kind of command with?
from receivemidi.
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.
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.
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.
@timtraversy Are you sure you're using the 1.1.0-beta1 version?
from receivemidi.
@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.
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)
- Can't receive MIDI stream in Hex format HOT 1
- ReceiveOsc, SendOsc HOT 1
- Precompiled release of 1.1.0-beta1, for linux, would be useful HOT 1
- does util.command work on windows? HOT 1
- Triggering a script only when a specified sequence of midi notes are received? How? HOT 1
- Linux missing libraries. HOT 2
- Execute Shell Script HOT 1
- Commands from program file HOT 1
- MIDI Output shown instead
- output / input redirection on windows HOT 1
- Middle C displayed as C5 HOT 1
- Multiple devices with same name
- OSC instruction blockage when data volume is large HOT 1
- spy on midi out ports HOT 1
- Timeout receivemidi
- Receive multiple SysEx messages under Windows?
- Don't force march in the buildsystem HOT 1
- Dependencies for Ubuntu HOT 1
- Juce Timer runs with realtime priority from jackd settings HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from receivemidi.