Add a default noise floor. #13

Merged
liamwarfield merged 5 commits from feature/stop-sending-when-quiet into main 2026-01-19 22:07:06 +00:00
Owner

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.

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.
liamwarfield force-pushed feature/stop-sending-when-quiet from 96c9998340 to 681780f495 2026-01-11 01:59:22 +00:00 Compare
Author
Owner

Nevermind, 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.

Nevermind, 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.
liamwarfield force-pushed feature/stop-sending-when-quiet from 681780f495 to 57e30ba803 2026-01-11 02:12:49 +00:00 Compare
liamwarfield force-pushed feature/stop-sending-when-quiet from 57e30ba803 to 395bb79a66 2026-01-11 03:59:55 +00:00 Compare
samuel127849 force-pushed feature/stop-sending-when-quiet from e38b99fb00 to a3c9e87227 2026-01-11 04:11:13 +00:00 Compare
liamwarfield force-pushed feature/stop-sending-when-quiet from a3c9e87227 to 9e5c6f9103 2026-01-11 04:22:38 +00:00 Compare
liamwarfield force-pushed feature/stop-sending-when-quiet from 9e5c6f9103 to 2a298700f4 2026-01-11 04:23:13 +00:00 Compare
liamwarfield force-pushed feature/stop-sending-when-quiet from 2a298700f4 to 118c955a37 2026-01-19 01:26:39 +00:00 Compare
restitux approved these changes 2026-01-19 01:50:29 +00:00
restitux left a comment
Owner

lgtm 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

lgtm 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| {
Owner

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 state match statement into the function?

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 state` match statement into the function?
Author
Owner

I've moved it all into a stand alone encode_and_send function.

I've moved it all into a stand alone `encode_and_send` function.
liamwarfield marked this conversation as resolved
@@ -307,1 +315,3 @@
);
TransmitState::Transmitting => {
// Normal transmission
match AudioData::new(frame.unchecked_ref()) {
Owner

This logic is duplicated in both Transmitting and Terminator? Could we possibly pull this match statement up a level out of imp and have encode_and_send be the platform specific code boundary?

This logic is duplicated in both `Transmitting` and `Terminator`? Could we possibly pull this match statement up a level out of `imp` and have `encode_and_send` be the platform specific code boundary?
Author
Owner

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 with pending_terminator.store(true);.

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 with `pending_terminator.store(true);`.
liamwarfield marked this conversation as resolved
liamwarfield force-pushed feature/stop-sending-when-quiet from 118c955a37 to 7a5239c0cf 2026-01-19 20:17:25 +00:00 Compare
liamwarfield force-pushed feature/stop-sending-when-quiet from 285ed7d0fa to c5fcb125c6 2026-01-19 21:57:29 +00:00 Compare
liamwarfield merged commit 65883917b0 into main 2026-01-19 22:07:06 +00:00
liamwarfield deleted branch feature/stop-sending-when-quiet 2026-01-19 22:07:06 +00:00
Sign in to join this conversation.
No Reviewers
No Label
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mumble/mumble-web2#13