Help for simple voice assistant setup #1618
-
Hi there! I am struggling a little bit with a simple voice assistant setup to get sample rate handling and conversion right. I am using an ESP32 Audio-Kit. The microphone should be enabled all the time and set to a constant sample rate for audio streaming. So as I understood, I have to use the FormatConverterStream on the output side. However, this sometimes seems to work, and sometimes the rate conversion seems to be wrong, I get a very distorted or slowed down playback. I am pretty sure that I am doing something wrong. So my question is if someone could point me to an example where I can use for instance a single StreamCopy instance and bind this to varying sources while keeping a constant audio sample output rate AND recording at a constant audio sample rate at the same time would be great! Thank you all, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I is a bit unclear what you are doing: Are you mixing the different inputs or just switching between the different sources ? The AudioKit uses I2S in douplex mode, so when your mp3 changes the sample rate, the microphone is automatically changed to the same rate. So I don't understand why you want to convert anything. But when you send the output from the decoer to a FormatConverter, you can fix the sample rate to a fixed output rate which will not change the I2S. You can do this both on the input side or output side of the copy. |
Beta Was this translation helpful? Give feedback.
-
No, setAudioInfo() will work in any case... |
Beta Was this translation helpful? Give feedback.
I is a bit unclear what you are doing: Are you mixing the different inputs or just switching between the different sources ?
The AudioKit uses I2S in douplex mode, so when your mp3 changes the sample rate, the microphone is automatically changed to the same rate.
So I don't understand why you want to convert anything. But when you send the output from the decoer to a FormatConverter, you can fix the sample rate to a fixed output rate which will not change the I2S.
You can do this both on the input side or output side of the copy.