Build cryptographic audio messages using Text-To-Speech.
_Inspired by Number Stations and Person of Interest_
You will need to install gcloud for using Google Text-To-Speech as a TTS service. Alternatively, you can use eSpeak as the TTS engine.
Once you have installed the gcloud
CLI, you will need to authenticate with Google Cloud. You can do this by running gcloud auth login
and following the instructions.
You will also need to create a Google Cloud project and enable the Text-To-Speech API.
Next, you will need to create a service account and download the credentials file. You can do this by following the instructions here.
Finally, you need to impersonate the service account. You can do this by running gcloud auth activate-service-account --key-file=<path-to-credentials-file>
.
Before you can use the project, you will need to set the GCLOUD_BEARER
environment variable to the bearer token of the service account.
We provide a few ways to do this automatically:
- BASH/ZSH:
source shell.sh
- Nushell:
source shell.nu
- Nix:
nix-shell
Alternatively, you can get the bearer token by running gcloud auth application-default print-access-token
and setting the GCLOUD_BEARER
environment variable to the output.
Note: The bearer token will need to be set whenever you run the project or the binary. Also, Google may revoke the token which Conetto will let you know if this is the case and you need to rerun the steps above.
If you do not wish to use Google Cloud, you can use eSpeak as the TTS engine. You can install espeak
from their downloads page or use Nix
with our shell.nix
file.
To build the project, run cargo build --release
.
Conetto uses a declarative approach to creating an audio file. Here is a simple "Hello World" example:
use conetto::*;
#[tokio::main]
async fn main() {
// You can use TTSService::Google for Google Cloud TTS
let mut tts = Tts::new(TTSService::Espeak, true, true);
let clips: Vec<Clip> = vec![Speak::new("Hello, World!").into()];
let mut samples = render_all(clips.into_iter(), &mut tts).await;
save_audio_file(&mut samples, DEFAULT_RENDER_PATH);
}
Running this code will create an audio file at .conneto/audio.wav
in the project's directory.
For more examples, see the examples directory.