Noise Nugget SDK
noise_nugget.h File Reference

API for the Noise Nugget development board, which offers digital audio processing and synthesis. More...

#include <stdint.h>
#include <stdbool.h>
Include dependency graph for noise_nugget.h:

Go to the source code of this file.

Typedefs

typedef void(* audio_cb_t) (uint32_t **buffer, uint32_t *stereo_point_count)
 Defines a callback type for audio processing. More...
 

Functions

bool audio_init (int sample_rate, audio_cb_t output_callback, audio_cb_t input_callback)
 Initializes the audio system of the Noise Nugget board. More...
 

Detailed Description

API for the Noise Nugget development board, which offers digital audio processing and synthesis.

This file provides the initialization functions and callback mechanisms needed to interface with the Noise Nugget's audio processing capabilities.

Typedef Documentation

◆ audio_cb_t

audio_cb_t

Defines a callback type for audio processing.

This callback function is used by the Noise Nugget development board to handle audio data processing. The function will be called when audio data needs to be output or input through the board. The callback must return as fast as possible to not interrupt the flow of sample being played/recorded. Therefore any audio synthesis or processing must be done separately, for instance using flip buffers, the callbacks are just here to provide pointers to the next fresh buffers.

Parameters
bufferDouble pointer to the audio data buffer. Set *buffer with the address of the next stereo audio samples (uint32_t) to be played/recorded, or set *buffer to NULL if there is no buffer available.
stereo_point_countPointer to the number of stereo points (left-right pairs) available in the buffer. Set *stereo_point_count to specified the size of the buffer to be played/recorded.

Function Documentation

◆ audio_init()

bool audio_init ( int  sample_rate,
audio_cb_t  output_callback,
audio_cb_t  input_callback 
)

Initializes the audio system of the Noise Nugget board.

This function initializes the audio system with a specified sample rate and sets up the necessary callback functions for audio data input and output.

Parameters
sample_rateThe audio sample rate to be configured. Typical values might include 44100 or 21500 Hz.
output_callbackThe callback function to be invoked when an audio output buffer is required.
input_callbackThe callback function to be invoked when an audio input buffer is required.
Returns
Returns true if the audio system was successfully initialized, false otherwise.