接受音频输入
(self)
| 646 | thread_vc.start() |
| 647 | |
| 648 | def soundinput(self): |
| 649 | """ |
| 650 | 接受音频输入 |
| 651 | """ |
| 652 | channels = 1 if sys.platform == "darwin" else 2 |
| 653 | with sd.Stream( |
| 654 | channels=channels, |
| 655 | callback=self.audio_callback, |
| 656 | blocksize=self.block_frame, |
| 657 | samplerate=self.gui_config.samplerate, |
| 658 | dtype="float32", |
| 659 | ) as stream: |
| 660 | global stream_latency |
| 661 | stream_latency = stream.latency[-1] |
| 662 | while self.flag_vc: |
| 663 | time.sleep(self.gui_config.block_time) |
| 664 | printt("Audio block passed.") |
| 665 | printt("ENDing VC") |
| 666 | |
| 667 | def audio_callback( |
| 668 | self, indata: np.ndarray, outdata: np.ndarray, frames, times, status |