I'm working on a custom activity that's using the SpeechRecognizer to do Reco.
Right before I call RecognizeAsync() on the SpeechRecognizer, I'm calling EnableRetainAudio() because when the reco is done, I need to be able to check the length of what was recorded.
For the recordedFilePath parameter that I send in to EnableRetainAudio(), I'm creating a unique file name using a GUID.
This works fine until there is some load. Under load, I start getting exceptions (see below) that the recording could not be saved because the file already exists. Now, I know there's no way that I'm getting GUID collisions so there must be something wrong.
It seems like this may be a bug where if you set EnableRetainAudio on the SpeechRecognizer in one Workflow instance, the same recordedFilePath is shared across multiple instances.
Is this a known issue? Is there a work around?
Microsoft.SpeechServer.SpeechApplicationException: Recording audio couldn't be completed: Failed to record to file..
[machine = *****]
[user = NT AUTHORITY\NETWORK SERVICE]
[source = Microsoft.SpeechServer]
[method call = Close]
[stack trace = at Microsoft.SpeechServer.Dialog.SpeechCompositeActivity.Close(Object sender, AsyncCompletedEventArgs e)
at System.Workflow.ComponentModel.ActivityExecutorDelegateInfo`1.ActivityExecutorDelegateOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)
at System.Workflow.Runtime.Scheduler.Run()]
Inner exception Microsoft.SpeechServer.SpeechEngineServices.FailedToRecordException: Failed to record to file.
[source = Microsoft.SES]
[stack trace = at Microsoft.SpeechServer.Grokker.BeginRecognition(RecognitionRequest recognitionRequest, SesAudioFormat sessionInputAudioFormat, Byte[] serializedSREngineState, Boolean initialSilenceRemoval, SpeechRecoLatencyInfo speechRecoLatencyInfo, SesContext id)
at Microsoft.SpeechServer.Ses.SpeechRecognizer.ResourcesReadyCallback(Object state)]
Inner exception System.IO.IOException: The file 'C:\WINDOWS\TEMP\SpeechWorkingFiles\Runtime\_ZfPlTwo\MssCallTmp_262\cce8170a-8a97-4e0a-862d-2202065b033e.wav' already exists.
[source = mscorlib]
[stack trace = at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at Microsoft.SpeechServer.WaveStream..ctor(String pathName, FileMode mode, SesAudioFormat format, AudioCodecId codecId)
at Microsoft.SpeechServer.Grokker.BeginRecognition(RecognitionRequest recognitionRequest, SesAudioFormat sessionInputAudioFormat, Byte[] serializedSREngineState, Boolean initialSilenceRemoval, SpeechRecoLatencyInfo speechRecoLatencyInfo, SesContext id)]