question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error for MULAW push stream on Windows

See original GitHub issue

Hello,

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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
garethkellycommented, Aug 18, 2020

@twilio-jyoung - no problem Ive updated repo here

2reactions
garethkellycommented, Aug 18, 2020

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)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use compressed input audio - Speech service
To configure the Speech SDK to accept compressed audio input, create PullAudioInputStream or PushAudioInputStream . Then, create an AudioConfig ...
Read more >
Cognitive Services Speech SDK - C++ Reference | ...
Indicates that an error occurred during speech recognition. EndOfStream, Indicates that the end of the audio stream was reached. CancelledByUser ...
Read more >
Quota exceeded (cid) : Websocket error code 1007
I can get live transcribed text for a while and then it just fails with the error. Following is my code: let pushStream:...
Read more >
StreamingGuide – FFmpeg
The FFmpeg's "-re" flag means to "Read input at native frame rate. Mainly used to simulate a grab device." i.e. if you wanted...
Read more >
Java Sound, Compressing Audio with mu-Law Encoding
This lesson will show you how to use mu-law encoding and decoding to ... (error) expressed as a percent of the original sample...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found