-
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
Default sampling rates when using StreamRecording
don't match
#311
Comments
@JohnVidler I've tested this with the latest CODAL and still sounds speed up if no sampling rate is specified in the user code. |
I can confirm this is still replicable with CODAL v0.2.55. Updated, smaller example to replicate: #include "MicroBit.h"
#include "StreamRecording.h"
MicroBit uBit;
static void onButtonPress(MicroBitEvent) {
static SplitterChannel *splitterChannel = uBit.audio.splitter->createChannel();
static StreamRecording *recording = new StreamRecording(*splitterChannel);
// The defaults here don't match
static MixerChannel *channel = uBit.audio.mixer.addChannel(*recording);
// This version works
//static MixerChannel *channel = uBit.audio.mixer.addChannel(*recording, 11000);
channel->setVolume(100);
MicroBitAudio::requestActivation();
recording->recordAsync();
while (uBit.buttonA.isPressed()) {
uBit.sleep(5);
}
recording->stop();
recording->play();
while (recording->isPlaying()) {
uBit.sleep(20);
}
recording->erase();
}
int main() {
uBit.init();
uBit.messageBus.listen(MICROBIT_ID_BUTTON_A, MICROBIT_BUTTON_EVT_DOWN, onButtonPress);
while (true) {
uBit.sleep(1000);
}
} |
I've checked again, ensuring I'm using the latest commits from all dependencies, I can still replicate this issue. |
So technically this is intended behaviour, as the I've added a new I'm not thrilled by that config name, but it aligns with others we have in the mixer, but I'm open to creating a distinct See this commit for the patch; d54ce9b and I'm marking this as 'complete' for now, but feel free to reopen if major changes are needed (like the addition of the extra mic-specific config var) |
With this example, pressing down button A records sound and plays it back as soon as the button is released.
In this case, if the sampling rate is not set in
uBit.audio.mixer.addChannel()
the playback is speeded up.The text was updated successfully, but these errors were encountered: