deiteris / voice-changer

リアルタイムボイスチェンジャー Realtime Voice Changer
Other
39 stars 7 forks source link

[REQUEST]: Connecting to another machine (server) #180

Closed MagicalNET closed 1 month ago

MagicalNET commented 1 month ago

In a few words, describe your idea

Connecting to secondary machines or virtual machines

More information

It would be nice to have an option to host this on IP: 0.0.0.0, or 192.168.x.x. That way I can utilize Virtual Servers or secondary machines in my house as an host. Not sure if possible already.

crichu894 commented 1 month ago

I'd like to be able to use the VoiceChanger I have on my PC when I'm away from home. I tried running it from the source code, installing the dependencies, and it works just as well as the precompiled version. I tried modifying the following files:

I replaced the lines that have 127.0.0.1 with 0.0.0.0 so that it listens on all interfaces. However, even though I have the ports and DDNS configured correctly, it only works on 127.0.0.1.

I really hope this feature can be implemented. It would be very useful, for example, to run more than one remote instance of VoiceChanger if the GPU and available hardware resources support it. Oh, I'd be so happy!

deiteris commented 1 month ago

Hi @crichu894, @MagicalNET,

Actually you can, though it's currently undocumented since it's rarely used, but Kaggle and Colab use this method. What you can do is to create a file named .env near MMVCServerSIO.exe and specify the following settings:

# The interface to listen to. You can specify either 0.0.0.0 to listen on all interfaces or an address of specific interface.
HOST='<ip_address>' 
# The origin must be a valid URL! I.e. https://192.168.0.1:18888. Multiple values may be specified if you want to have access from several origins. Your local host (127.0.0.1:18888) is allowed by default.
ALLOWED_ORIGINS='["https://<ip_address>:<port>"]'
# In case you may want to also change the port, there's an option for it too.
PORT='18888'

To start the voice changer in HTTPS mode, you can create a batch file that will run the voice changer without opening the browser and in HTTPS mode:

@echo off
MMVCServerSIO.exe --launch-browser false --https true
pause

After it starts, you should be able to open the link. For example, if you specified HOST=192.168.0.1 and ALLOWED_ORIGINS='["https://192.168.0.1:18888"]'), you should be able to open https://192.168.0.1:18888 in your browser and use the voice changer UI from other machines in your local network.

In case you might wonder why it is a bit more complicated than in the original, it is because of the security. Here it is restricted to 127.0.0.1 by default. The original version listens (or at least used to listen) on 0.0.0.0 by default so anyone on your network could connect. It also allowed connections from any origin, so you could visit a web page that could potentially communicate with your voice changer and make possibly malicious requests.

MagicalNET commented 1 month ago

I like more advanced settings like this, its good and not as sloppy like the original. Thanks for this, I'll give it a test.