Skip to content

File ns_audio.c

FileList > neuralSPOT > neuralspot > ns-audio > src > ns_audio.c

Go to the source code of this file

Implementation of the NeuralSPOT ns-audio API. More...

  • #include "ns_audio.h"
  • #include "am_bsp.h"
  • #include "am_mcu_apollo.h"
  • #include "am_util.h"
  • #include "ns_audadc.h"
  • #include "ns_ipc_ring_buffer.h"
  • #include "ns_pdm.h"

Public Attributes

Type Name
ns_audio_config_t * g_ns_audio_config
Audio Configuration and State.
const ns_core_api_t ns_audio_V0_0_1
const ns_core_api_t ns_audio_V1_0_0
const ns_core_api_t ns_audio_V2_0_0
const ns_core_api_t ns_audio_V2_1_0
const ns_core_api_t ns_audio_current_version
const ns_core_api_t ns_audio_oldest_supported_version

Public Functions

Type Name
void ns_audio_getPCM (int16_t * pcm, uint32_t * raw, int16_t len)
Extract int16 PCM from data collected by ADC.
void ns_audio_getPCM_v2 (ns_audio_config_t * config, void * pcm)
Extract int16 PCM from AUDADC or PDM sources.
uint32_t ns_audio_init (ns_audio_config_t * cfg)
Initialize NeuralSPOT audio capture library.
uint32_t ns_end_audio (ns_audio_config_t * cfg)
Stop audio capture.
uint32_t ns_start_audio (ns_audio_config_t * cfg)
Start audio capture, must be called after ns_audio_init.

Detailed Description

Purpose: A single point of entry for capturing Ambiq Audio

Public Attributes Documentation

variable g_ns_audio_config

ns_audio_config_t* g_ns_audio_config;

variable ns_audio_V0_0_1

const ns_core_api_t ns_audio_V0_0_1;

variable ns_audio_V1_0_0

const ns_core_api_t ns_audio_V1_0_0;

variable ns_audio_V2_0_0

const ns_core_api_t ns_audio_V2_0_0;

variable ns_audio_V2_1_0

const ns_core_api_t ns_audio_V2_1_0;

variable ns_audio_current_version

const ns_core_api_t ns_audio_current_version;

variable ns_audio_oldest_supported_version

const ns_core_api_t ns_audio_oldest_supported_version;

Public Functions Documentation

function ns_audio_getPCM

Extract int16 PCM from data collected by ADC.

void ns_audio_getPCM (
    int16_t * pcm,
    uint32_t * raw,
    int16_t len
) 

Parameters:

  • pcm - resulting PCM data
  • raw - incoming data from ADC engine
  • len - number of sample words to convert

function ns_audio_getPCM_v2

Extract int16 PCM from AUDADC or PDM sources.

void ns_audio_getPCM_v2 (
    ns_audio_config_t * config,
    void * pcm
) 

Parameters:

  • config - ns audio config
  • pcm - resulting PCM data

function ns_audio_init

Initialize NeuralSPOT audio capture library.

uint32_t ns_audio_init (
    ns_audio_config_t * cfg
) 

Parameters:

  • cfg : desired configuration

function ns_end_audio

Stop audio capture.

uint32_t ns_end_audio (
    ns_audio_config_t * cfg
) 

Parameters:

  • cfg : desired configuration

function ns_start_audio

Start audio capture, must be called after ns_audio_init.

uint32_t ns_start_audio (
    ns_audio_config_t * cfg
) 

Parameters:

  • cfg : desired configuration

The documentation for this class was generated from the following file neuralSPOT/neuralspot/ns-audio/src/ns_audio.c