Difference between revisions of "HackerHotel2019Badge/audio"
Jump to navigation
Jump to search
Line 9: | Line 9: | ||
For streaming audio, a wifi connection is of-course needed. | For streaming audio, a wifi connection is of-course needed. | ||
− | === Mixer ctl === | + | ===Mixer ctl=== |
− | < | + | Since the [[HackerHotel2019Badge/Hardware#Audiojack_reversed|audio jack is reversed]] on the badges, and we don't want to force you to do a hardware modification, in software we "invert" channel 0 and add left and right to channel 1, this fixes the audio issue for passive headphones. |
− | audio.mixer_ctl_1(128, 128)</ | + | |
+ | NB: This is automatically done by the firmware after the day 0 [[OTA]]. | ||
+ | You can chose to disable this mod or use the <nowiki>mixer_ctl</nowiki> api for other effects like balance between left and right, or swapping channels. | ||
+ | |||
+ | <nowiki>audio.mixer_ctl_0(-128, 0) | ||
+ | audio.mixer_ctl_1(128, 128)</nowiki> |
Revision as of 15:27, 11 February 2019
HackerHotel2019 Badge Audio API
Enjoying audio is easy.
import audio
audio.volume(11)
audio.play_mp3_stream('https://badge.team/RoccoW_-_06_-_Pumped.mp3')
For streaming audio, a wifi connection is of-course needed.
Mixer ctl
Since the audio jack is reversed on the badges, and we don't want to force you to do a hardware modification, in software we "invert" channel 0 and add left and right to channel 1, this fixes the audio issue for passive headphones.
NB: This is automatically done by the firmware after the day 0 OTA. You can chose to disable this mod or use the mixer_ctl api for other effects like balance between left and right, or swapping channels.
audio.mixer_ctl_0(-128, 0) audio.mixer_ctl_1(128, 128)