Skip to main content
Topic: User Tool for Master Tuning (Read 5411 times) previous topic - next topic

User Tool for Master Tuning

NWC 2.75+ is required.
Code: (Lua) [Select · Download]
-- rg_MasterTune.lua ver 1.0 <http://nwsw.net/-f9239>
-- This NWC user tool can be used to set the Master Tuning.
-- Playing the Song it creates alters the Master Tuning.
-- The change affects all windows for the current NWC session.
-- Options: Returns File Text [x], Prompts for User Input [x]

local msg = 'Enter new tuning in semitones'
local opt = nwcut.prompt(msg, '#[-12,12]', 0)
if opt then
local userObj = '|User|MIDIParm.nw|LSB:2|DataMSB:' .. opt + 64
for _, channel in ipairs{1,2,3,4,5,6,7,8,9,11,12,13,14,15,16} do
nwcut.writeline('|AddStaff')
nwcut.writeline('|StaffProperties|Channel:' .. channel)
nwcut.writeline(userObj)
end
end
See: MIDI Non-Registered (and Registered) Parameters for some idea of why this works :)
Registered user since 1996

 

Re: User Tool for Master Tuning

Reply #1
That looks interesting, Rick.  But how do I use it?

MusicJohn, 6/Oct/15


Re: User Tool for Master Tuning

Reply #2
Add the quoted script to your user tools as a new file, taking note of the settings it recommends.

Start a new empty *.nwc file, then run this tool on it. It changes your empty file into a new file that, when played, alters the Master Tuning for your device.

You can also do this directly in a file using the MIDIParm.nw object type, such as:

Code: (nwc) [Select · Download]
!NoteWorthyComposerClip(2.75,Single)
|Clef|Type:Treble
|User|MIDIParm.nw|Pos:7|LSB:2|DataMSB:64
|Note|Dur:4th|Pos:0
|Note|Dur:4th|Pos:0
|Note|Dur:4th|Pos:0
|Note|Dur:4th|Pos:0
|Bar
|User|MIDIParm.nw|Pos:7|LSB:2|DataMSB:66
|Note|Dur:4th|Pos:0
|Note|Dur:4th|Pos:0
|Note|Dur:4th|Pos:0
|Note|Dur:4th|Pos:0
|User|MIDIParm.nw|Pos:7|LSB:2|DataMSB:64
!NoteWorthyComposerClip-End

Re: User Tool for Master Tuning

Reply #3
This also works:
Code: (Lua) [Select · Download]
-- rg_MasterTune.lua ver 1.10 <http://nwsw.net/-f9239>
-- This NWC user tool can be used to set the Master Tuning.
-- Playing the Song it creates alters the Master Tuning.
-- The change affects all windows for the current NWC session.
-- Options: Returns File Text [x], Prompts for User Input [x]

local msg = 'Enter new tuning in semitones'
local opt = nwcut.prompt(msg, '#[-64,63]', 0)
if not opt then return end

local s = [[
|AddStaff|Label:"ch %02d"
|StaffProperties|BoundaryTop:2|BoundaryBottom:2|Lines:0|Channel:%d
|User|MIDIParm.nw|Pos:-2.5|LSB:2|DataMSB:%d
]]
local t = {}
for i = 1, 16 do t[i] = opt + 64 end
t[10] = 64
for k, v in ipairs(t) do nwcut.write(s:format(k, k, v)) end
Registered user since 1996