How to Effectively Type IPA Characters on PC

How to Effectively Type IPA Characters on PC
Photo by Jay Zhang / Unsplash

Linguists: how do you type IPA characters on PC? If you're looking for a nice and quick way to type them, keep on reading.

Just a few days ago I was writing a few notes on phonetics on my PC when I hit a roadblock: I didn't know how to type ⟨ɕ⟩, among other letters like ⟨ʃ⟩, ⟨ʒ⟩ and ⟨ʑ⟩, all used in the International Phonetic Alphabet (IPA).

What is the IPA?

For those that don't know, those weird letters are part of the International Phonetic Alphabet (IPA, for short). Linguists use these and many more letters to represent specific speech sounds. Each letter represents one and only one sound[1].

Ever tried learning how to pronounce a weird word?

Let's say we want to know how to pronounce antidisestablishmentarianism. We Google "antidisestablishmentarianism pronunciation" and the literal first result[2] is the following list of phonetic spellings (fetched from here):

  1. an-tidis-es-tab-lish-men-tar-i-an-is-m.
  2. an-tee-dis-uh-stab-lish-muh n-tair-ee-uh-niz-uh m.
  3. An-tidis-es-tab-lish-men-tar-i-an-ism.
  4. An-tidis-es-tab-lish-ment-ari-an-ism.

Where do you even start? Which one of those "phonetic" spellings is the most accurate? Which regional accent do those transcriptions take into account? Why is every transcription hyphenated differently? What even is "tair", "muh" and "niz-uh-m"?

We're left even more confused after looking at all that. This was especially troublesome for me, a non-native English speaker, when I was trying to learn how to pronounce certain non-trivial words.

The IPA solves these (and many more) problems. We can use it to transcribe antidisestablishmentarianism as:

  • /ˌæn.ti.dɪs.ɪsˌtæb.lɪʃ.mənˈtɛə.ɹi.ənˌɪ.z(ə)m/ for Received Pronunciation
  • /ˌæn.taɪˌdɪs.ɛsˌtæb.lɪʃ.məntˈɛː.ɹi.ənˌɪ.zm̩/ for General American

Whoever knows which sounds each one of those characters represent will be able to know how to pronounce it, with little to no ambiguity. Actually pronouncing it is, of course, another thing entirely, depending on the person's familiarity with those sounds.

I obtained these transcriptions from Wiktionary. Indeed, there are two transcriptions, since different regional accents are taken into consideration (Received Pronunciation is what is commonly called a British accent), something that was also missing from the other "phonetic" spellings.

The IPA is also very useful for transcribing words in other languages. We all know there are sounds in other languages that do not exist in the languages we speak; how would you accurately transcribe foreign words with one of those "phonetic" spellings that are limited to the sounds and letters of that one language?

The IPA also allows us to express nuances that we could not possibly transcribe without it. Take a look at the following two transcriptions for uh-oh (Received Pronunciation):

  • /ˈʌ.əʊ/
  • [ˈʌ̆ʔ˦.əʊ˨]

