Skip to main content

Introduction

Documentation Status Discord Build Status Code Style: Ruff

Driver library for the nuvoton NAU88L21 audio 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.

Installing from PyPI

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-nau88l21

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-nau88l21

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-nau88l21

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_nau88l21

Or the following command to update an existing version:

circup update

Usage Example

import time

import audiobusio
import board
import synthio

import adafruit_nau88l21

RATE = 48000  # frame rate on the wire; also what the codec's FLL locks to

DAC_VOLUME = 0
HEADPHONE_VOLUME = 0

# MIDI note numbers for a C-major scale, C4 up to C5.
SCALE = (60, 62, 64, 65, 67, 69, 71, 72)
NOTE_SECONDS = 0.4

# CAUTION: this drives the headphone amplifier. Take the headphones off before
# the first run and confirm the level is comfortable before wearing them.

i2s = audiobusio.I2SOut(board.I2S_BIT_CLOCK, board.I2S_WORD_SELECT, board.I2S_DOUT)

synth = synthio.Synthesizer(sample_rate=RATE)

i2s.play(synth)

codec = adafruit_nau88l21.NAU88L21(board.I2C())
codec.configure_clocks()

codec.headphone_output = True
codec.dac_volume = DAC_VOLUME
codec.headphone_volume = HEADPHONE_VOLUME

print("playing scale")
try:
    while True:
        for note in SCALE:
            synth.press(note)
            time.sleep(0.25)
            synth.release(note)
            time.sleep(0.125)
finally:
    i2s.stop()
    i2s.deinit()

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Metadata

Release files for adafruit-circuitpython-nau88l21 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adafruit-circuitpython-nau88l21 1.0.1
File Size Uploaded
adafruit_circuitpython_nau88l21-1.0.1.tar.gz 40.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for adafruit-circuitpython-nau88l21 1.0.1
File Interpreter ABI Platform
adafruit_circuitpython_nau88l21-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 61.0 kB

Release files / adafruit_circuitpython_nau88l21-1.0.1.tar.gz

Download URL adafruit_circuitpython_nau88l21-1.0.1.tar.gz
Size 40.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9a5a0f848cbe72ee415cbe304a61e188fa2ed002bf4c00216281f23f8cfcdf93
BLAKE2b-256 checksum
How to use checksums
acd0e1c16188a7afdcd5c26ff3d83736de6ea454623a0233b5a12de361dd27f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / adafruit_circuitpython_nau88l21-1.0.1-py3-none-any.whl

Download URL adafruit_circuitpython_nau88l21-1.0.1-py3-none-any.whl
Size 20.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fad293c21d9cb51630462a49b74cc7282f7989643a90a76f41bfc64160166bb
BLAKE2b-256 checksum
How to use checksums
81e82805d3bc310c054573fdaa75e4bf224331a99187e3b3abe3e380f962f3e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page