Ramp Speed AyvaScript

This simple script ramps a stroke from one speed to another in Ayva Stroker Lite.

Here is a video demonstration with the default parameters:

Here is the JSON file you can use to import this routine directly into Ayva Stroker:
ramp-stroke.json (1.1 KB)

The source code is included at the end of this post for your convenience (you can also view the source in Ayva Stroker after importing as well).

There are parameters at the top of the script that can be customized to change the behavior to your liking:

  • stroke: The name or config of the stroke you want to ramp. This can be a custom or library pattern.
  • startBpm: The bpm to start at.
  • endBpm: The bpm to end at.
  • startDuration: The start transition time in seconds.
  • duration: How long it takes to ramp to the final bpm in seconds.
  • endDuration: How long to stay at the final bpm before ending the script (only applicable when the script is activated in Free Play mode. In manual mode the script will stay at the final bpm forever).

When this script is randomly selected in Free Play mode, Ayva will smoothly transition into the stroke and relinquish control after the script finishes.

To learn more about AyvaScripts and how to create or use them, see the AyvaScript Documentation.

If you like my work, please consider supporting me through Patreon.

Thank You and Happy Stroking! :heart:


Ramp Speed AyvaScript Source Code:

/**
 * Customizable Parameters.
 */
const stroke = 'long-stroke-1';
const startBpm = 10;
const endBpm = 200;
const startDuration = 2;
const duration = 10;
const endDuration = 5;

/**
 * Create the BPM Provider and timer.
 */
const bpmProvider = () => {
  const bpmTimer = bpmProvider.timer || new VariableDuration(duration);
  bpmProvider.timer = bpmTimer;

  return Ayva.map(bpmTimer.percentage, 0, 1, startBpm, endBpm);
};

const timer = new VariableDuration(startDuration + duration + endDuration);

/**
 * Create the stroke.
 */
let nextStroke;
if (GLOBALS.input) {
  nextStroke = GLOBALS.input.transition(stroke, bpmProvider, startDuration);
} else {
  nextStroke = new TempestStroke(stroke, bpmProvider).bind(ayva);
  yield* nextStroke.start({ duration: 0.5 });
}

GLOBALS.output = nextStroke;

/**
 * Main Loop
 */

while (!timer.complete || GLOBALS.mode === 'manual') {
  yield nextStroke.next();
}

this.complete = true;

2 Likes

This is a great project. I have forked this repository and I am researching how to output tcode while also output funscript files. Some actions are very interesting, and I think they can serve as a reference for funscript maker, especially for multi axis motion

3 Likes