NoteWorthy Composer Forum

Forums => Tips & Tricks => User Tools => Topic started by: Rick G. on 2015-10-05 09:51 pm

Title: User Tool for Master Tuning
Post by: Rick G. on 2015-10-05 09:51 pm
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 (http://www.philrees.co.uk/nrpnq.htm) for some idea of why this works :)
Title: Re: User Tool for Master Tuning
Post by: MusicJohn on 2015-10-06 09:45 am
That looks interesting, Rick.  But how do I use it?

MusicJohn, 6/Oct/15

Title: Re: User Tool for Master Tuning
Post by: NoteWorthy Online on 2015-10-06 10:21 am
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
Title: Re: User Tool for Master Tuning
Post by: Rick G. on 2015-10-06 11:34 pm
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