Audio output #135
HMC123-puxel
started this conversation in
General
Replies: 1 comment
-
Hi @HMC123-puxel, Here is a video of me testing a 5KHz sine wave using the audio board and speaker you mentioned (make sure to unmute when playing). audio_board_test.movAre you getting similar results? If the noisiness you are referring to is present in my video, can you give more details about what you mean by it being quite noisy? Otherwise, if the output I'm getting is suitable / what you want, I can potentially help troubleshoot. I have modified the example/blinker.py task, adding a 5 KHz tone whenever blue led blinks: # A simple state machine which flashes the blue LED on the pyboard on and off.
# Does not require any hardware except micropython board.
from pyControl.utility import *
from devices import *
blue_LED = Digital_output("B4")
## added audio stuff
board = Breakout_1_2()
speaker = Audio_board(board.port_4) # Instantiate audio board on either port 3 or 4 of breakout v1.2
# States and events.
states = [
"LED_on",
"LED_off",
]
events = []
initial_state = "LED_off"
# State behaviour functions
def LED_on(event):
if event == "entry":
timed_goto_state("LED_off", 0.5 * second)
blue_LED.on()
speaker.sine(5000) # turn on 5KHz sine wave.
elif event == "exit":
blue_LED.off()
speaker.off() # turn off tone
def LED_off(event):
if event == "entry":
timed_goto_state("LED_on", 0.5 * second)
# Run end behaviour
def run_end(): # Turn off hardware at end of run.
blue_LED.off()
speaker.off() here are a couple of troubleshooting ideas:
Best, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using the PyControl's (audio board and speaker but the tones are quite noisy (e.g., 5KHz sine wave). are there any settings to clear better the played tones? will using a better speaker (e.g., speaker help? what is the recommended speaker's impedance and what is the amp output power (to find alternative compatible speakers)?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions