#hs.midi
MIDI Extension for Hammerspoon.
This extension supports listening, transmitting and synthesizing MIDI commands.
This extension was thrown together by Chris Hocking for CommandPost.
This extension uses MIKMIDI, an easy-to-use Objective-C MIDI library created by Andrew Madsen and developed by him and Chris Flesner of Mixed In Key.
MIKMIDI LICENSE: Copyright (c) 2013 Mixed In Key, LLC. Original author: Andrew R. Madsen (andrew@mixedinkey.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#API Overview
Constants - Useful values which cannot be changed
Functions - API calls offered directly by the extension
Constructors - API calls which return an object, typically one that offers API methods
Methods - API calls which can only be made on an object returned by a constructor
- callback
- displayName
- identityRequest
- isOnline
- isVirtual
- manufacturer
- model
- name
- sendCommand
- sendSysex
- synthesize
#API Documentation
#Constants
Signature | hs.midi.commandTypes[] |
Type | Constant |
Description | A table containing the numeric value for the possible flags returned by the commandType parameter of the callback function. |
Notes | None |
Source | extensions/midi/libmidi.m line 1511 |
#Functions
Signature | hs.midi.deviceCallback(callbackFn) -> none |
Type | Function |
Description | A callback that's triggered when a physical or virtual MIDI device is added or removed from the system. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/midi/libmidi.m line 341 |
Signature | hs.midi.devices() -> table |
Type | Function |
Description | Returns a table of currently connected physical MIDI devices. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/midi/libmidi.m line 299 |
Signature | hs.midi.virtualSources() -> table |
Type | Function |
Description | Returns a table of currently available Virtual MIDI sources. This includes devices, such as Native Instruments controllers which present as virtual endpoints rather than physical devices. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/midi/libmidi.m line 320 |
#Constructors
Signature | hs.midi.new(deviceName) -> hs.midi object |
Type | Constructor |
Description | Creates a new hs.midi object. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/midi/libmidi.m line 390 |
Signature | hs.midi.newVirtualSource(virtualSource) -> hs.midi object |
Type | Constructor |
Description | Creates a new hs.midi object. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/midi/libmidi.m line 417 |
#Methods
Signature | hs.midi:callback(callbackFn) |
Type | Method |
Description | Sets or removes a callback function for the hs.midi object. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/midi/libmidi.m line 446 |
Signature | hs.midi:displayName() -> string |
Type | Method |
Description | Returns the display name of a hs.midi object. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/midi/libmidi.m line 1421 |
Signature | hs.midi:identityRequest() -> none |
Type | Method |
Description | Sends an Identity Request message to the hs.midi device. You can use hs.midi:callback() to receive the systemExclusive response. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/midi/libmidi.m line 1341 |
Signature | hs.midi:isOnline() -> boolean |
Type | Method |
Description | Returns the online status of a hs.midi object. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/midi/libmidi.m line 1475 |
Signature | hs.midi:isVirtual() -> boolean |
Type | Method |
Description | Returns true if an hs.midi object is virtual, otherwise false . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/midi/libmidi.m line 1492 |
Signature | hs.midi:manufacturer() -> string |
Type | Method |
Description | Returns the manufacturer name of a hs.midi object. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/midi/libmidi.m line 1457 |
Signature | hs.midi:model() -> string |
Type | Method |
Description | Returns the model name of a hs.midi object. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/midi/libmidi.m line 1439 |
Signature | hs.midi:name() -> string |
Type | Method |
Description | Returns the name of a hs.midi object. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/midi/libmidi.m line 1403 |
Signature | hs.midi:sendCommand(commandType, metadata) -> boolean |
Type | Method |
Description | Sends a command to the hs.midi object. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/midi/libmidi.m line 1031 |
Signature | hs.midi:sendSysex(command) -> none |
Type | Method |
Description | Sends a System Exclusive Command to the hs.midi object. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/midi/libmidi.m line 1009 |
Signature | hs.midi:synthesize([value]) -> boolean |
Type | Method |
Description | Set or display whether or not the MIDI device should synthesize audio on your computer. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/midi/libmidi.m line 1375 |