Skip to content

Commit 7a750e3

Browse files
committed
add input sample rate config
1 parent 0e4e48b commit 7a750e3

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

charts/doggo/templates/deployment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ spec:
5151
{{ if .Values.doggo.configureInput }}
5252
- "--configure-input"
5353
{{ end }}
54+
{{ if .Values.doggo.inputSampleRate }}
55+
- "--input-sample-rate={{ .Values.doggo.inputSampleRate }}"
56+
{{ end }}
5457
{{ if .Values.doggo.outputSampleRate }}
5558
- "--output-sample-rate={{ .Values.doggo.outputSampleRate }}"
5659
{{ end }}

charts/doggo/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ doggo:
1111
configureInput: false
1212
# whether to echo the audio input to the speaker (for debugging)
1313
echo: false
14+
# explicitly set the input sample rate
15+
inputSampleRate: ~
1416
# explicitly set the output sample rate for the speaker device
1517
outputSampleRate: ~
1618

doggo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,16 @@ async def loop(dog):
332332
@click.option("--voice", type=click.Choice(VOICES.keys()), default="michael")
333333
@click.option("--alive/--dead", is_flag=True, default=True)
334334
@click.option("--configure-input/--no-configure-input", is_flag=True, default=False)
335-
@click.option("--sample-rate", type=int, default=44100)
335+
@click.option("--input-sample-rate", type=int, default=44100)
336336
@click.option("--output-sample-rate", type=int, default=0)
337337
@click.option("--input-device", type=str, default="USB PnP")
338338
@click.option("--output-device", type=str, default="UACDemo")
339339
@click.option("--echo/--no-echo", is_flag=True, default=False)
340-
def main(voice, alive, configure_input, sample_rate, output_sample_rate, input_device, output_device, echo):
340+
def main(voice, alive, configure_input, input_sample_rate, output_sample_rate, input_device, output_device, echo):
341341
if configure_input:
342342
sd.default.device = (input_device, output_device)
343-
if sample_rate > 0:
344-
sd.default.samplerate = sample_rate
343+
if input_sample_rate > 0:
344+
sd.default.samplerate = input_sample_rate
345345
devices = sd.query_devices()
346346
print("Number of devices: ", len(devices))
347347
print("Devices: ", json.dumps(devices, indent=2))

0 commit comments

Comments
 (0)