-
-
Notifications
You must be signed in to change notification settings - Fork 285
AnalogRead not working after AnalogAudioStream begins #346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You would copy the data from the AnalogAudioStream to a MultiOutput. If you only want to read the audio data from the AnalogAudioStream you can call readBytes(buffer, size); to get the data from the input stream. |
I would like to just read the audio data from the stream, since I'm working with a distance sensor which has delays that does not work when the copier is running with .copy(), but I'm not sure what (buffer and size) would fit into the function? |
https://github.com/pschatzmann/arduino-audio-tools/wiki/Introduction If you have some steps with big delays in the loop you can try to execute them only every nth time. |
I'll look into the readBytes But on the topic, for instance, I wired the mic output to another pin for analogRead, but simply calling analogRead stops the code from running, even if I add an nth-time thing in the loop: int incre = 0; I think digitalWrite also don't work in this case as well: for the distance sensors, I thought the delay here is actually slower than the sample rate But the distance sensor is a bit off topic, but just to show some stuff doesn't work while the copier is doing its thing Sorry I'm kind of a beginner on this! Thanks for your patience. |
An analogRead() should be fast and should not disturb. |
I made a simple mistake by calling analogRead with a small delay in loop, hence it's blowing up But indeed, when a pin is in use by AnalogAudioStream, the pin will not be available for analogRead and the whole code will not run for some reason. |
Another observation is, after AnalogAudioStream started, if there are analogReads afterwards, no matter which pin it is from, it would stop the analog stream... copying from the stream results in a blank sound file... |
Thanks, I didn't notice that my ESP32 library is very outdated. I don't have the means to test the code again, but I assume that it should be fine once I update my library, I'll reopen this issue if needed. |
I am trying to get values from a mic while recording with it.
I start the audio stream in setup, while putting analogRead in loop
when the audio stream begins, analogRead will not work and cause the loop to stop
Wonder if there is a workaround on this? Such as if it's possible to get the value of the audio stream like analogRead?
The text was updated successfully, but these errors were encountered: