Jump to content

Introducing DCS Simple Text To Speech (DCS-STTS)


Recommended Posts

This project aims to allow multiplayer mission designers (clients dont need to do anything) to easily embed live text to speech over SRS into their missions or play specified MP3s (radio station, background AI wingman chatter etc).

 

Its a very powerful tool and already in use on the popular BlueFlag server - powering their automated AI GCI over the SRS (SimpleRadio Standalone) mod.

 

Full setup instructions here: https://github.com/ciribob/DCS-SimpleTextToSpeech

 

I've recorded a quick demo showing:

  • Playing an MP3 over a set frequency - and triggering it with a trigger
  • Using the Text to Speech function to read out something

 

And i'll upload the demo shortly.

 

STTS.TextToSpeech("Hello DCS WORLD","251","AM","1.0","SRS",2)

 

Arguments in order are:
 - Message to say, make sure not to use a newline (\n) !
 - Frequency in MHz
 - Modulation - AM/FM
 - Volume - 1.0 max, 0.5 half
 - Name of the transmitter - ATC, RockFM etc
 - Coalition - 0 spectator, 1 red 2 blue

 This example will say the words "Hello DCS WORLD" on 251 MHz AM at maximum volume with a client called SRS and to the Blue coalition only
 

STTS.TextToSpeech("Microsoft russian female text to speech","251","AM","1.0","SRS",2,null,1,"female","ru-RU","Microsoft Irina Desktop")


 
  Arguments in order are:
 - Message to say, make sure not to use a newline (\n) !
 - Frequency in MHz
 - Modulation - AM/FM
 - Volume - 1.0 max, 0.5 half
 - Name of the transmitter - ATC, RockFM etc
 - Coalition - 0 spectator, 1 red 2 blue
 - Position of the transmitter - null so igored
 - Speed of the voice - 1 being normal
 - Gender of the voice
 - Locale of the voice
 - Name of the specific voice


 This example will say the words "Microsoft russian female text to speech" on 251 MHz AM at maximum volume with a client called SRS and to the Blue coalition only using the Microsoft TTS engine with the specified voice
 

  STTS.TextToSpeech("Google Text to Speech","251","AM","1.0","SRS",2,null,1,"female","cz-CZ","cs-CZ-Wavenet-A",true)


 
 Arguments in order are:
 - Message to say, make sure not to use a newline (\n) !
 - Frequency in MHz
 - Modulation - AM/FM
 - Volume - 1.0 max, 0.5 half
 - Name of the transmitter - ATC, RockFM etc
 - Coalition - 0 spectator, 1 red 2 blue
 - Position of the transmitter - null so igored
 - Speed of the voice - 1 being normal
 - Gender of the voice
 - Locale of the voice
 - Name of the specific voice
 - Use Google Text to Speech

 This example will say the words "Google Text to Speech" on 251 MHz AM at maximum volume with a client called SRS and to the Blue coalition only using a specifc Google TTS voice. You will need to setup a Google App Engine project and set the STTS script to point the correct location of the Google Credentials
 

STTS.TextToSpeech("Hello DCS WORLD","251","AM","1.0","SRS",2,Unit.getByName("RADIO"):getPoint())

 

Arguments in order are:
 - Message to say, make sure not to use a newline (\n) !
 - Frequency in MHz
 - Modulation - AM/FM
 - Volume - 1.0 max, 0.5 half
 - Name of the transmitter - ATC, RockFM etc
 - Coalition - 0 spectator, 1 red 2 blue

 This example will say the words "Hello DCS WORLD" on 251 MHz AM at maximum volume with a client called SRS and to the Blue coalition only with the location of the transmission set to the location of a unit called "RADIO". This will respect Line of Sight and Distance Limitations if enabled

STTS.PlayMP3("C:\\Users\\Ciaran\\Downloads\\PR-Music.ogg","255,31","AM,FM","0.5","Multiple",0)

 

Arguments in order are:
 - FULL path to the MP3 or Ogg audio to play
 - Frequency in MHz - to use multiple separate with a comma - Number of frequencies MUST match number of Modulations
 - Modulation - AM/FM - to use multiple
 - Volume - 1.0 max, 0.5 half
 - Name of the transmitter - ATC, RockFM etc
 - Coalition - 0 spectator, 1 red 2 blue

