HackerHotel2019Badge/audio

From Badge team
Revision as of 15:27, 11 February 2019 by AnneJan (talk | contribs) (→‎Mixer ctl)
Jump to navigation Jump to search

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)