# Programming with MicroPython: I2S Microphone

### Import FutureBoard Library

Import the Library to make use of its functions.

```
from future import *
```

### 09: I2S Microphone

### Import I2S Library

```
import audio
```

#### 1. Initiate the Microphone

```
au=audio.Audio()
```

#### 2. Get Loudness

```
au.loudness()
```

Returns the detected loudness, values ranges from 0\~4095.

#### 3. Voice Recognition

```
au.recognize(sec=1,vid=1737)
```

Voice Recognition requires Internet Connection.

Set the recognition length in seconds with parameter sec, recommended length is 1\~3.

4 languages are supported currently, put the code into the vid parameter.

1. 1537: Putonghua
2. 1737: English
3. 1637: Cantonese
4. 1837: Szechuan Dialect

#### Sample Program: Loudness

```
import time
import audio
au = audio.Audio() 

while 1:
  time.sleep(0.1)
  print(au.loudness())
```

#### Sample Program

```
#/bin/python
from future import *

import audio
au = audio.Audio()

wifi.connect("", "")
screen.clear()
screen.text(au.recognize(vid=1737, sec=2),5,10,1,(0, 119, 255))
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sharinghub-eng.kittenbot.hk/main-controllers/futureboard/futureboard-micropython-programming-tutorial/programming-with-micropython-i2s-microphone.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