This will play that MP3 on 255MHz AM & 31 FM at half volume with a client called "Multiple" and to Spectators only

 

 STTS.PlayMP3("C:\\Users\\Ciaran\\Downloads\\PR-Music.mp3","255,31","AM,FM","0.5","Multiple",2,Unit.getByName("RADIO"):getPoint())

 

Arguments in order are:
 - FULL path to the MP3 to play
 - Frequency in MHz - to use multiple separate with a comma - Number of frequencies MUST match number of Modulations
 - Modulation - AM/FM - to use multiple
 - Volume - 1.0 max, 0.5 half
 - Name of the transmitter - ATC, RockFM etc
 - Coalition - 0 spectator, 1 red 2 blue

This will play that MP3 on 255MHz AM & 31 FM at half volume with a client called "Multiple" and to Spectators only with the location of the transmission set to the location of a unit called "RADIO". This will respect Line of Sight and Distance Limitations if enabled

 

Example of a transmission with position:

 

 

 


Edited by Ciribob
  • Like 4
  • Thanks 4

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

 

Example mission attached from the video - make the changes below to see it work

 

YOU WILL NEED TO FOLLOW THE INSTRUCTIONS ON GITHUB STILL AND MAKE THE CHANGES BELOW

 

 

Three calls used by the mission

STTS.TextToSpeech("Enemy units located near the airfield","251","AM","1.0","SRS",2)

STTS.TextToSpeech("C:\\Users\\Ciaran\\Downloads\\hard-sell-hotel.mp3","30","FM","1.0","SRS",2)

STTS.TextToSpeech("All Enemies Destroyed! Well done! ","251","AM","1.0","SRS",2)

SRS-STTS-Text.miz


Edited by Ciribob
  • Like 4
  • Thanks 3

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

37 minutes ago, HILOK said:

great stuff, thanks, ciribob 👍

i wonder, if the script could handle strings also (instead of plain text)?

 

not sure I quite follow - it does handle strings?

 

local someString = "All Enemies Destroyed! Well done! "

STTS.TextToSpeech(someString,"251","AM","1.0","SRS",2)

 

would work

  • Like 1

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

58 minutes ago, HILOK said:

yep, exactly what i meant! 😁

quite frankly, i was thinking that could allow adding dynamic voice-overs to your great jtac script ? 😇

 

Sure it could be 🙂 

 

Maybe one day!

  • Like 1

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

@kreisch its based on the microsoft APIs built into windows

This blog gives a good overview: https://docs.microsoft.com/en-us/archive/msdn-magazine/2019/june/speech-text-to-speech-synthesis-in-net

If you install more language packs I could make them available with a future update

 

Currently its hard-coded to female - english

  • Like 1
  • Thanks 1

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

This is amazing and my team is already having a great time with it!

 

I'm wondering if there's a way you could support ogg as well other than MP3 since mission designers may be forced to have to convert and duplicate their files that they use in DCS.

"Through The Inferno"

Endless, Dynamic, Open-World Experience for DCS World
Link to comment
Share on other sites

Could be done without too much difficulty I think. It would need an SRS update though as the external audio feature is part of SRS itself and tied to those releases

If you PM me or add me to your TTI Dev channel I can give you a special build ahead of time though

If you're using it heavily there are some hidden features you can enable too like voice and locale

Sent from my HD1903 using Tapatalk

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

DCS-SR-ExternalAudio.rar

Version of DCS-SR-ExternalAudio with .ogg file support along with MP3

 

This will be in the next SRS update, but if you need .ogg support now, use this

 

Just replace the current one where ever you installed SRS

 

Ogg files must end .ogg in order to be picked up

  • Like 1

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

I tried a few test of the .ogg version and it works great, many thanks Ciribob

 

I also made a small change to your  DCS-Simple Text to Speech.lua to minimize the command window from popping up when the script runs. This keeps the cmd window from popping up in my face.

--snip
STTS.EXECUTABLE = "DCS-SR-ExternalAudio.exe"

