Adding Accents to Speech Generation
Asked Answered
C

2

8

The first part of this question is now its own, here: Analyzing Text for Accents

Question: How could accents be added to generated speech?

What I've come up with:

I do not mean just accent marks, or inflection, or anything singular like that. I mean something like a full British accent, or a Scottish accent, or Russian, etc.

I would think that this could be done outside of the language as well. Ex: something in Russian could be generated with a British accent, or something in Mandarin could have a Russian accent.

I think the basic process would be this:

  1. Analyze the text
    • Compare with a database (or something like that) to determine what needs an accent, how strong it should be, etc.
  2. Generate the speech in specified language
    • Easy with normal text-to-speech processors.
  3. Determine the specified accent based on the analyzed text.
    • This is the part in question.
    • I think an array of amplitudes and filters would work best for the next step.
  4. Mesh speech and accent.
    • This would be the easy part.
    • It could probably be done by multiplying the speech by the accent, like many other DSP methods do.

This is really more of a general DSP question, but I'd like to come up with a programatic algorithm to do this instead of a general idea.

Cassy answered 15/3, 2012 at 1:42 Comment(5)
There are (at least) two completely disjoint questions here: the part about text analysis, and the part about speech synthesis. These should be asked as separate SO questions.Microeconomics
@Oli I thought about that, but the analyzing part is so closely tied to the generation part that I think they should be together.Cassy
Hmmm. The first is essentially a parsing/textual analysis problem; the second is essentially a DSP problem. The scope seems a little too broad for a Stack Overflow question...Microeconomics
@Oli I'll go ahead and keep this question as it is, but add a new one for the analyzing part.Cassy
@downvoter - please give a reason for the downvote...Cassy
N
2

What is an accent?

An accent is not a sound filter; it's a pattern of acoustic realization of text in a language. You can't take a recording of American English, run it through "array of amplitudes and filters", and have British English pop out. What DSP is useful for is in implementing prosody, not accent.

Basically (and simplest to model), an accent consists of rules for phonetic realization of a sequence of phonemes. Perception of accent is further influenced by prosody and by which phonemes a speaker chooses when reading text.

Speech generation

The process of speech generation has two basic steps:

  1. Text-to-phonemes: Convert written text to a sequence of phonemes (plus suprasegmentals like stress, and prosodic information like utterance boundaries). This is somewhat accent-dependent (e.g. the output for "laboratory" differs between American and British speakers).

  2. Phoneme-to-speech: given the sequence of phonemes, generate audio according to the dialect's rules for phonetic realizations of phonemes. (Typically you then combine diphones and then adjust acoustically the prosody). This is highly accent-dependent, and it is this step that imparts the main quality of the accent. A particular phoneme, even if shared between two accents, may have strikingly different acoustic realizations.

Normally these are paired. While you could have a British-accented speech generator that uses American pronunciations, that would sound odd.

Generating speech with a given accent

Writing a text-to-speech program is an enormous amount of work (in particular, to implement one common scheme, you have to record a native speaker speaking each possible diphone in the language), so you'd be better off using an existing one.

In short, if you want a British accent, use a British English text-to-phoneme engine together with a British English phoneme-to-speech engine.

For common accents like American and British English, Standard Mandarin, Metropolitan French, etc., there will be several choices, including open-source ones that you will be able to modify (as below). For example, look at FreeTTS and eSpeak. For less common accents, existing engines unfortunately may not exist.

Speaking text with a foreign accent

English-with-a-foreign-accent is socially not very prestigious, so complete systems probably don't exist.

