How to push float32 array to audioInputStream using pullAudioInputStreamCallback

Sandeep Pradeep 20 Reputation points

i have taken realtime audio data and used as float32 array how to convert it to azure AudioStreamInput

import numpy as np
import azure.cognitiveservices.speech as speechsdk

class NumpyAudioStream(
    def __init__(self, audio_array):
        self.audio_array = audio_array
        self.position = 0

    def read(self, buffer, offset, count):
        remaining = len(self.audio_array) - self.position
        to_read = min(remaining, count)
        buffer[:to_read] = self.audio_array[self.position:self.position+to_read]
        self.position += to_read
        return to_read
Tried this but 'NumpyAudioStream' object has no attribute '_handle' error occuring

i have afloat32 array how to create an Azure AudioInputStream
Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,143 questions
{count} votes