Is it possible to output several voices in one audio file?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
WantToKnow
Posts: 64
Joined: 28 Mar 2020, 08:46

Is it possible to output several voices in one audio file?

Post by WantToKnow » 12 Apr 2024, 10:44

Code: Select all

spVoice1 := ComObjCreate("SAPI.SpVoice")
spVoice1.Volume := 100 
spVoice1.Rate := -3
spVoice1.Voice := spVoice1.GetVoices().Item(0)  ; Voice 1
spVoice1.AllowAudioOutputFormatChangesOnNextSet := 1

spVoice2 := ComObjCreate("SAPI.SpVoice")
spVoice2.Volume := 50
spVoice2.Rate := 1
spVoice2.Voice := spVoice2.GetVoices().Item(4) ; Voice 2
spVoice2.AllowAudioOutputFormatChangesOnNextSet := 1

; works fine:
SpVoice1.Speak("This is the voice of Brian.")
SpVoice2.Speak("This is the voice of Sally.")

strWav := "Test.wav"
spStream := ComObjCreate("SAPI.SpFileStream")
SpStream.Open(strWav,3,1) ; Error
Is it possible to speak simultaneously with several voices on one audio file?

User avatar
Chunjee
Posts: 1423
Joined: 18 Apr 2014, 19:05
Contact:

Re: Is it possible to output several voices in one audio file?

Post by Chunjee » 12 Apr 2024, 15:46

I believe the answer is yes. On cellphone at the moment will have to sit with my computer for a test and code :thumbup:

Sorry I misunderstood the question as speaking two voices at the same time. I don't know anything about file output.

WantToKnow
Posts: 64
Joined: 28 Mar 2020, 08:46

Re: Is it possible to output several voices in one audio file?

Post by WantToKnow » 14 Apr 2024, 02:33

Thanks for your answers. I already solved it and it's possible.
Once you have constructed the Sapi voice objects, it is exactly the same as with a voice.

Post Reply

Return to “Ask for Help (v1)”