function STTS.TextToSpeech(message,freqs,modulations, volume,name, coalition )

    message = message:gsub("\"","\\\"")

    local cmd = string.format("start /B /min \"%s\" \"%s\\%s\" \"%s\" %s %s %s %s \"%s\" %s", STTS.DIRECTORY, STTS.DIRECTORY, STTS.EXECUTABLE, message, freqs, modulations, coalition,STTS.SRS_PORT, name, volume )
    env.info("[DCS-STTS] TextToSpeech Command :\n" .. cmd.."\n")
    --os.execute(cmd)
    os.execute('start /min cmd /c ' .. cmd) 
end

 changed os.execute(cmd)  to  os.execute('start /min cmd /c ' .. cmd)

 

Works fine for both the Speech and Audio.

  • Like 1
Link to comment
Share on other sites

4 hours ago, Olddog said:

I tried a few test of the .ogg version and it works great, many thanks Ciribob

 

I also made a small change to your  DCS-Simple Text to Speech.lua to minimize the command window from popping up when the script runs. This keeps the cmd window from popping up in my face.


--snip
STTS.EXECUTABLE = "DCS-SR-ExternalAudio.exe"

function STTS.TextToSpeech(message,freqs,modulations, volume,name, coalition )

    message = message:gsub("\"","\\\"")

    local cmd = string.format("start /B /min \"%s\" \"%s\\%s\" \"%s\" %s %s %s %s \"%s\" %s", STTS.DIRECTORY, STTS.DIRECTORY, STTS.EXECUTABLE, message, freqs, modulations, coalition,STTS.SRS_PORT, name, volume )
    env.info("[DCS-STTS] TextToSpeech Command :\n" .. cmd.."\n")
    --os.execute(cmd)
    os.execute('start /min cmd /c ' .. cmd) 
end

 changed os.execute(cmd)  to  os.execute('start /min cmd /c ' .. cmd)

 

Works fine for both the Speech and Audio.

 

thanks for the suggestion - i'll make that change as well or a variation on it

 

Glad the Ogg version works well!

 

Once you get it running on a server, if you have any recordings or videos please do share as I'm really interested to see what people do with this

  • Like 1

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

I was thinking it is not possible. to play radio stream via SRS. or is that only possible with local files .mp3 .ogg. ???example https://stream.sunshine-live.de/2000er/mp3

Maybe in the future, but supporting a live stream is much trickier than a local file

For now it just supports local files

Sent from my HD1903 using Tapatalk

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

37 minutes ago, Ciribob said:

Vielleicht in der Zukunft, aber die Unterstützung eines Live-Streams ist viel schwieriger als eine lokale Datei

Für jetzt unterstützt es nur lokale Dateien

gesendet von meinem HD1903 mit Tapatalk

 

I am trying to implement it myself, not so easy
Link to comment
Share on other sites

there was an error in PlayMP3 did not run, it changed, now it works

 

 

function STTS.PlayMP3(pathToMP3,freqs,modulations, volume,name, coalition )

 
local cmd = string.format("start /B /min \"%s\" \"%s\\%s\" \"%s\" %s %s %s %s \"%s\" %s", STTS.DIRECTORY, STTS.DIRECTORY, STTS.EXECUTABLE, pathToMP3, freqs, modulations, coalition,STTS.SRS_PORT, name, volume )
env.info("[DCS-STTS] PlayMP3 Command :\n" .. cmd.."\n")
os.execute(cmd)
 

end

Screenshot 2021-02-22 103300.png

Link to comment
Share on other sites

there was an error in PlayMP3 did not run, it changed, now it works
 
 
function STTS.PlayMP3(pathToMP3,freqs,modulations, volume,name, coalition )
 
local cmd = string.format("start /B /min \"%s\" \"%s\\%s\" \"%s\" %s %s %s %s \"%s\" %s", STTS.DIRECTORY, STTS.DIRECTORY, STTS.EXECUTABLE, pathToMP3, freqs, modulations, coalition,STTS.SRS_PORT, name, volume )
env.info("[DCS-STTS] PlayMP3 Command :\n" .. cmd.."\n")
os.execute(cmd)
 
end
921354671_Screenshot2021-02-22103300.thumb.png.c5f89f6f8b78f569d201831f8d0643d6.png
Env.info is a log line?

Can't see any error , that's just used for logging

Sent from my HD1903 using Tapatalk

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

  • 2 weeks later...

@Ciribob - Brilliant!  I just posted this the yesterday.

 

 
Quote

 

I stumbled on the Microsoft MSCognitiveTextToSpeech API plugin for Voice Attack. It allows VA to use a powerful Microsoft Azure text to speech engine instead of generic voices downloaded to our computer.  If you have Voice Attack, I highly recommend checking it out as it adds immersion into the voice commands.

 

Now ... I am just wondering out load here. Is it possible to script something in DCS/MOOSE/MIST that uses this service (its free unless you surpass a set usage)?

 

I am using Bankler's Case I training for carrier landings and it displays real time feedback during the landing on how well you're doing.  That feedback takes real time data (like altitude) and displays on the screen.  This is all done in LUA.  It dawned on me if the variable being used to print to the screen was passed into a "text to voice" API, we could turn that already incredibly useful mission into an even better training tool.  

 

Furthermore using this particular service gives us control over the language, the voice actor, the accent, as well as the voice's pitch and speed.  While this wouldn't take the place of human actors 100%, it could replace the need to pre-record hundreds of lines of speech and allows mission editors to edit communications without the burden of re-recording Voice Acting. 

 

The plugin works pretty well for VA, so I was just wondering if someone smarter than me tried incorporating this API into MOOSE or some other scripting language

 

 

I see your tool is using the MSFT API's built into Windows.  I am curious ... might you consider also using the Azure CognitiveTextToSpeech service?  It MIGHT be a way to introduce variability of the voices.  I am definitely over my head from a tech standpoint, so I'll defer to your expertise here.

 

Thanks for creating this extension!

 

  • Like 2

System Specs:

Spoiler

 💻Processor:13th Gen Intel(R) Core(TM) i9-13900K - 🧠RAM: 64GB - 🎥Video Card: NVIDIA RTX 4090 - 🥽 Display: Pimax 8kx VR Headset - 🕹️Accessories:  VKB Gunfighter III MCG Ultimate, Thrustmaster TWCS (modified), Thrustmaster TPR Pedals, Simshaker JetPad, Predator HOTAS Mounts, 3D Printed Flight Button Box 

Thrustmaster TWCS Mod

 

Link to comment
Share on other sites

Also, how do I prevent the server command box from popping up over the top of DCS when executing a STTS.TextToSpeech command?

System Specs:

Spoiler

 💻Processor:13th Gen Intel(R) Core(TM) i9-13900K - 🧠RAM: 64GB - 🎥Video Card: NVIDIA RTX 4090 - 🥽 Display: Pimax 8kx VR Headset - 🕹️Accessories:  VKB Gunfighter III MCG Ultimate, Thrustmaster TWCS (modified), Thrustmaster TPR Pedals, Simshaker JetPad, Predator HOTAS Mounts, 3D Printed Flight Button Box 

Thrustmaster TWCS Mod

 

Link to comment
Share on other sites

2 hours ago, Mistermann said:

Also, how do I prevent the server command box from popping up over the top of DCS when executing a STTS.TextToSpeech command?

I heard back on Discord that this is not currently part of the feature set and is being worked on.  

System Specs:

Spoiler

 💻Processor:13th Gen Intel(R) Core(TM) i9-13900K - 🧠RAM: 64GB - 🎥Video Card: NVIDIA RTX 4090 - 🥽 Display: Pimax 8kx VR Headset - 🕹️Accessories:  VKB Gunfighter III MCG Ultimate, Thrustmaster TWCS (modified), Thrustmaster TPR Pedals, Simshaker JetPad, Predator HOTAS Mounts, 3D Printed Flight Button Box 

Thrustmaster TWCS Mod

 

Link to comment
Share on other sites

On 2/9/2021 at 2:52 PM, Ciribob said:

If you install more language packs I could make them available with a future update

 

Currently its hard-coded to female - english

 

Any ETA for this? I'm using a lot STTS, so it would be great to have different voice for each emitter 😉

  • Like 2
Link to comment
Share on other sites

1 hour ago, reptile92 said:

 

Any ETA for this? I'm using a lot STTS, so it would be great to have different voice for each emitter 😉

Probably this weekend

  • Like 3
  • Thanks 2

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...