Skip to content
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

Use max rather than average of L/R channels for audio plugins #616

Open
smarquard opened this issue Apr 9, 2019 · 1 comment
Open

Use max rather than average of L/R channels for audio plugins #616

smarquard opened this issue Apr 9, 2019 · 1 comment
Labels
feature Use this label for new features or enhancements

Comments

@smarquard
Copy link

In this block of code in recorderui:

        average = (data + data2)/2.0
        if not self.mute:
            if self.lowaudio_threshold and average < (self.lowaudio_threshold):
                self.dispatcher.emit("low-audio")
                self.low_audio = True
            if average < (self.thresholdVum):
                self.dispatcher.emit("audio-mute")
                self.mute = True
        if self.mute and average > (self.thresholdVum + 5.0):
            self.dispatcher.emit("audio-recovered")
            self.mute = False
        if self.low_audio and self.lowaudio_threshold and average > (self.lowaudio_threshold + 5.0):
            self.dispatcher.emit("low-audio-recovered")
            self.low_audio = False

the audio level is calculated by averaging the left and right channels.

It makes more sense to use the larger value of the two channels for audio threshold purposes, e.g.

    audio_level = max(data, data2)

For example if you have different mic inputs on L&R and you expect > -50 dB on both of them, and set low audio threshold = -55, but then unplug the R mic (or it's switched off), and now you have -50 dB left and -80 or lower on right, so the average drops below the threshold, even though you still have a perfectly good audio signal.

@smarquard
Copy link
Author

Relates to #495

smarquard added a commit to cilt-uct/Galicaster that referenced this issue Apr 11, 2019
@Alfro Alfro added the feature Use this label for new features or enhancements label Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Use this label for new features or enhancements
Projects
None yet
Development

No branches or pull requests

2 participants