microsoft / microsoft/pxt-microbit

Recommendation: Use `uBit.audio` internally instead of instantiating own microphone and sound level

Open
#5,803 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

codecleanup hardware
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

Specifically in the libs/microphone/microphonehw.cpp and libs/microphone/microphone.cpp files, an instance of microphone and LevelDetector is created and completely managed by MakeCode.

While this might have been needed early during development, uBit.audio was introduced before the V2 release and it provides control over the full audio pipeline.

Specifically with extensions like the recording and playback, that do use uBit.audio, it is not recommended at all to have separate instances of microphone and ADC, which can lead to conflicts and unexpected behaviour.

This is specially important as we update and add bug fixes in CODAL that might not work on MakeCode or might need updates in both places.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with libs/microphone/microphonehw.cpp and libs/microphone/microphone.cpp, focusing on the locally created microphone and LevelDetector instances. Compare their management with uBit.audio and review how recording and playback extensions use the shared audio pipeline. Done means the microphone code uses uBit.audio without separate conflicting microphone or ADC instances.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.