Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
drosoCode committed Mar 5, 2024
1 parent 20249e6 commit e57b949
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ An opensource nabaztag/nabaztag:tag/karotz server.

Make sure that you have cloned this repo with the option `--recurse-submodules`.

Warning: This project is in a very early stage, it has not been fully tested and is not (yet) recommended to use for an extended period of time.

Ports:
- tcp/80: For V1/V2 (to download bootcode)
- udp/4000: For V2 (to send/receive audio)
Expand All @@ -29,10 +31,12 @@ Run `scripts/nats.sh` to run the nats server.

Run `make run` to build the openab server and run it.

Press the head of the nabaztag:tag while powering it (all leds should be blue), connect to the new wifi (NabaztagXX) and go to `192.168.0.1` and at the bottom of the page, change the `Violet Platform` field to the address of the pc running the server (ex: `http://192.168.1.102/vl`), then click `update and start`.

Go into `scripts/voice`:
- install the requirements: `pip3 install -r requirements.txt`
- clone [wyoming-satellite](https://github.com/rhasspy/wyoming-satellite/)
- run `cd wyoming-satellite && script/setup`
- make sure to also install the webrtc utils `cd wyoming-satellite && .venv/bin/pip3 install 'webrtc-noise-gain==1.2.3'`
- turn on your nabaztag and wait for it to connect to the server
- run `./voice.sh`
- run `./voice.sh` (currently you need to restart this script, the server and the nab after each voice command)
8 changes: 7 additions & 1 deletion scripts/voice/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ async def main():

print("Player Connected")

async def blank():
for i in range(30):
await send(b'0'*1024)

async def send(audio):
inbox = nc.new_inbox()
sub = await nc.subscribe(inbox)
Expand All @@ -31,17 +35,19 @@ async def send(audio):
if not was_streaming:
# stop the recorder while we send audio
await nc.publish(f"openab.{cfg.MAC}.recorder.command", bytes(json.dumps({"state": 1}), "utf8"))
await blank()
was_streaming = True
lastread = time()
data += r
if len(data) >= 1024:
await send(data)
data = b''
elif was_streaming:
if time()-lastread > 2:
if time()-lastread > 1:
print("End of stream")
if len(data) > 0:
await send(data)
await blank()
was_streaming = False
break
except BlockingIOError:
Expand Down

0 comments on commit e57b949

Please sign in to comment.