The former is the broad transcription, which is just showing the two vowels (represented by ʌ and əʊ), the two syllables (separated by .) and which syllable is emphasised (the one that comes after ').

The latter is the narrow transcription, which additionally shows the extra-short duration of the first vowel (marked by the ˘ above it), a special sound produced between both syllables (known as a glottal stop, represented by ʔ), as well as the intonation of each syllable (represented with ˦, high intonation, and ˨, low intonation).

It may look very alien at first, but once you learn proper IPA, there's no going back to mediocre phonetic spellings. Knowing the IPA has helped me improve my English pronunciation and it gave me a considerable head start when learning French and German. It has also allowed me to study the phonology of countless languages, even if I don't speak them at all.

You don't have to learn all the IPA characters; you just have to learn the ones that are relevant for you. I myself am only mostly familiar with the ones that represent the most common sounds present in European languages, which is where I spend most of my attention

Potential Solutions

I have written a fair amount of IPA transcriptions, but, by total coincidence, I had only done so on mobile. When I first had the need to type a weird IPA character on mobile, I quickly found the nice and elegant solution of using the layout that Gboard conveniently offers:

The excellent IPA layout that Gboard offers. This is just one of its many pages.

I had never come across the need to type IPA characters on a PC until now. My first idea was to Google for the characters and then copy-paste them.

While that solution works, it's far from ideal. It's very disruptive: searching for "voiceless alveolo-palatal fricative" just to end up copying ɕ is just plain ridiculous.

I searched around the internet for better solutions and didn't come across any that I found elegant enough to adopt. This Stack Exchange question contains many of them.

The first obvious solution was to install a custom keyboard layout that contains all the IPA characters and use that. However, I myself use a custom layout already, so the QWERTY and US-based IPA layouts that I found weren't really optimal for me.

The second solution that I found was to use something (a website, a program) that would show all the IPA characters and allow to copy any one of them with just a click. It's really not that bad of a solution, yes, but going back and forth between the keyboard and the mouse is still not as handy as I would like, not to mention that I was looking for a solution that didn't require having some other window open.

The third solution that I came across was to use an X-SAMPA to IPA converter. X-SAMPA is a way to represent all these weird IPA characters via a sequence of other non-weird characters. For example, the corresponding sequence for ɕ is s\ and the one for ʒ is simply Z (which is different from lowercase z). X-SAMPA was devised as a way to represent these weird IPA characters when computers couldn't display them yet.

This was an excellent idea on paper, but terrible in practice. All the converters I could find were a webpage: going into a webpage, inserting an X-SAMPA sequence and then copy-pasting the corresponding IPA character is still quite disruptive.

I was hoping to find something handier. I was thinking of a program that would allow me to use a hotkey to invoke a text box where I would type an X-SAMPA sequence and get the corresponding IPA symbol in the clipboard after pressing Enter. It doesn't sound too complicated to code, so I was almost ready to code it myself to solve the problem for me and for anyone else that had it in the future.

However, that solution was still not elegant enough for me: it would require the program to be constantly running in the background.

Another solution that I found and I actually liked was to put together an actual physical keyboard specifically meant for typing IPA characters, just like the one Michael Howard built here. However, as I don't type that much IPA at the end of the day, the expenses behind such a project wouldn't be justified (although one day I would love to build a keyboard like that, just because I can).

First Idea: Custom Keyboard Layout Based on X-SAMPA

As I didn't come across any solutions that pleased me, I just decided to go ahead and modify my current custom keyboard layout to include all the IPA characters. I plan on explaining my custom layout in detail in another blog entry, but here's what it looks like anyway:

My custom keyboard layout; you may notice it's quite crammed already

Since my layout already has a bunch of symbols that I use more regularly than any IPA character, I was planning on adding another layer with all the characters positioned according to their X-SAMPA sequence. For example:

  • Typing s would yield s (X-SAMPA s)
  • Typing Shift + s would yield ʃ (X-SAMPA S)
  • Typing AltGr + s would yield ɕ (X-SAMPA s\)

There were still some things to consider, mainly the fact that my current layout only supports up to 4 different characters for a given key, while some letters in X-SAMPA are used to represent more than 4 characters (b, for instance). Thankfully, I use Linux, and XKB —the component of Linux that manages keyboard input— is very flexible, so I knew it was still doable, even if I didn't know exactly how.

The Perfect Solution: the Compose Function

I went into XKB's documentation to learn how to assign more than 4 characters to a single key, but I stopped reading when I came across a feature whose existence I had forgotten: the compose function.

The compose function allows to insert a special character by pressing a special key known as the compose key followed by a sequence of other keys (the compose key can be mapped to any key on the keyboard).

For example, by default, the compose function allows us to insert © by pressing the compose key followed by the oc sequence.

Does that sound familiar? Indeed. The compose function would allow me to insert an IPA character by pressing the compose key followed by the character's X-SAMPA sequence.

This solution finally pleased me. Since the compose function is built into the component of the OS that directly interacts with the keyboard, I wouldn't have to have anything else open. Moreover, this solution would allow me to use the X-SAMPA sequences intact, without any modifications or adaptations.

Simple to Setup

Setting this solution up was also surprisingly simple, a lot more than modifying my already-existing layout. I just had to map the compose key and create a text-file with all the sequences I wanted to define.

I mapped the compose key to the Super (Windows) key that's on the right, since I never use it. As for my laptop, which doesn't have that second Super key, I assigned it to the > key that I also never use[3] and is conveniently placed in that same location.

The text file just had to be named .XCompose and placed in my home directory (~). Despite the large amount of characters that X-SAMPA takes into account (that I had to painfully copy-paste one last time), I was able to finish the whole thing in less than half an hour.

Using it Yourself

You can find the resulting configuration file here:

.XCompose file for composing IPA characters with their X-SAMPA sequences (Linux; X11 and Wayland)
.XCompose file for composing IPA characters with their X-SAMPA sequences (Linux; X11 and Wayland) - .XCompose

If you use Linux yourself, you can save it in your home directory (~), assign the compose key to some key, and have the whole thing working in less than 5 minutes. It works on both X11 and Wayland.

💡
Mapping the compose key is a process that depends on your specific distro and desktop environment. On Ubuntu 22.10 with GNOME 43, you can easily do it inside the keyboard settings, though it only allows mapping it to keys like Ctrl, Shift, Alt and Super (pretty sure this is a standard GNOME feature). Either way, you can always tell XKB to map it to any key like so. You might need to restart/log off after saving the file in ~, but I found that running ibus restart works, too.

Other Operating Systems

As for Windows, I won't bother for now. These days I'm mostly using Linux and use Windows only for gaming and other affairs where I don't really need to type IPA characters. Surely AutoHotkey could get the job done with a simple text file, albeit with a program running in the background.

I'm not really familiar with macOS, so I don't know what could work there. I've heard great things of Karabiner-Elements, but I haven't looked too much into it.

Final Words

I will admit something: I don't actually type as much IPA as this blog entry would suggest. It's rare when I find myself using it more than once a week. Truth is, I just love messing around with potential solutions when I come across problems like these.

But hey, at the end I came up with a nice solution that anyone else with the same problem can also use, so it's all good.

Thanks for reading!


Footnotes
  1. |That's only half-true. Depending on the context, the IPA can be used to describe actual specific speech sounds, which we call phones, or it can also be used to describe "units of sound" (sets of phones that in a given language feel the same), which we call phonemes. Normally, enclosing a symbol within [brackets] represents a phone, while enclosing a symbol within /slashes/ represents a phoneme.
  2. |At least that's the first result Google showed in an incognito window. I am aware that Google personalises search results based on the user's activity, location and preferred language, so yours may vary. I actually use DuckDuckGo myself.
  3. |As you can see in the picture I've put above, my layout has < and > mapped on another key, since my main keyboard has an ANSI layout and thus does not have this ISO layout-specific key.