Skip to content

Level monitoring

This class is accessed via the levels property on a CamillaClient instance.

It provides methods for reading signal levels.

class: Levels

Bases: _CommandGroup

Collection of methods for level monitoring

Source code in camilladsp\levels.py
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
class Levels(_CommandGroup):
    """
    Collection of methods for level monitoring
    """

    def range(self) -> float:
        """
        Get signal range for the last processed chunk. Full scale is 2.0.
        """
        sigrange = self.client.query("GetSignalRange")
        return float(sigrange)

    def range_decibel(self) -> float:
        """
        Get current signal range in dB for the last processed chunk.
        Full scale is 0 dB.
        """
        sigrange = self.range()
        if sigrange > 0.0:
            range_decibel = 20.0 * math.log10(sigrange / 2.0)
        else:
            range_decibel = -1000
        return range_decibel

    def capture_rms(self) -> List[float]:
        """
        Get capture signal level rms in dB for the last processed chunk.
        Full scale is 0 dB. Returns a list with one element per channel.
        """
        sigrms = self.client.query("GetCaptureSignalRms")
        return sigrms

    def playback_rms(self) -> List[float]:
        """
        Get playback signal level rms in dB for the last processed chunk.
        Full scale is 0 dB. Returns a list with one element per channel.
        """
        sigrms = self.client.query("GetPlaybackSignalRms")
        return sigrms

    def capture_peak(self) -> List[float]:
        """
        Get capture signal level peak in dB for the last processed chunk.
        Full scale is 0 dB. Returns a list with one element per channel.
        """
        sigpeak = self.client.query("GetCaptureSignalPeak")
        return sigpeak

    def playback_peak(self) -> List[float]:
        """
        Get playback signal level peak in dB for the last processed chunk.
        Full scale is 0 dB. Returns a list with one element per channel.
        """
        sigpeak = self.client.query("GetPlaybackSignalPeak")
        return sigpeak

    def playback_peak_since(self, interval: float) -> List[float]:
        """
        Get playback signal level peak in dB for the last `interval` seconds.
        Full scale is 0 dB. Returns a list with one element per channel.

        Args:
            interval (float): Length of interval in seconds.
        """
        sigpeak = self.client.query("GetPlaybackSignalPeakSince", arg=float(interval))
        return sigpeak

    def playback_rms_since(self, interval: float) -> List[float]:
        """
        Get playback signal level rms in dB for the last `interval` seconds.
        Full scale is 0 dB. Returns a list with one element per channel.

        Args:
            interval (float): Length of interval in seconds.
        """
        sigrms = self.client.query("GetPlaybackSignalRmsSince", arg=float(interval))
        return sigrms

    def capture_peak_since(self, interval: float) -> List[float]:
        """
        Get capture signal level peak in dB for the last `interval` seconds.
        Full scale is 0 dB. Returns a list with one element per channel.

        Args:
            interval (float): Length of interval in seconds.
        """
        sigpeak = self.client.query("GetCaptureSignalPeakSince", arg=float(interval))
        return sigpeak

    def capture_rms_since(self, interval: float) -> List[float]:
        """
        Get capture signal level rms in dB for the last `interval` seconds.
        Full scale is 0 dB. Returns a list with one element per channel.

        Args:
            interval (float): Length of interval in seconds.
        """
        sigrms = self.client.query("GetCaptureSignalRmsSince", arg=float(interval))
        return sigrms

    def playback_peak_since_last(self) -> List[float]:
        """
        Get playback signal level peak in dB since the last read by the same client.
        Full scale is 0 dB. Returns a list with one element per channel.
        """
        sigpeak = self.client.query("GetPlaybackSignalPeakSinceLast")
        return sigpeak

    def playback_rms_since_last(self) -> List[float]:
        """
        Get playback signal level rms in dB since the last read by the same client.
        Full scale is 0 dB. Returns a list with one element per channel.
        """
        sigrms = self.client.query("GetPlaybackSignalRmsSinceLast")
        return sigrms

    def capture_peak_since_last(self) -> List[float]:
        """
        Get capture signal level peak in dB since the last read by the same client.
        Full scale is 0 dB. Returns a list with one element per channel.
        """
        sigpeak = self.client.query("GetCaptureSignalPeakSinceLast")
        return sigpeak

    def capture_rms_since_last(self) -> List[float]:
        """
        Get capture signal level rms in dB since the last read by the same client.
        Full scale is 0 dB. Returns a list with one element per channel.
        """
        sigrms = self.client.query("GetCaptureSignalRmsSinceLast")
        return sigrms

    def levels(self) -> Dict[str, List[float]]:
        """
        Get all signal levels in dB for the last processed chunk.
        Full scale is 0 dB.
        The values are returned as a json object with keys
        `playback_peak`, `playback_rms`, `capture_peak` and `capture_rms`.
        Each dict item is a list with one element per channel.
        """
        siglevels = self.client.query("GetSignalLevels")
        return siglevels

    def levels_since(self, interval: float) -> Dict[str, List[float]]:
        """
        Get all signal levels in dB for the last `interval` seconds.
        Full scale is 0 dB.
        The values are returned as a json object with keys
        `playback_peak`, `playback_rms`, `capture_peak` and `capture_rms`.
        Each dict item is a list with one element per channel.

        Args:
            interval (float): Length of interval in seconds.
        """
        siglevels = self.client.query("GetSignalLevelsSince", arg=float(interval))
        return siglevels

    def levels_since_last(self) -> Dict[str, List[float]]:
        """
        Get all signal levels in dB since the last read by the same client.
        Full scale is 0 dB.
        The values are returned as a json object with keys
        `playback_peak`, `playback_rms`, `capture_peak` and `capture_rms`.
        Each dict item is a list with one element per channel.
        """
        siglevels = self.client.query("GetSignalLevelsSinceLast")
        return siglevels

    def peaks_since_start(self) -> Dict[str, List[float]]:
        """
        Get the playback and capture peak level since processing started.
        The values are returned as a json object with keys `playback` and `capture`.
        """
        peaks = self.client.query("GetSignalPeaksSinceStart")
        return peaks

    def reset_peaks_since_start(self):
        """
        Reset the peak level values.
        """
        self.client.query("ResetSignalPeaksSinceStart")

capture_peak()

Get capture signal level peak in dB for the last processed chunk. Full scale is 0 dB. Returns a list with one element per channel.

Source code in camilladsp\levels.py
53
54
55
56
57
58
59
def capture_peak(self) -> List[float]:
    """
    Get capture signal level peak in dB for the last processed chunk.
    Full scale is 0 dB. Returns a list with one element per channel.
    """
    sigpeak = self.client.query("GetCaptureSignalPeak")
    return sigpeak

capture_peak_since(interval)

Get capture signal level peak in dB for the last interval seconds. Full scale is 0 dB. Returns a list with one element per channel.

Parameters:

Name Type Description Default
interval float

Length of interval in seconds.

required
Source code in camilladsp\levels.py
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
def capture_peak_since(self, interval: float) -> List[float]:
    """
    Get capture signal level peak in dB for the last `interval` seconds.
    Full scale is 0 dB. Returns a list with one element per channel.

    Args:
        interval (float): Length of interval in seconds.
    """
    sigpeak = self.client.query("GetCaptureSignalPeakSince", arg=float(interval))
    return sigpeak

capture_peak_since_last()

Get capture signal level peak in dB since the last read by the same client. Full scale is 0 dB. Returns a list with one element per channel.

Source code in camilladsp\levels.py
129
130
131
132
133
134
135
def capture_peak_since_last(self) -> List[float]:
    """
    Get capture signal level peak in dB since the last read by the same client.
    Full scale is 0 dB. Returns a list with one element per channel.
    """
    sigpeak = self.client.query("GetCaptureSignalPeakSinceLast")
    return sigpeak

capture_rms()

Get capture signal level rms in dB for the last processed chunk. Full scale is 0 dB. Returns a list with one element per channel.

Source code in camilladsp\levels.py
37
38
39
40
41
42
43
def capture_rms(self) -> List[float]:
    """
    Get capture signal level rms in dB for the last processed chunk.
    Full scale is 0 dB. Returns a list with one element per channel.
    """
    sigrms = self.client.query("GetCaptureSignalRms")
    return sigrms

