API

API Diversions

Experimenting with a new API via Cloudflare workers.

James Montgomery

5 minute read

TL; DR

Recently reinvigorated with my new UI work, I set myself to task with simplifying the front end player code. No matter how I looked at it, I’d needed to rewrite the back end API to support a front end rewrite. But what if I didn’t precisely need to do that? Enter stage left, Cloudflare Workers.

Comparison of beta with the worker as proxy and handling query translation.

Below I explain how I arrived at this. If you would like to view the Worker code, you can do so here. If you would like to view the sites (and compare), you may do so here:

Introducing async to my serverless text-to-speech player for jokes and quotes

Using AWS components, Cloudflare, and public APIs.

James Montgomery

3 minute read

TL; DR

In this post, I revisit my serverless “jokes and quotes” player. The purpose was to remove the tight coupling between the client request and audio playback API source. To explore the issue, I have introduced DynamoDB to store pre-generated results.

Challenge overview

Logically, all the components of my existing solution depend on each other to succeed to deliver audio to the client. You can visualise it as follows:

Flow of the synchronous version.

The challenge was to accomplish a solution which operated in the following fashion:

A Serverless text-to-speech player for jokes and quotes

Using AWS components, Cloudflare, and public APIs.

James Montgomery

2 minute read

TL; DR

I decided to dust off my text-to-speech list, implementing a serverless solution delivering random jokes and quotes. You may visit it at this address:

https://tts-ja.mesmontgomery.co.uk/

You can get a preview of the joke quality here:

Note: I can’t affect the humour quality 🤣.

Solution overview

Upon visiting the page, an event triggers calls to the API routes for their relative jokes and quotes. Contained in the API response is the source audio for the HTML5 audio controls.

TTS project update 1 - adding texture to my generated speech

Introducing a pool of voices and choices in rate of speech, pitch and volume gain.

2 minute read

TL; DR

In this post, I’d like to share an update on work to address some of the limitations in my text to speech project for Elite Dangerous.. Namely:

  • Single voice is used for the synthesis; and
  • Pitch, tone and emphasis are unchanged from defaults.

If you’d like to see the result of the work so far, here is a brief overview video, I’ll describe how we got here below:

TTS March 19 update video!

Google Cloud Text-to-Speech with PowerShell

A guide for using PowerShell with the Google Cloud Text-to-Speech API.

6 minute read

TL; DR

In this post, I’ll walk through the basics of using PowerShell to interact with the Google Cloud Text-to-Speech API. Partly a documentation exercise and somewhat a guide I’d like to have been able to read when I started on my Elite Dangerous Google Cloud Text-to-Speech project.

As such, we’ll start with a basic script to produce an audio file and explain how that works. Later I’ll walk through some parameters of interest to affect the response. Lastly, I’ll introduce how we can use SSML for a variation in response.

How to base64 decode on Windows 10 without base64.exe

Converting the base64 audio content response from the Google Cloud Text-to-Speech API into a playable file on windows using PowerShell.

2 minute read

TL;DR

You can call certutil from PowerShell to produce the required file.

Introduction

There is a moment in life where you get stuck in a quick start guide - we’ve all been there. At the start of my Google Cloud text-to-speech project it arrived quickly and unexpectedly at step two of this two-step quick start guide.

I had successfully returned my first base64 encoded speech audio, onward to the last step:

“Decode the source text file using the Base64.exe tool:”