Copy/Paste Vibrato Script Question

Hi! I’ve been looking through as many documents and forum topics that I can find, but I couldn’t quite find the answer I was looking for.

I’ve downloaded Claire’s Copy Vibrato & Paste Vibrato scripts. I was under the assumption that it would copy the Vibrato properties for all of the notes I selected, but, when I paste it on another set of the same amount of notes, only the Vibrato properties from the first note selected is pasted.

All my Vibrato editing is done in the Note Properties.

Is the script working as intended? Is it only supposed to copy the properties for one note? If it is, is there something I could add to the script to make it copy the properties for all the notes I’ve selected? It would make it much easier on my poor hands. I am currently using Pro Edition 1.11.0b2, if it somehow might be a bug.

If any extra clarification is needed, please let me know! And thank you for any help. :blush: (and sorry if i misread something somewhere and it clearly states it only copy/pastes for one note :sob:)

1 Like

Hi,

I have not used the script myself, but had a look at the code.

From https://github.com/claire-west/svstudio-scripts/blob/5f095fa00f565f9016a8ef88d1b28c5739f4b27e/hotkey-scripts/CopyVibrato.js#L23 it looks like indeed only the first note ([0]) is copied.

Adapting it might be possible I think, but requires putting the vibrato parameters from all notes as JSON on the clipboard (and I don’t know if there is a limitation there).

You would also need to do the “reverse” again in https://github.com/claire-west/svstudio-scripts/blob/5f095fa00f565f9016a8ef88d1b28c5739f4b27e/hotkey-scripts/PasteVibrato.js#L26 as it expects one vibrato setting and currently pastes that to each selected note.

Hope this helps, Jeroen

2 Likes

Thank you!

My knowledge of scripting is very very non-existent, but maybe if I squint hard enough I can… try to figure something out. Maybe I’ll compare with some other scripts that have some copying/pasting properties and see if it’s possible.They’re short enough that I can understand the gist.:thinking:

Time to make some copies of the script and do some testing. Wish me luck!

Edit: I have no clue what I’m doing but gosh if i ain’t trying

These scripts are by Claire, who is a member here. Invite her to this discussion :wink:

1 Like

You can try these two modified versions. Bear in mind that I’m not currently at a computer with access to SynthV Studio Pro, so they haven’t been tested yet (will update this post once I have verified they work as expected).

/** CopyVibrato.js
 * Copies the selected notes' vibrato slider settings (from the Note Properties panel, only in Manual Pitch Mode) to the clipboard
 */
var SCRIPT_TITLE = "Copy Vibrato";

function getClientInfo() {
  return {
    "name": SV.T(SCRIPT_TITLE),
    "category": "Claire's Scripts - Hotkey Scripts",
    "author": "https://github.com/claire-west/svstudio-scripts",
    "versionNumber": 2,
    "minEditorVersion": 65537
  }
}

function copyVibratoToClipboard() {
  var editorView = SV.getMainEditor();
  var selection = editorView.getSelection();
  var selectedNotes = selection.getSelectedNotes();
  if (selectedNotes.length == 0) {
    return;
  }

  var noteVibrato = [];
  for (var i = 0; i < selectedNotes.length; i++) {
    var attributes = selectedNotes[i].getAttributes();

    var vibrato = {
      tF0VbrStart: attributes.tF0VbrStart,
      tF0VbrLeft: attributes.tF0VbrLeft,
      tF0VbrRight: attributes.tF0VbrRight,
      dF0Vbr: attributes.dF0Vbr,
      pF0Vbr: attributes.pF0Vbr,
      fF0Vbr: attributes.fF0Vbr,
    };

    noteVibrato.push(vibrato);
  }

  SV.setHostClipboard(JSON.stringify(noteVibrato));
}

function main() {
  copyVibratoToClipboard();
  SV.finish();
}
/** PasteVibrato.js
 * Paste the vibrato settings copied with CopyVibrato.js to the selected notes
 */
var SCRIPT_TITLE = "Paste Vibrato";

function getClientInfo() {
  return {
    "name": SV.T(SCRIPT_TITLE),
    "category": "Claire's Scripts - Hotkey Scripts",
    "author": "https://github.com/claire-west/svstudio-scripts",
    "versionNumber": 2,
    "minEditorVersion": 65537
  }
}

function pasteVibratoToNotes() {
  var editorView = SV.getMainEditor();
  var selection = editorView.getSelection();
  var selectedNotes = selection.getSelectedNotes();
  if (selectedNotes.length == 0) {
    return;
  }

  var vibrato = JSON.parse(SV.getHostClipboard());

  // if only one note was copied, apply the same settings to all selected notes
  if (vibrato.length === 1) {
    for (var i = 0; i < selectedNotes.length; i++) {
      selectedNotes[i].setAttributes(vibrato[0]);
    }
  } else {
  // if multiple notes were copied, apply them in order until either no more settings are available or no more selected notes are present
    for (var i = 0; i < selectedNotes.length; i++) {
      if (vibrato[i]) {
        selectedNotes[i].setAttributes(vibrato[i]);
      } else { break; }
    }
  }
}

function main() {
  pasteVibratoToNotes();
  SV.finish();
}
5 Likes

Oh gosh, thank you so so much!! It seems to be working just fine, as far as I can tell!

Thank you!! :face_holding_back_tears:

1 Like