I think there is a minor bug in the code snippet below
https://github.com/PeoplePlusAI/sunva/blob/a32a67704d3a4750fe790ce27736015249614baa/backend/core/stt/groq_client.py#L75C8-L87
For stereo sound, when converting to mono, the datatype of audio_data becomes float64 because for np.mean the default return type for integer inputs is float64. On passing this float variable to np.iinfo, we will get an error as the iinfo function works only for integer types
Potential solution
- Specify the output datatype as np.int16 in np.mean
audio_data.mean(axis=1, dtype=np.int16)
- Use np.finfo for stereo sounds
I think the first approach is better, but would love to know others thoughts
I think there is a minor bug in the code snippet below
https://github.com/PeoplePlusAI/sunva/blob/a32a67704d3a4750fe790ce27736015249614baa/backend/core/stt/groq_client.py#L75C8-L87
For stereo sound, when converting to mono, the datatype of audio_data becomes float64 because for np.mean the default return type for integer inputs is float64. On passing this float variable to np.iinfo, we will get an error as the iinfo function works only for integer types
Potential solution
audio_data.mean(axis=1, dtype=np.int16)I think the first approach is better, but would love to know others thoughts