Error for MULAW push stream on Windows
See original GitHub issueHello,
I am trying to stream Twilio audio (MULAW) to Speech to Text service similar to #446 but I’m running C# on Windows.
I have GStreamer installed and using 1.11.0 of Microsoft.CognitiveServices.Speech
- OS: Windows
- Hardware - x64
- Programming language: C#
private SpeechRecognizer _recognizer;
private PushAudioInputStream _inputStream;
private AudioConfig _audioInput;
public async Task Start()
{
var config = SpeechConfig.FromSubscription(_projectSettings.AzureSpeechServiceSubscriptionKey, _projectSettings.AzureSpeechServiceRegionName);
var audioFormat = AudioStreamFormat.GetCompressedFormat(AudioStreamContainerFormat.MULAW);
_inputStream = AudioInputStream.CreatePushStream(audioFormat);
_audioInput = AudioConfig.FromStreamInput(_inputStream);
_recognizer = new SpeechRecognizer(config, _audioInput);
_recognizer.SessionStarted += RecognizerStarted;
_recognizer.Recognized += RecognizerRecognized;
_recognizer.Canceled += RecognizerCancelled;
await _recognizer.StartContinuousRecognitionAsync();
}
I am taking the raw Twilio stream (media.payload see here) base64 decoding it and feeding it directly into the push stream with no buffer
public async Task Transcribe(byte[] audioBytes) { _inputStream.Write(audioBytes); }
I get the following error:
Message: The stream is of a different type than handled by this element. DebugInfo: riff-read.c(262): gst_riff_parse_file_header (): /GstPipeline:pipeline/GstWavParse:wavparse: Stream is no RIFF stream: 0x7a6f7afe SessionId: 3aeeac302e6f410a9411751dd25512c8
Please let me know if my setup is incorrect as I could find no examples with a stream to pushstream scenario
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:21 (8 by maintainers)
Top GitHub Comments
@twilio-jyoung - no problem Ive updated repo here
Hi @twilio-jyoung
I was able to get it working (credit to Joris Kalz from Microsoft who gave me the solution) Using the following two files:
https://www.codeproject.com/Articles/14237/Using-the-G711-standard MuLawDecoder.cs MuLawEncoder.cs
Let me know if you need me to upload my feature branch with full example.
Its a lot of code - and not even sure what it does 😃 so it would really be better if Microsoft supported MULAW/8000 format or Twilio was able to support streaming in WAV/PCM (was told this was on long term road map)