Audio
Square-wave tone and melody output on OUT0.
import "lib/audio.nbl";
AUDIO_MASK selects the output pin. audio_init() selects CLOCK_100K.
Notes 0 through 15 are C4 through D#5. NOTE_REST is silent. A melody is a
flash table of note/duration byte pairs terminated by 0xFF. Rest durations
above 15 are split into 15-unit delay calls.
Timing depends on Clock and the instruction mix.
Constants
Name |
Type |
Value |
|---|---|---|
|
|
|
|
|
|
|
|
table |
Functions
Call |
Returns |
Notes |
|---|---|---|
|
|
|
|
|
|
|
|
Raw tone. half_period is the inner-loop count; cycles is the number of half periods (two cycles = one full wave). |
|
|
Play one note from the table. Notes 0..15 are C4..D#5; NOTE_REST is silent, and 0xFF terminates a melody. |
|
|
Play a flash melody of note/duration byte pairs, terminated by 0xFF. |