-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
samba
committed
Jul 20, 2024
1 parent
492d0c4
commit c02dbff
Showing
5 changed files
with
193 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
-- <command name="i7mfxtype" where="voicingStrategy" using="lua/voicings/inversion.lua"> | ||
-- set the mfx type for a part. | ||
-- </command> | ||
-- <param name="partId" optional="-1" type="1..16" type="number">the part number, will be detected via instrument channel if not set.</param> | ||
-- <param name="typeNr" type="0..67" type="number">the mfx type</param> | ||
-- <param name="toneType" type="[sna, sns, snd, pcms, pcmd]">the type of the tone on the target part</param> | ||
-- <param name="deviceId" optional="1" type="number">an alternative device id</param> | ||
|
||
require "lua/com/com" | ||
require "_model" | ||
require "_integra7" | ||
local i7p = require "i7parameter" | ||
|
||
parameters = { | ||
{ name="partId", default=-1 }, | ||
{ name="typeNr" }, | ||
{ name="toneType" }, | ||
{ name="deviceId", default=17 }, | ||
} | ||
|
||
local toneTypeMap = { | ||
sna = Mfx_Types.SNA, | ||
sns = Mfx_Types.SNS, | ||
snd = Mfx_Types.SND, | ||
pcms = Mfx_Types.PCMS, | ||
pcmd = Mfx_Types.PCMD | ||
} | ||
|
||
|
||
function execute(params, timeinfo, context) | ||
local part_ids = i7p.get_partids(params, context) | ||
local mfxType = toneTypeMap[params.toneType] | ||
if mfxType == nil then | ||
error("invalid tone type " .. params.toneType) | ||
end | ||
local typeNr = tonumber(params.typeNr) | ||
if typeNr < 0 or typeNr > 67 then | ||
error("typeNr out of bounds " .. typeNr) | ||
end | ||
local device_id = tonumber(params.deviceId) | ||
if device_id == nil or device_id < 17 or device_id > 32 then | ||
error("invalid device id: " .. device_id) | ||
end | ||
local messages = {} | ||
for _, part_id in pairs(part_ids) do | ||
local sysex = Get_Set_Mfx_Type_Messages(mfxType, part_id, typeNr, device_id) | ||
table.insert(messages, { -- set type | ||
["type"] = "sysex", | ||
["sysexData"] = sysex[2], | ||
}) | ||
-- table.insert(messages, { -- set default values | ||
-- ["type"] = "sysex", | ||
-- ["offset"] = -2, | ||
-- ["sysexData"] = sysex[2], | ||
-- }) | ||
end | ||
return messages | ||
end | ||
|
||
function perform(events, params, timeinfo, context) | ||
local messages = execute(params, timeinfo, context) | ||
for _, message in pairs(messages) do | ||
table.insert(events, message) | ||
end | ||
return events | ||
end | ||
|
||
return {execute = execute} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
-- <command name="i7sntcmod" where="voicingStrategy" using="lua/voicings/inversion.lua"> | ||
-- set a mod value for a sna tone type instrument | ||
-- </command> | ||
-- <param name="partId" optional="-1" type="1..16" type="number">the part number, will be detected via instrument channel if not set.</param> | ||
-- <param name="modNr" type="1..32" type="number">the mod number.</param> | ||
-- <param name="value" type="number">the value</param> | ||
-- <param name="deviceId" optional="1" type="number">an alternative device id</param> | ||
|
||
require "lua/com/com" | ||
local i7p = require "i7parameter" | ||
|
||
parameters = { | ||
{ name="partId", default=-1 }, | ||
{ name="modNr"}, | ||
{ name="value"}, | ||
{ name="deviceId", default=17 }, | ||
} | ||
|
||
local node_id_template = "PRM-_FPARTxxx-_SNTONE-_SNTC-SNTC_MOD_PRM%i" | ||
|
||
function execute(params, timeinfo, context) | ||
local modNr = tonumber(params.modNr) | ||
if modNr < 1 or modNr > 32 then | ||
error("modNr out of bounds " .. modNr) | ||
end | ||
params.parameterId = string.format(node_id_template, modNr) | ||
return i7p.execute(params, timeinfo, context) | ||
end | ||
|
||
function perform(events, params, timeinfo, context) | ||
local messages = execute(params, timeinfo, context) | ||
for _, message in pairs(messages) do | ||
table.insert(events, message) | ||
end | ||
return events | ||
end | ||
|
||
return {execute = execute} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-- #skip-event-plausibility-test | ||
using "/chords/default.chords"; | ||
using "../../examples/lua/devices/integra7/i7mfxtype.lua"; | ||
using "../../examples/lua/mods/myArpeggio.lua"; | ||
|
||
tempo: 150; | ||
device: MyDevice midi _useDevice="DIN 3"; | ||
instrumentDef:guitar _onDevice=MyDevice _ch=0; -- _pc=0 _bankMsb=89 _bankLsb=64 _pc=5; | ||
instrumentConf: guitar | ||
mod myArpeggio | ||
--mod i7mfxtype _toneType="sna" _typeNr=51 | ||
; | ||
|
||
|
||
[ | ||
instrument: guitar; | ||
{ | ||
r1 | | ||
/call: i7mfxtype _toneType="sna" _typeNr=51/ | ||
r1 | ||
} | ||
] | ||
|
||
[ | ||
type: template; | ||
name: chords; | ||
instrument: guitar; | ||
{ | ||
<II III V VII I>1 :(x3) | | ||
|: | ||
<I II III V VII>1 :(x3)| | ||
} | ||
] | ||
|
||
|
||
|
||
[ | ||
type: accomp; | ||
{ | ||
/template: chords/ | ||
r1 | r1 | | ||
C | F | G7 :(x10)| | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-- #skip-event-plausibility-test | ||
using "/chords/default.chords"; | ||
using "../../examples/lua/devices/integra7/i7sntcmod.lua"; | ||
using "../../examples/lua/mods/myArpeggio.lua"; | ||
|
||
tempo: 150; | ||
device: MyDevice midi _useDevice="DIN 3"; | ||
instrumentDef:guitar _onDevice=MyDevice _pc=0 _ch=6 _bankMsb=89 _bankLsb=64 _pc=97; | ||
instrumentConf: guitar | ||
mod myArpeggio | ||
; | ||
|
||
[ | ||
type: template; | ||
name: chords; | ||
instrument: guitar; | ||
{ | ||
/modOnce: i7sntcmod _modNr=10 _value=2/ | ||
<II III V VII I>1 :(x3) | ||
|: | ||
/modOnce: i7sntcmod _modNr=10 _value=1/ | ||
<I II III V VII>1 :(x3)| | ||
} | ||
] | ||
|
||
|
||
|
||
[ | ||
type: accomp; | ||
{ | ||
/template: chords/ | ||
C | F | G7 :| | ||
} | ||
] |