capture_rms_since(interval)

Get capture signal level rms in dB for the last interval seconds. Full scale is 0 dB. Returns a list with one element per channel.

Parameters:

Name Type Description Default
interval float

Length of interval in seconds.

required
Source code in camilladsp\levels.py
102
103
104
105
106
107
108
109
110
111
def capture_rms_since(self, interval: float) -> List[float]:
    """
    Get capture signal level rms in dB for the last `interval` seconds.
    Full scale is 0 dB. Returns a list with one element per channel.

    Args:
        interval (float): Length of interval in seconds.
    """
    sigrms = self.client.query("GetCaptureSignalRmsSince", arg=float(interval))
    return sigrms

capture_rms_since_last()

Get capture signal level rms in dB since the last read by the same client. Full scale is 0 dB. Returns a list with one element per channel.

Source code in camilladsp\levels.py
137
138
139
140
141
142
143
def capture_rms_since_last(self) -> List[float]:
    """
    Get capture signal level rms in dB since the last read by the same client.
    Full scale is 0 dB. Returns a list with one element per channel.
    """
    sigrms = self.client.query("GetCaptureSignalRmsSinceLast")
    return sigrms

levels()

Get all signal levels in dB for the last processed chunk. Full scale is 0 dB. The values are returned as a json object with keys playback_peak, playback_rms, capture_peak and capture_rms. Each dict item is a list with one element per channel.

Source code in camilladsp\levels.py
145
146
147
148
149
150
151
152
153
154
def levels(self) -> Dict[str, List[float]]:
    """
    Get all signal levels in dB for the last processed chunk.
    Full scale is 0 dB.
    The values are returned as a json object with keys
    `playback_peak`, `playback_rms`, `capture_peak` and `capture_rms`.
    Each dict item is a list with one element per channel.
    """
    siglevels = self.client.query("GetSignalLevels")
    return siglevels

levels_since(interval)

Get all signal levels in dB for the last interval seconds. Full scale is 0 dB. The values are returned as a json object with keys playback_peak, playback_rms, capture_peak and capture_rms. Each dict item is a list with one element per channel.

Parameters:

Name Type Description Default
interval float

Length of interval in seconds.

required
Source code in camilladsp\levels.py
156
157
158
159
160
161
162
163
164
165
166
167
168
def levels_since(self, interval: float) -> Dict[str, List[float]]:
    """
    Get all signal levels in dB for the last `interval` seconds.
    Full scale is 0 dB.
    The values are returned as a json object with keys
    `playback_peak`, `playback_rms`, `capture_peak` and `capture_rms`.
    Each dict item is a list with one element per channel.

    Args:
        interval (float): Length of interval in seconds.
    """
    siglevels = self.client.query("GetSignalLevelsSince", arg=float(interval))
    return siglevels

levels_since_last()

Get all signal levels in dB since the last read by the same client. Full scale is 0 dB. The values are returned as a json object with keys playback_peak, playback_rms, capture_peak and capture_rms. Each dict item is a list with one element per channel.

Source code in camilladsp\levels.py
170
171
172
173
174
175
176
177
178
179
def levels_since_last(self) -> Dict[str, List[float]]:
    """
    Get all signal levels in dB since the last read by the same client.
    Full scale is 0 dB.
    The values are returned as a json object with keys
    `playback_peak`, `playback_rms`, `capture_peak` and `capture_rms`.
    Each dict item is a list with one element per channel.
    """
    siglevels = self.client.query("GetSignalLevelsSinceLast")
    return siglevels

peaks_since_start()

Get the playback and capture peak level since processing started. The values are returned as a json object with keys playback and capture.

Source code in camilladsp\levels.py
181
182
183
184
185
186
187
def peaks_since_start(self) -> Dict[str, List[float]]:
    """
    Get the playback and capture peak level since processing started.
    The values are returned as a json object with keys `playback` and `capture`.
    """
    peaks = self.client.query("GetSignalPeaksSinceStart")
    return peaks

playback_peak()

Get playback signal level peak in dB for the last processed chunk. Full scale is 0 dB. Returns a list with one element per channel.

Source code in camilladsp\levels.py
61
62
63
64
65
66
67
def playback_peak(self) -> List[float]:
    """
    Get playback signal level peak in dB for the last processed chunk.
    Full scale is 0 dB. Returns a list with one element per channel.
    """
    sigpeak = self.client.query("GetPlaybackSignalPeak")
    return sigpeak

playback_peak_since(interval)

Get playback signal level peak in dB for the last interval seconds. Full scale is 0 dB. Returns a list with one element per channel.

Parameters:

Name Type Description Default
interval float

Length of interval in seconds.

required
Source code in camilladsp\levels.py
69
70
71
72
73
74
75
76
77
78
def playback_peak_since(self, interval: float) -> List[float]:
    """
    Get playback signal level peak in dB for the last `interval` seconds.
    Full scale is 0 dB. Returns a list with one element per channel.

    Args:
        interval (float): Length of interval in seconds.
    """
    sigpeak = self.client.query("GetPlaybackSignalPeakSince", arg=float(interval))
    return sigpeak

playback_peak_since_last()

Get playback signal level peak in dB since the last read by the same client. Full scale is 0 dB. Returns a list with one element per channel.

Source code in camilladsp\levels.py
113
114
115
116
117
118
119
def playback_peak_since_last(self) -> List[float]:
    """
    Get playback signal level peak in dB since the last read by the same client.
    Full scale is 0 dB. Returns a list with one element per channel.
    """
    sigpeak = self.client.query("GetPlaybackSignalPeakSinceLast")
    return sigpeak

playback_rms()

Get playback signal level rms in dB for the last processed chunk. Full scale is 0 dB. Returns a list with one element per channel.

Source code in camilladsp\levels.py
45
46
47
48
49
50
51
def playback_rms(self) -> List[float]:
    """
    Get playback signal level rms in dB for the last processed chunk.
    Full scale is 0 dB. Returns a list with one element per channel.
    """
    sigrms = self.client.query("GetPlaybackSignalRms")
    return sigrms

playback_rms_since(interval)

Get playback signal level rms in dB for the last interval seconds. Full scale is 0 dB. Returns a list with one element per channel.

Parameters:

Name Type Description Default
interval float

Length of interval in seconds.

required
Source code in camilladsp\levels.py
80
81
82
83
84
85
86
87
88
89
def playback_rms_since(self, interval: float) -> List[float]:
    """
    Get playback signal level rms in dB for the last `interval` seconds.
    Full scale is 0 dB. Returns a list with one element per channel.

    Args:
        interval (float): Length of interval in seconds.
    """
    sigrms = self.client.query("GetPlaybackSignalRmsSince", arg=float(interval))
    return sigrms

playback_rms_since_last()

Get playback signal level rms in dB since the last read by the same client. Full scale is 0 dB. Returns a list with one element per channel.

Source code in camilladsp\levels.py
121
122
123
124
125
126
127
def playback_rms_since_last(self) -> List[float]:
    """
    Get playback signal level rms in dB since the last read by the same client.
    Full scale is 0 dB. Returns a list with one element per channel.
    """
    sigrms = self.client.query("GetPlaybackSignalRmsSinceLast")
    return sigrms

range()

Get signal range for the last processed chunk. Full scale is 2.0.

Source code in camilladsp\levels.py
18
19
20
21
22
23
def range(self) -> float:
    """
    Get signal range for the last processed chunk. Full scale is 2.0.
    """
    sigrange = self.client.query("GetSignalRange")
    return float(sigrange)

range_decibel()

Get current signal range in dB for the last processed chunk. Full scale is 0 dB.

Source code in camilladsp\levels.py
25
26
27
28
29
30
31
32
33
34
35
def range_decibel(self) -> float:
    """
    Get current signal range in dB for the last processed chunk.
    Full scale is 0 dB.
    """
    sigrange = self.range()
    if sigrange > 0.0:
        range_decibel = 20.0 * math.log10(sigrange / 2.0)
    else:
        range_decibel = -1000
    return range_decibel

reset_peaks_since_start()

Reset the peak level values.

Source code in camilladsp\levels.py
189
190
191
192
193
def reset_peaks_since_start(self):
    """
    Reset the peak level values.
    """
    self.client.query("ResetSignalPeaksSinceStart")