MCPcopy Create free account
hub / github.com/Standard-Intelligence/hertz-dev / start

Method start

inference_client.py:96–132  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

94 self.output_queue.put(processed_audio)
95
96 def start(self):
97 self.running = True
98 # Print audio device information
99 devices = sd.query_devices()
100 default_input = sd.query_devices(kind='input')
101 default_output = sd.query_devices(kind='output')
102
103 print("\nAudio Device Configuration:")
104 print("-" * 50)
105 print(f"Default Input Device:\n{default_input}\n")
106 print(f"Default Output Device:\n{default_output}\n")
107 print("\nAll Available Devices:")
108 print("-" * 50)
109 for i, device in enumerate(devices):
110 print(f"Device {i}:")
111 print(f"Name: {device['name']}")
112 print(f"Channels (in/out): {device['max_input_channels']}/{device['max_output_channels']}")
113 print(f"Sample Rates: {device['default_samplerate']}")
114 print()
115 input_device = input("Enter the index of the input device or press enter for default: ")
116 output_device = input("Enter the index of the output device or press enter for default: ")
117 if input_device == "":
118 input_device = default_input['index']
119 if output_device == "":
120 output_device = default_output['index']
121 with sd.InputStream(callback=self.audio_callback,
122 channels=CHANNELS,
123 samplerate=SAMPLE_RATE,
124 device=int(input_device),
125 blocksize=2000), \
126 sd.OutputStream(callback=self.output_stream_callback,
127 channels=CHANNELS,
128 samplerate=SAMPLE_RATE,
129 blocksize=2000,
130 device=int(output_device)):
131
132 asyncio.run(self.process_audio())
133
134 def stop(self):
135 self.running = False

Callers 1

Calls 1

process_audioMethod · 0.95

Tested by

no test coverage detected