KM macro to convert .pgn chess file to spoken audio file

Hi all!

I hope it’s ok to link to a macro over on the KM site, I don’t want to double up as such. I’ve posted this over there: https://forum.keyboardmaestro.com/t/convert-pgn-chess-file-to-speech/18284

This macro converts a .pgn file to a .aiff file of the game being read allowed. For example it converts:
13.Rad1 a6 14.Bd3 b5 15.axb5 axb5
to
[[slnc 7000]] Move 13. White [[slnc 1000]] Rook a to d1 [[slnc 3000]] Black [[slnc 1000]] pawn to a6
[[slnc 7000]] Move 14. White [[slnc 1000]] Bishop to d3 [[slnc 3000]] Black [[slnc 1000]] pawn to b5
[[slnc 7000]] Move 15. White [[slnc 1000]] a takes b5 [[slnc 3000]] Black [[slnc 1000]] a takes b5

Which reads with Applescript with pauses etc.

Potential uses are for people with a visually impaired and also for chess improvement by visualising chess moves and memorisation of classic games.

I’m fairly happy with this first version. I may add user prompt for the length of delays, and improving the AppleScript voice. It’s possible to change the tone of each word etc so that could certainly be improved.

I also wonder if it’s possible to have this working online in some way, so if someone uploads a .pgn file to a google drive, when my mac is online it checks the folder, runs the macro and saves the .aiff file to the same folder, thereby making it an online app of sorts!

Online .pgn files can be found at https://www.chessgames.com/ if anyone wants to test it.

Open to comments and suggestions!

1 Like

That is certainly possible if you are syncing the Google Drive folder to your Mac using the sync app. Hazel could be used to trigger Keyboard Maestro, but Keyboard Maestro actually has its own watched folder trigger.

https://wiki.keyboardmaestro.com/trigger/Folder

Additionally, you could explore control mechanisms utilising a web service like IFTTT/Zapier/Integromat, to round-trip the request, but this would likely incur additional costs and/or delays over if you synced and watched as above.

1 Like