Skip to content

Instantly share code, notes, and snippets.

@skitaoka
Created July 16, 2023 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skitaoka/a03e5acf18b3c5d6db210b320f47dfba to your computer and use it in GitHub Desktop.
Save skitaoka/a03e5acf18b3c5d6db210b320f47dfba to your computer and use it in GitHub Desktop.
31平均律に調律するための Synthesizer V 用のスクリプト
/**
* 31EDO+1: 基準から 1 ステップ上げた調律。キー 2 のショートカットに登録する。
*/
const SCRIPT_TITLE = "[SK] 31 EDO: +1";
const SCRIPT_CATEGORY = "[SK]";
const SCRIPT_AUTHOR = "Shinya Kitaoka / skitaoka@gmail.com";
const tune_amount = [48.387, 25.806, 41.935, 19.355, 35.484, 51.613, 29.032, 45.161, 22.581, 38.710, 16.129, 32.258]
function getClientInfo() {
return {
"name" : SV.T(SCRIPT_TITLE),
"category": SV.T(SCRIPT_CATEGORY),
"author" : SV.T(SCRIPT_AUTHOR),
"versionNumber" : 1,
"minEditorVersion" : 65537
};
}
function getTranslations(langCode) {
switch (langCode) {
case "ja-jp":
return [
[SCRIPT_TITLE, "[SK] 31 EDO: +1"],
[SCRIPT_AUTHOR, "北岡伸也 / skitaoka@gmail.com"],
];
default:
return [];
}
}
function main() {
const mainEditor = SV.getMainEditor();
const selection = mainEditor.getSelection();
const notes = selection.getSelectedNotes();
const currentGroupRef = mainEditor.getCurrentGroup();
const pitches = currentGroupRef.getTarget().getParameter("pitchDelta");
notes.forEach(function(note) {
const left = currentGroupRef.getOnset() + note.getOnset();
const right = currentGroupRef.getOnset() + note.getEnd();
pitches.remove(left, right - 1);
pitches.add(left, tune_amount[note.getPitch() % 12]);
pitches.add(right - 1, tune_amount[note.getPitch() % 12]);
});
SV.finish();
}
/**
* 31EDO-1: 基準から 1 ステップ下げた調律。キー 3 のショートカットに登録する。
*/
const SCRIPT_TITLE = "[SK] 31 EDO: -1";
const SCRIPT_CATEGORY = "[SK]";
const SCRIPT_AUTHOR = "Shinya Kitaoka / skitaoka@gmail.com";
const tune_amount = [-29.032, -51.613, -35.484, -58.065, -41.935, -25.806, -48.387, -32.258, -54.839, -38.710, -61.290, -45.161]
function getClientInfo() {
return {
"name" : SV.T(SCRIPT_TITLE),
"category": SV.T(SCRIPT_CATEGORY),
"author" : SV.T(SCRIPT_AUTHOR),
"versionNumber" : 1,
"minEditorVersion" : 65537
};
}
function getTranslations(langCode) {
switch (langCode) {
case "ja-jp":
return [
[SCRIPT_TITLE, "[SK] 31 EDO: -1"],
[SCRIPT_AUTHOR, "北岡伸也 / skitaoka@gmail.com"],
];
default:
return [];
}
}
function main() {
const mainEditor = SV.getMainEditor();
const selection = mainEditor.getSelection();
const notes = selection.getSelectedNotes();
const currentGroupRef = mainEditor.getCurrentGroup();
const pitches = currentGroupRef.getTarget().getParameter("pitchDelta");
notes.forEach(function(note) {
const left = currentGroupRef.getOnset() + note.getOnset();
const right = currentGroupRef.getOnset() + note.getEnd();
pitches.remove(left, right - 1);
pitches.add(left, tune_amount[note.getPitch() % 12]);
pitches.add(right - 1, tune_amount[note.getPitch() % 12]);
});
SV.finish();
}
/**
* 31EDO±0: 基準の調律。キー 1 のショートカットに登録する。
*/
const SCRIPT_TITLE = "[SK] 31 EDO: ±0";
const SCRIPT_CATEGORY = "[SK]";
const SCRIPT_AUTHOR = "Shinya Kitaoka / skitaoka@gmail.com";
const tune_amount = [9.677, -12.903, 3.226, -19.355, -3.226, 12.903, -9.677, 6.452, -16.129, 0, -22.581, -6.452]
function getClientInfo() {
return {
"name" : SV.T(SCRIPT_TITLE),
"category": SV.T(SCRIPT_CATEGORY),
"author" : SV.T(SCRIPT_AUTHOR),
"versionNumber" : 1,
"minEditorVersion" : 65537
};
}
function getTranslations(langCode) {
switch (langCode) {
case "ja-jp":
return [
[SCRIPT_TITLE, "[SK] 31 EDO: ±0"],
[SCRIPT_AUTHOR, "北岡伸也 / skitaoka@gmail.com"],
];
default:
return [];
}
}
function main() {
const mainEditor = SV.getMainEditor();
const selection = mainEditor.getSelection();
const notes = selection.getSelectedNotes();
const currentGroupRef = mainEditor.getCurrentGroup();
const pitches = currentGroupRef.getTarget().getParameter("pitchDelta");
notes.forEach(function(note) {
const left = currentGroupRef.getOnset() + note.getOnset();
const right = currentGroupRef.getOnset() + note.getEnd();
pitches.remove(left, right - 1);
pitches.add(left, tune_amount[note.getPitch() % 12]);
pitches.add(right - 1, tune_amount[note.getPitch() % 12]);
});
SV.finish();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment