Skip to content

Commit ae2d905

Browse files
authored
Fix Audio Playback Issues (#17)
* Fix Audio Playback Issues Fixes #16 Update `play_audio` function to maintain original channel configuration. * Change `play_audio` function in `nova.py` to read the audio file with `always_2d=False`. * Update `play_tts` function to use the updated `play_audio` function. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/S0L0GUY/NOVA-AI/issues/16?shareId=XXXX-XXXX-XXXX-XXXX). * Update audio settings and enhance device listing * Format output for audio device listing to improve readability
1 parent 89b773f commit ae2d905

File tree

8 files changed

+8
-4
lines changed

8 files changed

+8
-4
lines changed
30 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.
188 Bytes
Binary file not shown.
-23 Bytes
Binary file not shown.

constants.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
# Audio Settings
66
# The index of the audio output device (VB-Audio Cable B)
7-
AUDIO_OUTPUT_INDEX = 7
7+
AUDIO_OUTPUT_INDEX = 10
88

99
# LM Settings
1010
# The model ID of the LM
1111
MODEL_ID = "lmstudio-community/Meta-Llama-3.1-8B-Instruct-GGUF"
1212
LM_TEMPERATURE = 0.5 # The temperature of the LM
13+
14+
HISTORY_PATH = "json_files/history.json"

list_audio_devices.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33

44
def list_audio_devices():
5-
"""List all of the audio devices and their indexes."""
5+
"""List all of the audio devices, their indexes, and number of channels."""
66
p = pyaudio.PyAudio()
77
device_count = p.get_device_count()
88

99
print("Available Audio Devices:")
1010
for i in range(device_count):
1111
device_info = p.get_device_info_by_index(i)
12-
print(f"Index {i}: {device_info['name']}")
12+
print(f"Index {i}: {device_info['name']}, "
13+
f"Channels: {device_info['maxInputChannels']}")
1314

1415
p.terminate()
1516

main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def main():
1414
osc = VRChatOSC(constant.LOCAL_IP, constant.VRC_PORT)
1515
while True:
1616
try:
17+
print("Program Starting...")
1718
nova.run_code()
1819
except Exception as e:
1920
logging.error(f"An error occurred: {e}")

nova.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def play_tts(text, output_device_index=constant.AUDIO_OUTPUT_INDEX):
5252
engine.runAndWait()
5353

5454
def play_audio(file_path, output_device_index):
55-
data, samplerate = sf.read(file_path, always_2d=True)
55+
data, samplerate = sf.read(file_path, always_2d=False)
5656
sd.play(data, samplerate, device=output_device_index)
5757
sd.wait()
5858

0 commit comments

Comments
 (0)