SHWotever / SimHub

Multi sim dashboard, bass shaker driver, ....
http://www.simhubdash.com/
799 stars 98 forks source link

Plugins Notification Audio feedback #866

Closed Romainrob closed 2 years ago

Romainrob commented 3 years ago

Salut, J'ai une idée à ajouter à la pile. Je me remets à jouer en VR et comme je galère avec tout mes contrôles SimHub en aveugle, j'ai pensé à ça:

https://youtu.be/XHCNtCsoHys

J'ai utilisé System.Speech.Synthesis.SpeechSynthesizer et pour une fois c'était plus facile que prévu. Je l'ajoute à mon plugin de sons mais je pense que ça pourrait avoir du sens comme feature native à SimHub, surtout pour la VR. Juste une idée, comme d'hab, tu en fais ce que tu veux, ou rien du tout.

Bonne journée.

Ça ressemble à ça btw:

readonly System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer();

public void DataUpdate(PluginManager pluginManager, ref GameData data)
{
    pluginNotification_Active = (bool)pluginManager.GetPropertyValue("DataCorePlugin.PluginNotification_Active");
    pluginNotification_ActiveChanged = pluginNotification_Active != pluginNotification_ActiveOLD;
    pluginNotification_ActiveOLD = pluginNotification_Active;

    if (pluginNotification_Active)
    {
        pluginNotification_Title = (string)pluginManager.GetPropertyValue("DataCorePlugin.PluginNotification_Title");
        pluginNotification_Content = (string)pluginManager.GetPropertyValue("DataCorePlugin.PluginNotification_Content");
        pluginNotification_TitleChanged = pluginNotification_Title != pluginNotification_TitleOLD;
        pluginNotification_ContentChanged = pluginNotification_Content != pluginNotification_ContentOLD;
        pluginNotification_TitleOLD = pluginNotification_Title;
        pluginNotification_ContentOLD = pluginNotification_Content;

        if (pluginNotification_ActiveChanged || pluginNotification_TitleChanged || pluginNotification_ContentChanged)
        {
            PromptBuilder builder = new PromptBuilder(new System.Globalization.CultureInfo("en-US"));
            builder.AppendBreak(System.Speech.Synthesis.PromptBreak.ExtraSmall);
            builder.AppendText(pluginNotification_Content + pluginNotification_Title);
            synth.SpeakAsyncCancelAll();
            synth.SpeakAsync(builder);
        }
    }
}

public void End(PluginManager pluginManager)
{
    synth.Dispose();
}

public void Init(PluginManager pluginManager)
{
    synth.SetOutputToDefaultAudioDevice();
    synth.Volume = 100;
    synth.SelectVoiceByHints(System.Speech.Synthesis.VoiceGender.Female);
    synth.Rate = 2;
} 
SHWotever commented 3 years ago

Hello !

I already played in the past with speech synth but I admit I wasn't convinced by the voice, I will take another look !

Romainrob commented 3 years ago

Hi, I agree. The Windows voices aren't the best. The male one sounds particularly robotic. Also after trying it while driving the next day, I noticed the volume is quite low, even at 100% (compared to the mp3 voice samples I already use with my plugin at least). With the game volume at 100%, this won't do. It could be because I had my headset in surround mode too, now that I think of it. I'll have to try again. I liked the idea of using the built in voice of Windows for simplicity sake but it maybe better to look into alternatives. I haven't had the chance to dig deeper yet. I'll try to do so next week. Bonne journée.

bizibiz commented 2 years ago

Hello boys,

Is this discussion related to voice commands too ?

It should be great to test this kind of feature in SimHub. I consider SimHub as THE platform for adding effects to my simracing sessions. Best simracing alt software I ever use honestly.

I know that some programs exists but Simhub is for simRacing what Steam is for gaming lol.

Cheers.

Romainrob commented 2 years ago

Hi, I want SimHub to talk. You wan't to talk to it. I guess it's somewhat related :D I'm sure voice commands it yet another can of worms, but these would indeed be two complementary features.

I can see the appeal for using voice commands in SimHub. You actually probably already can have a voice command software do a lot via the command lines. https://github.com/SHWotever/SimHub/wiki/Command-line-interface.

For an update on the TTS situation on my end. I briefly searched for a TTS api, and quickly realized this was a jungle I wasn't equipped for... So, I'm still using the Windows voice. Regarding the voice volume, the surround mode of my previous headset was indeed making it sound much lower. I recently switched to a noise cancelling headset (very nice to reduce shakers background noises :D ) It doesn't have fake surround and, while still a bit low volume, the windows voice is loud enough to understand. I'll leave it there. Have a nice day!

SHWotever commented 2 years ago

Hello ! Malheureusement je pense que ce genre de fonctionnalités pourrais ètre interressante, mais en y ajoutant les problemes de localisation, de son, et avoir du contenu pour ces "annonces", ca deviendrais une vrai usine. Je prefère ne pas m'engager la dedans ;)

Romainrob commented 2 years ago

Salut! Pas de soucis, je comprends. For posterity sake, I'll mention that I've since added my solution based on the Windows voices to my "RSC - Sounds" plugin.

image

While it doesn't sound the best, it gets the job done. It shared here: https://www.simhubdash.com/community-2/dashboard-templates/romainrobs-collection/#post-1671