Add a default noise floor. #13
Reference in New Issue
Block a user
Delete Branch "feature/stop-sending-when-quiet"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pretty simple, if the average amplitude is under a certain value clear
out the buffer! The value I chose (.001) was an arbitrary value I got
from printf debugging. I was able to show that this worked pretty well
on the desktop session. Hopefully we'll add this to the settings page at
some point.
96c9998340to681780f495Nevermind, Mumble has a termination packet that we need to send when we stop transmitting! I also found that mumble holds for 200ms after going under the threshold to prevent snapping someones audio on and off during a short pause in speech.
681780f495to57e30ba80357e30ba803to395bb79a66e38b99fb00toa3c9e87227a3c9e87227to9e5c6f91039e5c6f9103to2a298700f42a298700f4to118c955a37lgtm overall, though I left two comments about the code structure that I think would make this easier to reason about and slightly easier to maintain
@@ -108,1 +100,3 @@each(buf);let state = current_processor.process(frame, config.channels as usize, &mut output_buffer);let mut encode_and_send = |buf: &mut Vec<f32>, is_terminator: bool| {nit: I'm not a huge fan of this encode_and_send closure logic. Could we just define this as a separate function and push down the
match statematch statement into the function?I've moved it all into a stand alone
encode_and_sendfunction.@@ -307,1 +315,3 @@);TransmitState::Transmitting => {// Normal transmissionmatch AudioData::new(frame.unchecked_ref()) {This logic is duplicated in both
TransmittingandTerminator? Could we possibly pull this match statement up a level out ofimpand haveencode_and_sendbe the platform specific code boundary?I was able to pull that code out of the match and run it bellow. As for the refactoring things out of
imp, I don't think that's a good idea due to how everything has to eventually end up in audio encoding worklet for the web impl. That's why I have to wrap the terminator logic in a arc withpending_terminator.store(true);.118c955a37to7a5239c0cf285ed7d0fatoc5fcb125c6