Skip to content
forked from cbh123/narrator

David Attenborough narrates your life

Notifications You must be signed in to change notification settings

nicoloddo/narrator

 
 

Repository files navigation

David Attenborough narrates your life from a Raspberry Pi Zero 2W.

OpenCV has been deleted from the requirements and substituted by ImageIO

https://twitter.com/charliebholtz/status/1724815159590293764

Setup

First install python and an important numpy dependency:

sudo apt-get install libopenblas-dev

Clone this repo, and setup and activate a virtualenv:

python3 -m pip install virtualenv
python3 -m virtualenv venv
source venv/bin/activate

Then, install the dependencies:

pip install -r requirements.txt

Make an OpenAI and ElevenLabs account and set your tokens in a new .sh script named:

setenv.sh

with this content:

export OPENAI_API_KEY=<openai-key>
export ELEVENLABS_API_KEY=<eleven-key>

If you want to use the instant narrator, make an account at PlayHT and set your tokens in the same setenv.sh:

export PLAYHT_USER_ID=<playht-user>
export PLAYHT_API_KEY=<playht-key>

Then make the run.sh script executable:

chmod +x run.sh

Run it!

./run.sh --narrator

OR:

./run --instant_narrator

Note that if one gives an error, the other will start. The --option only gives the opportunity to specify which one to start as default narrator.

To automate its running on startup:

Move the narrator.service to /etc/systemd/system/:

sudo cp narrator.service /etc/systemd/system/

Then activate the service:

sudo systemctl daemon-reload
sudo systemctl enable narrator.service

The service will run one time on startup, speaking at most as much as specified in the agent.sh MAX_TIMES variable.

You can check the service output with:

sudo systemctl status narrator.service

Or for more extensive logs with:

journalctl -u narrator.service

Optional modifications:

To change voice:

Make a new voice in Eleven and get the voice id of that voice using their get voices API, or by clicking the flask icon next to the voice in the VoiceLab tab.

Then change the agent.sh file to the id you prefer.

export ELEVENLABS_VOICE_ID=<voice-id>
export PLAYHT_VOICE_ID=<voice-id>

Inside the agent.sh you can also change:

  • the system prompt of the agent,
  • the first prompt and the recurring prompt to the agent,
  • the amount of times the agent will speak before turning off.

run.sh customization notes:

Notice that the two .sh shouldn't be run directly but rather sourced, otherwise they will run in a new subshell and the exports will not persist:

. setenv.sh
. agent.sh

OR:

source setenv.sh
source agent.sh

Remember to activate the venv:

source venv/bin/activate

Then run the software:

python narrator.py

These steps are automated by simply running the run.sh or run_instant_narrator.sh file.

About

David Attenborough narrates your life

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 89.4%
  • Shell 10.6%