Skip to content

Commit

Permalink
Reduce sensitivity of microphone to permit detection of 35db
Browse files Browse the repository at this point in the history
  • Loading branch information
finneyj committed Feb 17, 2025
1 parent b4514ab commit 32a2484
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/MicroBitAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ MicroBitAudio::MicroBitAudio(NRF52Pin &pin, NRF52Pin &speaker, NRF52ADC &adc, NR

//Initilise level detector SPL and attach to splitter
//levelSPL = new LevelDetectorSPL(*rawSplitter->createChannel(), 85.0, 65.0, 16.0, 0, DEVICE_ID_MICROPHONE, false);
levelSPL = new LevelDetectorSPL(*rawSplitter->createChannel(), 85.0, 65.0, 16.0, 52.0, DEVICE_ID_SYSTEM_LEVEL_DETECTOR);
levelSPL = new LevelDetectorSPL(*rawSplitter->createChannel(), 85.0, 65.0, 4.0, 35.0, DEVICE_ID_SYSTEM_LEVEL_DETECTOR);

//Initilise stream splitter
splitter = new StreamSplitter(processor->output, DEVICE_ID_SPLITTER);
Expand All @@ -94,13 +94,13 @@ void MicroBitAudio::periodicCallback()
{
if (mic->isEnabled() && !micEnabled)
{
DMESG("MicroBitAudio::periodicCallback: activateMic()...");
//DMESG("MicroBitAudio::periodicCallback: activateMic()...");
activateMic();
}

if (!mic->isEnabled() && micEnabled)
{
DMESG("MicroBitAudio::periodicCallback: deactivateMic()...");
//DMESG("MicroBitAudio::periodicCallback: deactivateMic()...");
deactivateMic();
}
}
Expand All @@ -109,7 +109,7 @@ void MicroBitAudio::activateMic(){
runmic.setDigitalValue(1);
runmic.setHighDrive(true);
adc.activateChannel(mic);
adc.getChannel(microphone, false)->setStartDelay(3);
adc.getChannel(microphone, false)->setStartDelay(1);
this->micEnabled = true;
}

Expand Down

0 comments on commit 32a2484

Please sign in to comment.