smartmic  2.0.0.0
Main Page

Smart Mic click

PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU

[click Product page](CLICK_PRODUCT_PAGE_LINK)


Click library

  • Author : Stefan Filipovic
  • Date : Mar 2022.
  • Type : I2C/SPI type

Software Support

We provide a library for the Smart Mic Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for Smart Mic Click driver.

Standard key functions :

Example key functions :

  • smartmic_wait_keyword This function waits for a keyword event and then reads it and returns the keyword ID number.
  • smartmic_download_keyword This function downloads keyword models to the module.
    err_t smartmic_download_keyword ( smartmic_t *ctx, uint16_t *data_in, uint16_t len );
  • smartmic_voice_make This function performs voice make feature. It stops the route, then sets digital gain to 20db, sample rate to 16K, frame size to 16 ms, and finally it selects route 6 and configures algorithm parameters.

Example Description

This example demonstrates the use of Smart Mic click board by programming it with 4 different keywords, and then waiting for a keyword event,

parsing it and displaying on the USB UART.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration which programs the device with system config, firmware, and 4 keywords

("Hello VoiceQ","Switch The Light","Next Song","Baidu Yixia") binaries.

void application_init ( void )
{
log_cfg_t log_cfg;
smartmic_cfg_t smartmic_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
smartmic_cfg_setup( &smartmic_cfg );
SMARTMIC_MAP_MIKROBUS( smartmic_cfg, MIKROBUS_1 );
if ( SMARTMIC_OK != smartmic_init( &smartmic, &smartmic_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf( &logger, " Configuring device... \r\n" );
if ( SMARTMIC_OK != smartmic_default_cfg ( &smartmic ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Waits for a keyword event, parses it and displays on the USB UART an appropriate message for the detected keyword.

void application_task ( void )
{
switch ( smartmic_wait_keyword ( &smartmic ) )
{
{
log_printf ( &logger, " Hello VoiceQ keyword detected!\r\n" );
break;
}
{
log_printf ( &logger, " Switch The Light keyword detected!\r\n" );
break;
}
{
log_printf ( &logger, " Next Song keyword detected!\r\n" );
break;
}
{
log_printf ( &logger, " Baidu YiXia keyword detected!\r\n" );
break;
}
}
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.SmartMic

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.


SMARTMIC_OK
@ SMARTMIC_OK
Definition: smartmic.h:305
smartmic_cfg_setup
void smartmic_cfg_setup(smartmic_cfg_t *cfg)
Smart Mic configuration object setup function.
smartmic_cfg_t
Smart Mic Click configuration object.
Definition: smartmic.h:270
SMARTMIC_OEM4_KWD_DETECTED
#define SMARTMIC_OEM4_KWD_DETECTED
Definition: smartmic.h:162
application_task
void application_task(void)
Definition: main.c:70
smartmic_download_keyword
err_t smartmic_download_keyword(smartmic_t *ctx, uint16_t *data_in, uint16_t len)
Smart Mic download keyword function.
smartmic_s
Smart Mic Click context object.
Definition: smartmic.h:246
SMARTMIC_OEM3_KWD_DETECTED
#define SMARTMIC_OEM3_KWD_DETECTED
Definition: smartmic.h:161
smartmic_init
err_t smartmic_init(smartmic_t *ctx, smartmic_cfg_t *cfg)
Smart Mic initialization function.
smartmic_wait_keyword
err_t smartmic_wait_keyword(smartmic_t *ctx)
Smart Mic wait keyword function.
SMARTMIC_OEM1_KWD_DETECTED
#define SMARTMIC_OEM1_KWD_DETECTED
Definition: smartmic.h:159
application_init
void application_init(void)
Definition: main.c:32
SMARTMIC_OEM2_KWD_DETECTED
#define SMARTMIC_OEM2_KWD_DETECTED
Definition: smartmic.h:160
smartmic_default_cfg
err_t smartmic_default_cfg(smartmic_t *ctx)
Smart Mic default configuration function.
smartmic_voice_make
err_t smartmic_voice_make(smartmic_t *ctx)
Smart Mic voice make function.
SMARTMIC_MAP_MIKROBUS
#define SMARTMIC_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: smartmic.h:226