Skip to content

sdebby/telegraph

Repository files navigation

TELEGRAPH project

Wikipedia link

About

Lets have a chat with ChatGPT4,

BUT for REAL,

Lets have a call.

We are best friends.

This script is using OpenAI STT, chat and TTS models, to have a real feeling chat.

Equipment:

  • Raspberry pi 3 B
  • USB headset (microsoft LiveChat)
  • Switch
  • 5 mm LED
  • 2 X 220 kOhm resistors
  • Old wireless telephone.

The process (Connecting the hardware):

telephone

  1. Taking apart an old DECT telephone.

telephone open 1

telephone open 2

  1. Disconnecting speaker

Speaker

  1. Soldering LED + resistors + switch to cable.

LED

Switch

  1. Disassemble USB headset:

Headset

  1. Testing cable on raspberry pi.

LED

  1. Soldering USB speaker and microphone wires to telephone, adhering the button to back cover with hot glue and adhering the LED to front cover with hot glue.

The connection

  1. Closing all together.

all together 1

all together 2

all together 3

Schematics

schematics

Behind the scenes:

  1. If there where old message files, they will be deleted from the folder.
  2. A pre recorded welcome message will play to the user.
  3. User press the button and record a new message.
  4. When releasing the button, the message converted to MP3 and sent to OpenAI Whisperer module - Speech To Text (STT).
  5. The replied transcript then sent to OpenAI ChatGPT 4 module.
  6. The replied generated text then sent to OpenAI Text To Speech module (TTS).
  7. The replied MP3 then converted to WAV and played back to the user.

Demo video

Install:

Install ffmpeg on machine:

https://ffmpeg.org/

git clone sdebby/telegraph
pip install -r requirements.txt
python ChatWithLinux1.py -d [x]

Obtain Open AI API key and save in in environment as "OpenAI_Key" (or replace the key in file OpenAIHelper.py)

Usage

parameters:

-h help

-l list of USB devices

-d [x] use USB device no. x

  • If using a Raspberry pi (like in this project) and need to adjust volume:
alsamixer
- Adjust USB device volume and exit
- Save configuration: 
sudo alsactl store

Limitations:

  • Due to the ping-pong method (sending voice,receiving text, sending text, ect ...) there is a long delay from when talking to receiving answer.