1# Micro Speech Example for Spresense 2 3Here explaines how to build and execute this Micro Speach Example for Spresense. 4To try this on the Spresense, below hardware is required. 5 6Spresense Main board, which is a microcontroller board. Spresense Extention 7board, which is for connecting a mic like MEMS mic. Analog mic, which is like 8MEMS mic. 9 10To connect a mic on Spresense Extention board, the following page helps you. 11[How to use microphons](https://developer.sony.com/develop/spresense/docs/hw_docs_en.html#_how_to_use_microphones) 12 13For this example, the Mic-A is used. 14 15## Table of contents 16 17- [How to build](#how-to-build) 18- [How to run](#how-to-run) 19 20## How to build 21 22The tensorflow.git will be downloaded in build system of Spresense. 23 24### Initial setup 25 26The Spresense SDK build system is required to build this example. The following 27instructions will help you to make it on your PC. 28[Spresense SDK Getting Started Guide:EN](https://developer.sony.com/develop/spresense/docs/sdk_set_up_en.html) 29[Spresense SDK Getting Started Guide:JA](https://developer.sony.com/develop/spresense/docs/sdk_set_up_ja.html) 30[Spresense SDK Getting Started Guide:CN](https://developer.sony.com/develop/spresense/docs/sdk_set_up_zh.html) 31 32And after setup the build system, download 33[Spresense repository](https://github.com/sonydevworld/spresense). 34 35``` 36git clone --recursive https://github.com/sonydevworld/spresense.git 37``` 38 39### Configure Spresense for this example 40 41The Spresense SDK uses Kconfig mechanism for configuration of software 42components. So at first, you need to configure it for this example. Spresense 43SDK provides some default configurations, and there is a default config to build 44this Micro Speach example. 45 461. Go to sdk/ directory in the repository. 47 48 ``` 49 cd spresense/sdk 50 ``` 51 522. Execute config.py to configure for this example. 53 54 ``` 55 ./tools/config.py examples/tf_example_micro_speech 56 ``` 57 58This command creates .config file in spesense/nuttx directory. 59 60### Build and Flash the binary into Spresense Main board 61 62After configured, execute make and then flash built image. 63 641. Execute "make" command in the same directory you configured. 65 66 ``` 67 make 68 ``` 69 702. Flash built image into Spresense main board. If the build is successful, a 71 file named nuttx.spk will be created in the current directory, and flash it 72 into Spresense Main board. Make sure USB cable is connected between the 73 board and your PC. The USB will be recognized as USB/serial device like 74 /dev/ttyUSB0 in your PC. In this explanation, we will assume that the device 75 is recognized as /dev/ttyUSB0. 76 77 ``` 78 ./tools/flash.sh -c /dev/ttyUSB0 nuttx.spk 79 ``` 80 81## How to run 82 83To run the example, connect to the device with a terminal soft like "minicom". 84Then you can see a "nsh>" prompt on it. (If you can't see the prompt, try to 85press enter.) 86 871. Execute tf_example command on the prompt. 88 89 ``` 90 nsh> tf_example 91 ``` 92 932. Speak 'yes' or 'no' on your mic. If the Micro Speech recognized it, the log 94 shows 'yes' or 'no'. 95