You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to make a custom audio source class that will accept any Raw Audio. I have a stream class in my source class that can be written to by things outside of the class and then a read function for the recognizer to use. The problem is my buffer keeps running out. How do the other audio sources avoid this problem as it seems the Microphone Source has an unlimited amount of data available? Or at least whenever read is called on Microphone Source something is returned. Here is the implementation of my RawStream. Any advice would be appreciated.
class RawStream(object):
def __init__(self, sample_width=2):
self.sample_width = sample_width
self.sampleDataType = sampleDataTypes[sample_width]
self.stream = np.array([], dtype=self.sampleDataType)
# read size bytes from the beginning of stream if possible, or return None otherwise
def read(self, size):
data = self.stream[:size]
self.stream = self.stream[size:]
return data
def write(self, data):
data = np.frombuffer(data, dtype=self.sampleDataType)
self.stream = np.concatenate((self.stream, data))
The text was updated successfully, but these errors were encountered:
Hey, I was wondering if you have found a solution to this.
Currently, I'm looking for a solution to use the speech_recognition package, with my source being a ROS2 /audio topic that I would like to convert to text.
If you have any pointers for me, it would also be greatly appreciated.
I am trying to make a custom audio source class that will accept any Raw Audio. I have a stream class in my source class that can be written to by things outside of the class and then a read function for the recognizer to use. The problem is my buffer keeps running out. How do the other audio sources avoid this problem as it seems the Microphone Source has an unlimited amount of data available? Or at least whenever read is called on Microphone Source something is returned. Here is the implementation of my RawStream. Any advice would be appreciated.
The text was updated successfully, but these errors were encountered: