Looking for Software to Filter the Signal to Intiface

I use Intiface as I assume most do, and I’ve been looking all over for what I assume to be a pretty simple application, but I can’t find it.

I want to be able to modify the signal being sent to the toy in real time, effectively filtering the signal in some way. Like being able to invert the signal, smooth transitions, limit it to a maximum or minimum, convert a ‘vibration’ signal to a linear ‘stroker’ signal, or vice-versa, that kinda thing.

I imagine it would step ‘between’ the intiface server and the toy, or between the intiface client and server. AFAIK either should work.

If anyone can point me in the right direction that would be great!

I made such a thing for my personal use, but I don’t use a stroker, so in this case it modifies intensity instead of position or other stroker stuff. Also, most of the things you listed I think you can already do in MultiFunPlayer, so if that’s all you want to do you might not have to do something custom and can just use MultiFunPlayer.

But this is a possible basic layout in Python (I forgot which imports are actually needed), you can uncomment the prints to look at what your software is trying to send to Intiface and then use the appropriate regex to modify it.

import re
import socket
import asyncio
import sys
import time
from websockets import serve
from websockets import connect
import urllib.request
import threading

class Thingy:
    async def main(self):
        # connect software via port 1234 instead of 12345
        async with serve(self.serverhandler, "localhost", 1234):
            await asyncio.get_running_loop().create_future()

	def intensityhandler(self, intensity):
		# example usage
		return 1.5 * intensity

    def intstring(self, intensity):
        length = 40
        if intensity > 0:
            intensity = max(intensity, 1.0/length * 1.5)
        return "#" * int(length * intensity) + "." * int(length * (1.0 - intensity))

    async def clienthandler(self):
        print("Started Intiface client")
        async for message in self.intiface:
            # print("From Intiface to MFP: " + message)
            await self.multifunplayer.send(message)
            # print("--> sent to MFP")

    async def serverhandler(self, mfp):
        print("Started MFP server")
        self.multifunplayer = mfp
        while True:
            async for message in self.multifunplayer:
                if self.intiface == None:
                    print("Received first message, connecting to Intiface")
                    self.intiface = await connect("ws://localhost:12345")
                    asyncio.get_running_loop().create_task(self.clienthandler())
                    
                # print("From MFP to Intiface: " + message)
                pattern = "(?<=\"Scalar\":)\\d+\\.\\d+"
                m = re.search(pattern, message)
                if m != None:
                    intensity = float(m.group(0))
                    oldintensity = intensity
                    intensity = self.intensityhandler(intensity)
                    message = re.sub(pattern, str(float(intensity)), message)
                    # print(self.intstring(oldintensity) + " -> " + self.intstring(intensity))
                    # print("--> modified: " + message)
                await self.intiface.send(message)
                # print("--> sent to Intiface")
			
async def main():
    thingy = Thingy()
    await thingy.main()

asyncio.run(main())
2 Likes

Thank you so much that’s a great starting point!

I also don’t use a stroker, and that’s part of the issue. For some games that have intiface support, sometimes they send signals that don’t map well to a non-stroking device so the hope is to take the signal, filter it to be more usable, then pass it on.

I assume the expected usage is just to run this python file and connect to it via the 1234 port instead of intiface? Like it goes [software signal] > [this script] > [intiface] > [toy] ?

So if I have an idea, let’s make an Agent. We just need to tell him to reverse the processing from a certain time to another time, and then he will handle it for you. In this way, we don’t need to operate the software anymore, which would be better, right?

Would anyone use a more agentic editor if I made one?

Sorry but you’re asking the wrong person here. I despise GenAI and what it has done to many parts of our society.

I won’t bother you with a rant about the ethical environmental and practical misgivings I have - suffice it to say, I’m not interested anyway.

1 Like

Yes it should work like that, although you don’t get the information of what comes next, so I’m not sure what a good method would be to convert things to a more suitable output in real-time when all you get in a message is a number between 0 and 1.

What you could also do is batch-convert funscripts in advance (if you’re talking about Edi games, they should be included in one of the folders). However what constitutes a good translation from stroker script to intensity script is also a matter of preference and the peculiarities of each script. One approach is translating downwards velocity to intensity, something like this: How to get that "burst" effect? Although I guess it would need to be expanded to account for scripts that don’t just go up and down but also have curves

1 Like

Yeah there’s no scripts, messages are sent in real time relating to the game state. The game accounts for both vibrators and strokers, but for vibrators (my preferred format) it does not… work well. The implementation is not great, imo. It skips over some actions, presumably for the purpose of simplifying messages to a vibrator, though I don’t see why, a vibrator can change it’s intensity much faster than a stroker can go from min-max, but whatever.

Anyway what I’m hoping to achieve is to intercept the more detailed stroker-targeted LinearCmd messages and convert them to an appropriateScalarCmd for the vibrator. And I think I nearly have it now, you saved me many hours of figuring out what was or wasn’t possible! :heart:

Not to mention my Python is quite unpracticed.