PumpkinPi による音声認識IRリモコンの作成
使用部品
- RasberryPi Zero WH
- PumpkinPi
- マイクロフォン
- DCジャック
- ケース(大型プッシュ 卓上ライト)
- 5V 電源アダプター(DCプラグ付き)
akizukidenshi.com/catalog/g/gK-05757/(新しいタブで開く)
内部構造



スケッチ等
pi@raspberrypi:~/julius-kit/grammar-kit-master/command $ cat command.yomi % PLEASE HIGHREZ はいれぞ CD1 しーでぃいち CD2 しーでぃに CHup ちゃんねるあげて CHdown ちゃんねるさげて MUTE みゅーと LEDon でんきつけて LEDoff でんきけして STOP きのうていし REBOOT さいきどう POWEROFF でんげんきる % NS_B [s] silB % NS_E [/s] silE
pi@raspberrypi:~/julius-kit/grammar-kit-master/command $ cat command.voca % PLEASE HIGHREZ h a i r e z o CD1 sh i: d i i ch i CD2 sh i: d i n i CHup ch a N n e r u a g e t e CHdown ch a N n e r u s a g e t e MUTE my u: t o LEDon d e N k i ts u k e t e LEDoff d e N k i k e sh i t e STOP k i n o u t e i sh i REBOOT s a i k i d o u POWEROFF d e N g e N k i r u % NS_B [s] silB % NS_E [/s] silE
pi@raspberrypi:~/julius-kit/grammar-kit-master/command $ cat command.dict 0 [HIGHREZ] h a i r e z o 0 [CD1] sh i: d i i ch i 0 [CD2] sh i: d i n i 0 [CHup] ch a N n e r u a g e t e 0 [CHdown] ch a N n e r u s a g e t e 0 [MUTE] my u: t o 0 [LEDon] d e N k i ts u k e t e 0 [LEDoff] d e N k i k e sh i t e 0 [STOP] k i n o u t e i sh i 0 [REBOOT] s a i k i d o u 0 [POWEROFF] d e N g e N k i r u 1 [[s]] silB 2 [[/s]] silE pi@raspberrypi:~/julius-kit/grammar-kit-master/command $ cat command.grammar S : NS_B PLEASE NS_E
pi@raspberrypi:~/PumpkinPi/Remocon $ cat remocon.py #! /usr/bin/python # for Pumpkin Pi # (C)Copyright 2016 All rights reserved by Y.Onodera # http://einstlab.web.fc2.com from __future__ import print_function import os import sys import socket from contextlib import closing def main(): host = '127.0.0.1' port = 10500 bufsize = 4096 b = "" index = -1 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) with closing(sock): sock.connect((host, port)) while True: # line = sys.stdin.readline().rstrip() # if len(line) == 0: # break a = sock.recv(bufsize) if "<RECOGOUT>" in a: b = "" b = b + a if "</RECOGOUT>" in a: # for debug # print(b) index = b.find("CM=",110) score = float(b[index+4:index+9]) print(score) # check score if score > 0.9: if "STOP" in b: print("STOP") # break if "REBOOT" in b: os.system("./REBOOT.sh") if "POWEROFF" in b: os.system("./POWEROFF.sh") if "HIGHREZ" in b: os.system("./HIGHREZ.sh") if "CD1" in b: os.system("./CD1.sh") if "CD2" in b: os.system("./CD2.sh") if "CHup" in b: os.system("./CHup.sh") if "CHdown" in b: os.system("./CHdown.sh") if "MUTE" in b: os.system("./MUTE.sh") if "LEDon" in b: os.system("./LEDon.sh") if "LEDoff" in b: os.system("./LEDoff.sh") return if __name__ == '__main__': main()
動作テスト
1.Apple PiによるインターネットラジオのIRリモコン動作
