Voice Kit

Neil HaddleyOctober 11, 2025

Raspberry Pi Voice Kit

The Google AIY Voice Kit is a do-it-yourself version of a Google Home assistant. This kit includes a Raspberry Pi Zero computer, a speaker, a microphone, a button, and a cardboard casing for a hands-on build experience.

Raspberry Pi Hat

Raspberry Pi Hat

Cardboard assembled

Cardboard assembled

[Download image](https://github.com/google/aiyprojects-raspbian/releases)

[Download image](https://github.com/google/aiyprojects-raspbian/releases)

Image flashed to MicroSD Card

Image flashed to MicroSD Card

I enabled xrdp and connected to pi remotely

I enabled xrdp and connected to pi remotely

BASH
1pi@raspberrypi:~ $ sudo apt-get install xrdp
2...
3pi@raspberrypi:~ $ sudo service xrdp start

Notice that "apt-get --allow-releaseinfo-change update" could have been used to update the Buster image.

I ran the Check audio script

I ran the Check audio script

I ran the voice_recorder script

I ran the voice_recorder script

voice_recorder.py

PYTHON
1#!/usr/bin/env python3
2# Copyright 2017 Google Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16import argparse
17import time
18import threading
19
20from aiy.board import Board
21from aiy.voice.audio import AudioFormat, play_wav, record_file, Recorder
22
23def main():
24    parser = argparse.ArgumentParser()
25    parser.add_argument('--filename', '-f', default='recording.wav')
26    args = parser.parse_args()
27
28    with Board() as board:
29        print('Press button to start recording.')
30        board.button.wait_for_press()
31
32        done = threading.Event()
33        board.button.when_pressed = done.set
34
35        def wait():
36            start = time.monotonic()
37            while not done.is_set():
38                duration = time.monotonic() - start
39                print('Recording: %.02f seconds [Press button to stop]' % duration)
40                time.sleep(0.5)
41
42        record_file(AudioFormat.CD, filename=args.filename, wait=wait, filetype='wav')
43        print('Press button to play recorded sound.')
44        board.button.wait_for_press()
45
46        print('Playing...')
47        play_wav(args.filename)
48        print('Done.')
49
50if __name__ == '__main__':
51    main()
52
53

References