Introduction
CircuitPython driver for WM8960 Stereo CODEC
Dependencies
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.
This library is designed to help facilite the I2C connection with a WM8960 audio codec to configure it to be used for DAC, ADC, headphone and speaker functionality.
This library has been tested using an RP2040 on CircuitPython 9.1.1 and the SparkFun Audio Codec PBreakout - WM8960.
Installing from PyPI
Note
This library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI.
To install for current user:
pip3 install adafruit-circuitpython-wm8960
To install system-wide (this may be required in some cases):
sudo pip3 install adafruit-circuitpython-wm8960
To install in a virtual environment in your current project:
mkdir project-name && cd project-name
python3 -m venv .venv
source .env/bin/activate
pip3 install adafruit-circuitpython-wm8960
Installing to a Connected CircuitPython Device with Circup
Make sure that you have circup
installed in your Python environment.
Install it with the following command if necessary:
pip3 install circup
With circup
installed and your CircuitPython device connected use the
following command to install:
circup install adafruit_wm8960
Or the following command to update an existing version:
circup update
Usage Example
# Monitor Stereo Input: INPUT3 => Output Mixer => Headphones
import board
from adafruit_wm8960 import Input, WM8960
codec = WM8960(board.I2C())
codec.input = Input.LINE3
codec.gain = 0.5
codec.monitor = 1.0
codec.headphone = 0.5
Documentation
API documentation for this library can be found on Read the Docs.
Contributing
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Table of Contents
adafruit_wm8960.advanced
ADC_VOLUME_MAX
ADC_VOLUME_MIN
ALC_ATTACK_TIME_MAX
ALC_ATTACK_TIME_MIN
ALC_DECAY_TIME_MAX
ALC_DECAY_TIME_MIN
ALC_HOLD_TIME_MAX
ALC_HOLD_TIME_MIN
ALC_MAX_GAIN_MAX
ALC_MAX_GAIN_MIN
ALC_MIN_GAIN_MAX
ALC_MIN_GAIN_MIN
ALC_TARGET_MAX
ALC_TARGET_MIN
AMP_VOLUME_MAX
AMP_VOLUME_MIN
BOOST_GAIN_MAX
BOOST_GAIN_MIN
DAC_VOLUME_MAX
DAC_VOLUME_MIN
GATE_THRESHOLD_MAX
GATE_THRESHOLD_MIN
MIC_GAIN_MAX
MIC_GAIN_MIN
Mic_Input
OUTPUT_VOLUME_MAX
OUTPUT_VOLUME_MIN
Vmid_Mode
WM8960_Advanced
WM8960_Advanced.adc
WM8960_Advanced.adc_channel_swap
WM8960_Advanced.adc_clock_divider
WM8960_Advanced.adc_volume
WM8960_Advanced.alc
WM8960_Advanced.alc_attack_time
WM8960_Advanced.alc_decay_time
WM8960_Advanced.alc_hold_time
WM8960_Advanced.alc_limiter
WM8960_Advanced.alc_max_gain
WM8960_Advanced.alc_min_gain
WM8960_Advanced.alc_target
WM8960_Advanced.amp_clock_divider
WM8960_Advanced.base_clock_divider
WM8960_Advanced.bit_depth
WM8960_Advanced.clock_fractional_mode
WM8960_Advanced.clock_from_pll
WM8960_Advanced.dac
WM8960_Advanced.dac_attenuation
WM8960_Advanced.dac_clock_divider
WM8960_Advanced.dac_mute
WM8960_Advanced.dac_output
WM8960_Advanced.dac_slow_soft_mute
WM8960_Advanced.dac_soft_mute
WM8960_Advanced.dac_volume
WM8960_Advanced.enhance
WM8960_Advanced.enhance_depth
WM8960_Advanced.enhance_filter_hpf
WM8960_Advanced.enhance_filter_lpf
WM8960_Advanced.gpio_clock_divider
WM8960_Advanced.gpio_output
WM8960_Advanced.gpio_output_invert
WM8960_Advanced.gpio_output_mode
WM8960_Advanced.headphone
WM8960_Advanced.headphone_standby
WM8960_Advanced.headphone_volume
WM8960_Advanced.headphone_zero_cross
WM8960_Advanced.input
WM8960_Advanced.input2_boost
WM8960_Advanced.input3_boost
WM8960_Advanced.input3_output
WM8960_Advanced.input3_output_volume
WM8960_Advanced.left_adc
WM8960_Advanced.left_adc_volume
WM8960_Advanced.left_alc
WM8960_Advanced.left_dac
WM8960_Advanced.left_dac_output
WM8960_Advanced.left_dac_volume
WM8960_Advanced.left_headphone
WM8960_Advanced.left_headphone_volume
WM8960_Advanced.left_headphone_zero_cross
WM8960_Advanced.left_input
WM8960_Advanced.left_input2_boost
WM8960_Advanced.left_input3_boost
WM8960_Advanced.left_input3_output
WM8960_Advanced.left_input3_output_volume
WM8960_Advanced.left_mic
WM8960_Advanced.left_mic_boost
WM8960_Advanced.left_mic_boost_gain
WM8960_Advanced.left_mic_input
WM8960_Advanced.left_mic_inverting_input
WM8960_Advanced.left_mic_mute
WM8960_Advanced.left_mic_output
WM8960_Advanced.left_mic_output_volume
WM8960_Advanced.left_mic_volume
WM8960_Advanced.left_mic_zero_cross
WM8960_Advanced.left_output
WM8960_Advanced.left_speaker
WM8960_Advanced.left_speaker_volume
WM8960_Advanced.left_speaker_zero_cross
WM8960_Advanced.loopback
WM8960_Advanced.master_mode
WM8960_Advanced.mic
WM8960_Advanced.mic_bias
WM8960_Advanced.mic_bias_voltage
WM8960_Advanced.mic_boost
WM8960_Advanced.mic_boost_gain
WM8960_Advanced.mic_input
WM8960_Advanced.mic_inverting_input
WM8960_Advanced.mic_mute
WM8960_Advanced.mic_output
WM8960_Advanced.mic_output_volume
WM8960_Advanced.mic_volume
WM8960_Advanced.mic_zero_cross
WM8960_Advanced.mono_left_mix
WM8960_Advanced.mono_mix
WM8960_Advanced.mono_output
WM8960_Advanced.mono_output_attenuation
WM8960_Advanced.mono_right_mix
WM8960_Advanced.noise_gate
WM8960_Advanced.noise_gate_threshold
WM8960_Advanced.output
WM8960_Advanced.pll
WM8960_Advanced.pll_k
WM8960_Advanced.pll_n
WM8960_Advanced.pll_prescale_div2
WM8960_Advanced.power
WM8960_Advanced.power_supply
WM8960_Advanced.reset()
WM8960_Advanced.right_adc
WM8960_Advanced.right_adc_volume
WM8960_Advanced.right_alc
WM8960_Advanced.right_dac
WM8960_Advanced.right_dac_output
WM8960_Advanced.right_dac_volume
WM8960_Advanced.right_headphone
WM8960_Advanced.right_headphone_volume
WM8960_Advanced.right_headphone_zero_cross
WM8960_Advanced.right_input
WM8960_Advanced.right_input2_boost
WM8960_Advanced.right_input3_boost
WM8960_Advanced.right_input3_output
WM8960_Advanced.right_input3_output_volume
WM8960_Advanced.right_mic
WM8960_Advanced.right_mic_boost
WM8960_Advanced.right_mic_boost_gain
WM8960_Advanced.right_mic_input
WM8960_Advanced.right_mic_inverting_input
WM8960_Advanced.right_mic_mute
WM8960_Advanced.right_mic_output
WM8960_Advanced.right_mic_output_volume
WM8960_Advanced.right_mic_volume
WM8960_Advanced.right_mic_zero_cross
WM8960_Advanced.right_output
WM8960_Advanced.right_speaker
WM8960_Advanced.right_speaker_volume
WM8960_Advanced.right_speaker_zero_cross
WM8960_Advanced.sample_rate
WM8960_Advanced.speaker
WM8960_Advanced.speaker_ac_gain
WM8960_Advanced.speaker_dc_gain
WM8960_Advanced.speaker_volume
WM8960_Advanced.speaker_zero_cross
WM8960_Advanced.system_clock_div2
WM8960_Advanced.vmid
WM8960_Advanced.vref_output
WM8960_Advanced.word_select_invert