Skip to content

Cannot get correct value of parameters in automation curve #2

@kirliavc

Description

@kirliavc

I'm developing a script to copy all parameters from one track to another, and the code is shown below.

function copyParams(sourceTrack, targetTrack){
  var sourceNoteGroup = SV.getProject().getTrack(sourceTrack).getGroupReference(0).getTarget();
  var targetNoteGroup = SV.getProject().getTrack(targetTrack).getGroupReference(0).getTarget();
  var paramNames = ["pitchDelta","vibratoEnv","loudness","tension","breathiness","voicing","gender"];
  for(var id in paramNames){
    var paramName = paramNames[id];
    targetNoteGroup.getParameter(paramName).removeAll();
    var params = sourceNoteGroup.getParameter(paramName).getAllPoints();
    SV.setHostClipboard(params.toString());
    for(var id2 in params){
      var item = params[id2];
      targetNoteGroup.getParameter(paramName).add(item[0], item[1]);
    }
  }
}

There are two problems:
When paramName is pitchDelta, the param value becomes extremely large(near 2^32) when the value is smaller than zero. So probably the unsigned/signed conversion fails.
When paramName is Tension, the param value always get zero. I think the problem is also about number conversion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions