Skip to content

Commit 89ba7f1

Browse files
committed
update wave_generator brick
1 parent 43e9ab3 commit 89ba7f1

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/arduino/app_bricks/wave_generator/examples/05_custom_speaker.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,18 @@
2020
from arduino.app_peripherals.speaker import Speaker
2121
from arduino.app_utils import App
2222

23-
# Create and configure a Speaker with specific parameters
23+
# Create a Speaker with specific parameters
2424
speaker = Speaker(
2525
device=Speaker.USB_SPEAKER_1,
2626
sample_rate=Speaker.RATE_48K,
2727
channels=Speaker.CHANNELS_MONO,
2828
format=np.float32,
29-
block_size=Speaker.BUFFER_SIZE_REALTIME,
29+
buffer_size=Speaker.BUFFER_SIZE_REALTIME,
30+
shared=False, # Exclusive access for low latency
3031
)
3132

3233
# Create WaveGenerator with the custom speaker
33-
wave_gen = WaveGenerator(
34-
speaker=speaker, # Pass pre-configured speaker
35-
)
34+
wave_gen = WaveGenerator(speaker)
3635

3736

3837
def play_sequence():

src/arduino/app_bricks/wave_generator/wave_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __init__(
6666
self._speaker = ALSASpeaker(
6767
device=Speaker.USB_SPEAKER_1,
6868
sample_rate=Speaker.RATE_48K,
69-
channels=1,
69+
channels=Speaker.CHANNELS_MONO,
7070
format=np.float32,
7171
buffer_size=Speaker.BUFFER_SIZE_REALTIME,
7272
shared=False,

0 commit comments

Comments
 (0)