-
Notifications
You must be signed in to change notification settings - Fork 52
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
ADC period 22us only supports 4 channels #441
Comments
Similar C++ example: recording.zip The hex in the zip has |
The NRF52ADC period used to be set in MicroBit.cpp to 91us (note: 1e6/11000 == 90.9), but has been changed by MicroBitAudio to 45 (1e6/22000), then 90 (1e6/11000) and now 22 (1e6/44100). The last change says "back up to 44100" but that number has not been used to set the NRF52ADC rate before, as far as I can see. Perhaps that referred to the Mixer2 output channel speed. It looks like MicroBitAudio is turning the NRF52ADC speed dial up to 11 out of 10, even for programs that don't use the microphone. I don't think a MakeCode program can reduce the NRF52ADC rate. History... Originally, the default NRF52ADC period was set to 91us codal-microbit-v2/model/MicroBit.cpp Line 69 in a8470a7
MicroBitAudio started setting the default ADC period to 1e6/22000 (45) in 98d7dc9 MicroBitAudio was changed to set 1e6/11000 (90) in ceba6d7 Macro CONFIG_MIXER_DEFAULT_CHANNEL_SAMPLERATE == 11000 was added after issue #311 in d54ce9b Finally, CONFIG_MIXER_DEFAULT_CHANNEL_SAMPLERATE was increased to 44100 in 2e664e6 Trying to understand CONFIG_MIXER_DEFAULT_CHANNEL_SAMPLERATE... It is
These two things don't seem logically closely connected. I'm not sure why MicroBitAudio needs to set the NRF52ADC rate in its constructor. Does LevelDetectorSPL need the same high rate as sound recording?
Could the mic input pipeline be created on first use?
|
Sound level is more noisy at 22us / 44100Hz. C++
|
More than 3 analogue inputs, reduces mic rate
Try this in MakeCode live, then beta
https://makecode.microbit.org/_a277qf3sTHYs
https://makecode.microbit.org/_4q5L1eCcWFK9 (for import to beta with the pin blocks fixed)
Press A to record – see recording time in console
Press B to add 4 analogue inputs
Press A to record – see increased recording time in beta
The text was updated successfully, but these errors were encountered: