How Might I Export Multiple Filenames as Text-to-Speech Audio?

Hi there,
I was wondering if KM would be able to batch save the name of each file in a folder to individual text-to-speech audio files.
e.g. I have a folder with files named "Luke Chapter 1.mp3", "Luke Chapter 2.mp3" etc. I would love to have a seperate text-to-speech audio file of the names of each original filename read aloud - so the audio file speaks "Luke Chapter 1" (would be great if the file extension "mp3" was not included in the audio.).
Would that be a simple process?
Thanks in advance for your help,

Hey Neil;

Welcome to the forum!   :smile:

Keyboard Maestro won't record text-to-speech natively.

Can it be done? Yes.

Simple? Nyet.

Difficult? I think a bit fiddly but not extremely difficult.

How much help do you need?

Here's a couple of places to get you started.


Hey thanks for that Chris. I did look at that first one in my research but as far as I can tell it just does with Automator what is now available in the right-click drop down menu...although I may have missed something.
So I guess what I really wanted was for KM to be able to:

  1. select a file in a folder
  2. choose "rename" from the right click menu
  3. copy the highlighted text (the filename)
  4. select "Services > Add to Music as a spoken track"
  5. paste the filename into the highlighted field
  6. then "enter"
  7. repeat with the next file in the folder

I would then have all the filenames as text-to-speech audio.

Does that make sense? I've only just downloaded KM so was just trying to get an idea of how complex this idea would be.
Thanks again Chris,

Hey Neil,

I don't have that service on my system, but yes that should be pretty much the same.

You can do all that with Keyboard Maestro.

I figured out how to do this with the shell:

say -v Alex -o "audiofile.aiff" "This is my file name!"

This makes the job relatively easy, and I'll post more later – after I've had some supper.


Hey there again,
Hey thanks so much Chris for looking at this for me. To be honest I really didn't where to start.
I'm currently listening to a large series of relatively short (2-5 minute) audio files of various readings. At the moment they're just playing one after the other but they're not necessarily sequential. It's important to know how each one fits into the bigger picture before each one starts which is why I want an audio file with the title before each reading.
Thanks again,

Hey Neil,

It takes only a little time and effort to learn some of the basics of Keyboard Maestro, but you can spend years working with it and never master everything it can do.  :sunglasses:

Here's a macro that should handle your task.

  • The macro is uploaded in a disabled state, so you'll have to activate it to use.
  • Change the keyboard shortcut as desired.
  • Test first on copies. It shouldn't be possible for the macro to get destructive, but it's better to be safe than sorry. (Works fine for me in my tests.)


Create Audio Files of File Names in a Folder v1.00.kmmacros (7.9 KB)

Wow! Thank you so much Chris. I won't have a chance to try it for a little while but I'll let you know how I go. I didn't expect someone to write a macro for me, I'm speechless! What's the traditional way of acknowledging a kindness like this on the KM forum? :slight_smile:

Ok, so I lied....I made some time to try it out and it works perfectly. I tried to find a website for you so I could buy a product you've made or something....but wasn't it!

Good deal!

Actually it is, but there's nothing public up there at present. :sunglasses:


Well, let me just say a big thanks in the mean time. My project is coming along nicely and with over 2000 files processed your macro has brought it nearly to completion.

1 Like