README.md
1# lws secure streams alexa
2
3This demonstrates AVS Alexa usage using secure streams. It connects to AVS,
4uses your linux computer's microphone to wait for the 'alexa' wakeword, sends
5the utterance to AVS and plays back the result.
6
7## build
8
9There are some special build considerations:
10
111) Build lws with cmake options `-DLWS_WITH_ALSA=1 -DLWS_WITH_SECURE_STREAMS=1`
12
132) Install distro build dependency packages:
14
15 |Dependency|Ubuntu package|Fedora Package|
16 |---|---|---|
17 |libasound|libasound2-dev|alsa-lib-devel|
18 |mpg123|libmpg123-dev|mpg123-devel|
19
203) Clone Picovoice Porcupine Apache-licensed demo version from here
21
22 https://github.com/Picovoice/porcupine
23
24 It provides binary libs for wakeword detection on various platforms. Copy
25 the headers and binary lib to your build context, eg, for native x86_64
26
27```
28 $ sudo cp ./include/* /usr/include
29 $ sudo cp ./lib/linux/x86_64/libpv_porcupine.* /usr/lib
30 $ sudo ldconfig
31```
32
33 Enter the minimal example dir for secure-streams-alexa and make the sample
34
35```
36 $ cd ./minimal-examples/secure-streams/minimal-secure-streams-alexa
37 $ cmake .
38 $ make
39```
40
41## usage
42
43```
44 $ ./lws-minimal-secure-streams-alexa
45[2019/10/16 16:22:01:1097] U: LWS secure streams - Alex voice test [-d<verb>]
46[2019/10/16 16:22:01:1115] N: lws_create_context: creating Secure Streams policy
47[2019/10/16 16:22:01:1115] N: lwsac_use: alloc 1532 for 1
48[2019/10/16 16:22:01:1119] N: lwsac_use: alloc 288 for 168
49[2019/10/16 16:22:01:1119] N: lws_ss_policy_set: policy lwsac size: 1.796KiB, pad 11%
50[2019/10/16 16:22:02:4114] N: lws_ss_client_connect: connecting 0 api.amazon.com /auth/o2/token
51[2019/10/16 16:22:02:8686] N: auth_api_amazon_com_parser_cb: expires in 3600
52[2019/10/16 16:22:02:8686] N: ss_api_amazon_auth_rx: acquired 656-byte api.amazon.com auth token
53[2019/10/16 16:22:02:8754] N: lws_ss_client_connect: connecting 1 alexa.na.gateway.devices.a2z.com /v20160207/directives
54[2019/10/16 16:22:02:3182] N: secstream_h2: h2 client entering LONG_POLL
55[2019/10/16 16:22:02:3183] U: Connected to Alexa... speak "Alexa, ..."
56[2019/10/16 16:22:06:9380] W: ************* Wakeword
57[2019/10/16 16:22:06:9380] N: avs_query_start:
58[2019/10/16 16:22:06:9381] N: lws_ss_client_connect: connecting 1 alexa.na.gateway.devices.a2z.com /v20160207/events
59[2019/10/16 16:22:06:9381] N: lws_vhost_active_conns: just join h2 directly
60[2019/10/16 16:22:06:9384] N: metadata done
61[2019/10/16 16:22:06:1524] N: est: 42 1
62[2019/10/16 16:22:06:3723] N: est: 108 1
63[2019/10/16 16:22:07:5914] N: est: 352 1
64[2019/10/16 16:22:07:8112] N: est: 4284 1
65[2019/10/16 16:22:07:0300] N: est: 3369 1
66[2019/10/16 16:22:07:2325] N: est: 577 1
67[2019/10/16 16:22:08:4519] N: est: 9 1
68[2019/10/16 16:22:08:6716] N: est: 3 1
69[2019/10/16 16:22:08:6718] N: est: 11 1
70[2019/10/16 16:22:08:8915] N: est: 10 1
71[2019/10/16 16:22:08:8915] W: callback_audio: ended capture
72[2019/10/16 16:22:09:0993] N: identified reply...
73^C[2019/10/16 16:22:14:3067] U: Disconnected from Alexa
74[2019/10/16 16:22:14:3123] U: Completed
75$
76
77```
78