Vibrator On/Off Commands

Hi!

So I’m trying to make Cock Hero work with a vibrator.

Example: https://pornhub.com/view_video.php?viewkey=ph580bd9ee1a077

The main problem is that Syncydink is interpolating the individual positions in a funscript which doesent really make sense for a vibrator. So I thought for every position in a funscript, I’ll have the vibrator on for 100ms and then off again until the next element in the funscript comes. However, it doesen’t really work,

private static FunscriptToSingleMotorVibrateCommands(aCommands: FunscriptCommand[]):
Map<number, ButtplugDeviceMessage[]> {
let lastTime: number = 0;

const commands: Map<number, ButtplugDeviceMessage[]> = new Map();
const beatLength = 100;

let currentTime: number;

for (const aCommand of aCommands) {
  if (lastTime < 0) {
    lastTime = aCommand.Time;
    continue;
  }
  currentTime = aCommand.Time;

  // Start Beat
  commands.set(currentTime, [ new SingleMotorVibrateCmd(1.0) ]);

  // Stop Beat
  commands.set(currentTime + beatLength, [ new StopDeviceCmd() ]);

  lastTime = currentTime;
}

// Make sure we stop the vibrator at the end
commands.set(lastTime + 100, [new SingleMotorVibrateCmd(0)]);
console.log(commands);
return commands;

}

Can you be more specific about which parts aren’t working?

Sure.

For testing purposes I’m using the following funscript:

{
    "version": "1.0",
    "inverted": false,
    "range": 90,
    "actions": [
        {
            "pos": 95,
            "at": 0
        },
        {
            "pos": 95,
            "at": 2000
        },
        {
            "pos": 95,
            "at": 4000
        }
    ]
}

Together with the above function, this should generate three 100ms vibrations. The above function spits out something like this:

0 -> SingleMotorVibrateCmd(1.0)
100 -> StopDeviceCmd()
2000 -> SingleMotorVibrateCmd(1.0)
2100 -> StopDeviceCmd()
4000 -> SingleMotorVibrateCmd(1.0)
4100 -> StopDeviceCmd()

However, the Domi starts to vibrate a little delayed and then just says at 1.0 the whole time until at about 4100ms

If I get this to work, expect a pull request with a new flag “Beat Mode” or something like that.

Yes its hacky but if I use the following:

  // Stop Beat
  commands.set(currentTime + beatLength, [ new StopDeviceCmd() ]);
  commands.set(currentTime + 2 * beatLength, [ new StopDeviceCmd() ]);
  commands.set(currentTime + 3 * beatLength, [ new StopDeviceCmd() ]);
  commands.set(currentTime + 4 * beatLength, [ new StopDeviceCmd() ]);
  commands.set(currentTime + 5 * beatLength, [ new StopDeviceCmd() ]);

With the above funscript, I get three 100ms vibrations. Is there some issue with sending the commands or the device not receiving them?

It might possibly be a BLE speed issue, yes. BLE can be really slow in some cases.

What OS/Browser are you using Syncydink on, and are you using Intiface Desktop or just WebBluetooth (in-browser/“connect local”)?

I’m using WebBluetooth on Chrome/OSX. Is Initface faster? If so, how can I set it up?

Ok, well, you’re at least using WebBluetooth on the best platform for it, heh.

Not quite sure how much faster it’ll be, but if you wanna try intiface desktop, it’s at https://intiface.com/desktop.

Once you’ve got it set up and the server running, use websockets in chrome and connect to ws://localhost:12345 (don’t use wss, means you can bypass the self signed cert setup, Chrome allows mixed context websockets on localhost).