One strategy would be to combine an off-the-shelf text-to-phoneme engine for a native accent with a phoneme-to-speech engine for the foreign language. For example, a native Russian speaker that learned English in the U.S. would plausibly use American pronunciations of words like laboratory, and map its phonemes onto his native Russian phonemes, pronouncing them as in Russian. (I believe there is a website that does this for English and Japanese, but I don't have the link.)

The problem is that the result is too extreme. A real English learner would attempt to recognize and generate phonemes that do not exist in his native language, and would also alter his realization of his native phonemes to approximate the native pronunciation. How closely the result matches a native speaker of course varies, but using the pure foreign extreme sounds ridiculous (and mostly incomprehensible).

So to generate plausible American-English-with-a-Russian-accent (for instance), you'd have to write a text-to-phoneme engine. You could use existing American English and Russian text-to-phoneme engines as a starting point. If you're not willing to find and record such a speaker, you could probably still get a decent approximation using DSP to combine the samples from those two engines. For eSpeak, it uses formant synthesis rather than recorded samples, so it might be easier to combine information from multiple languages.

Another thing to consider is that foreign speakers often modify the sequence of phonemes under influence by the phonotactics of their native language, typically by simplifying consonant clusters, inserting epenthetic vowels, or diphthongizing or breaking vowel sequences.

There is some literature on this topic.

Naos answered 24/3, 2012 at 2:6 Comment(1)
Wow...that's a lot of useful information. I'm not really sure what else to say, but this is the best answer I think I'll get.Cassy
P
4

This question isn't really "programming" per se: It's linguistics. The programming is comparatively easy. For the analysis, that's going to be really difficult, and in truth you're probably better off getting the user to specify the accent; Or are you going for an automated story reader?

However, a basic accent is doable with modern text-to speech. Are you aware of the international phonetic alphabet? http://en.wikipedia.org/wiki/International_Phonetic_Alphabet It basically lists all the sounds a human voice can possibly make. An accent is then just a mapping (A function) from the alphabet to itself. For instance, to make an American accent sound British to an American person (Though not sufficient to make it sound British to a British person), you can de-rhotacise all the "r" sounds in the middle of a word. So for instance the alveolar trill would be replaced with the voiced uvular fricative. (Lots of corner cases to work out just for this).

Long and short: It's not easy, which is probably why no-one has done it. I'm sure a couple of linguistics professors out their would say its impossible. But that's what linguistics professors do. But you'll basically need to read several thick textbooks on accents and pronunciation to make any headway with this problem. Good luck!

Precipitin answered 21/3, 2012 at 10:10 Comment(3)
+1. I am going for the "story-reader" approach, and you're answer definitely provides some good tips. Do you think you could provide a "road-map" of sorts? Something like pseudo-code?Cassy
God no. This is in no way a small project.Precipitin
The IPA is to imprecise for this purpose; it aims to be a phonemic alphabet (despite its name).Naos
N
2

What is an accent?

An accent is not a sound filter; it's a pattern of acoustic realization of text in a language. You can't take a recording of American English, run it through "array of amplitudes and filters", and have British English pop out. What DSP is useful for is in implementing prosody, not accent.

Basically (and simplest to model), an accent consists of rules for phonetic realization of a sequence of phonemes. Perception of accent is further influenced by prosody and by which phonemes a speaker chooses when reading text.

Speech generation

The process of speech generation has two basic steps:

  1. Text-to-phonemes: Convert written text to a sequence of phonemes (plus suprasegmentals like stress, and prosodic information like utterance boundaries). This is somewhat accent-dependent (e.g. the output for "laboratory" differs between American and British speakers).

  2. Phoneme-to-speech: given the sequence of phonemes, generate audio according to the dialect's rules for phonetic realizations of phonemes. (Typically you then combine diphones and then adjust acoustically the prosody). This is highly accent-dependent, and it is this step that imparts the main quality of the accent. A particular phoneme, even if shared between two accents, may have strikingly different acoustic realizations.

Normally these are paired. While you could have a British-accented speech generator that uses American pronunciations, that would sound odd.

Generating speech with a given accent

Writing a text-to-speech program is an enormous amount of work (in particular, to implement one common scheme, you have to record a native speaker speaking each possible diphone in the language), so you'd be better off using an existing one.

In short, if you want a British accent, use a British English text-to-phoneme engine together with a British English phoneme-to-speech engine.

For common accents like American and British English, Standard Mandarin, Metropolitan French, etc., there will be several choices, including open-source ones that you will be able to modify (as below). For example, look at FreeTTS and eSpeak. For less common accents, existing engines unfortunately may not exist.

Speaking text with a foreign accent

English-with-a-foreign-accent is socially not very prestigious, so complete systems probably don't exist.

One strategy would be to combine an off-the-shelf text-to-phoneme engine for a native accent with a phoneme-to-speech engine for the foreign language. For example, a native Russian speaker that learned English in the U.S. would plausibly use American pronunciations of words like laboratory, and map its phonemes onto his native Russian phonemes, pronouncing them as in Russian. (I believe there is a website that does this for English and Japanese, but I don't have the link.)

The problem is that the result is too extreme. A real English learner would attempt to recognize and generate phonemes that do not exist in his native language, and would also alter his realization of his native phonemes to approximate the native pronunciation. How closely the result matches a native speaker of course varies, but using the pure foreign extreme sounds ridiculous (and mostly incomprehensible).

So to generate plausible American-English-with-a-Russian-accent (for instance), you'd have to write a text-to-phoneme engine. You could use existing American English and Russian text-to-phoneme engines as a starting point. If you're not willing to find and record such a speaker, you could probably still get a decent approximation using DSP to combine the samples from those two engines. For eSpeak, it uses formant synthesis rather than recorded samples, so it might be easier to combine information from multiple languages.

Another thing to consider is that foreign speakers often modify the sequence of phonemes under influence by the phonotactics of their native language, typically by simplifying consonant clusters, inserting epenthetic vowels, or diphthongizing or breaking vowel sequences.

There is some literature on this topic.

Naos answered 24/3, 2012 at 2:6 Comment(1)
Wow...that's a lot of useful information. I'm not really sure what else to say, but this is the best answer I think I'll get.Cassy

© 2022 - 2024 — McMap. All rights reserved.