

//=========================================================
// German
//=========================================================



phoneme @   //  Schwa
  vowel starttype #@ endtype #@
  unstressed
  length 120
  IF nextPh(r) THEN
    IF next2Ph(isVowel) THEN
    ELSE
      ChangePhoneme(3)
    ENDIF
  ENDIF
  FMT(vowel/@_4)
endphoneme


phoneme 3   //  open Schwa+r
  vowel starttype #@ endtype #@
  unstressed flag1
  length 160
  IF thisPh(isFinalVowel) THEN
    Length 210
  ENDIF
  FMT(vowel/a#_3)   // in eSpeak 1.44, this used vowel/V_3 at end-of-word
endphoneme


phoneme a
  vowel starttype #a endtype #a
  length 110
  IF nextPh(isRhotic) THEN
    length 125
  ENDIF
  FMT(vowel/a)
endphoneme


phoneme E
  vowel starttype #e endtype #e
  length 120
  IF nextPh(*) THEN
    length 135
  ENDIF
  FMT(vowel/e_mid2)
endphoneme


phoneme E2    //  as[E] but reduces to @ if unstressed
  vowel starttype #e endtype #e
  length 120
  ChangeIfDiminished(@)
  IF nextPh(*) THEN
    length 135
  ENDIF
  FMT(vowel/e_mid2)
endphoneme


phoneme I
  vowel starttype #i endtype #i
  length 120
  IF nextPh(*) THEN
    length 135
  ENDIF
  IfNextVowelAppend(;)
  FMT(vowel/ii)
endphoneme


phoneme I:
  vowel starttype #i endtype #i
  length 190
  FMT(vowel/ii)
endphoneme


phoneme O
  vowel starttype #o endtype #o
  length 120
  IF nextPh(*) THEN
    length 135
  ENDIF
  FMT(vowel/oo)
endphoneme


phoneme U
  vowel starttype #u endtype #u
  length 120
  IF nextPh(*) THEN
    length 135
  ENDIF

  IF nextPh(r) AND next2Ph(isNotVowel) THEN
    ChangePhoneme(UR)
  ENDIF
  FMT(vowel/uu_2)
endphoneme


phoneme A:
  vowel starttype #a endtype #a
  length 250
  FMT(vowel/aa_6)
endphoneme


phoneme A   // reduces to [a] if not stressed
  vowel starttype #a endtype #a
  length 250
  ChangeIfUnstressed(a)
  FMT(vowel/aa_6)
endphoneme


phoneme i:
  vowel starttype #i endtype #i
  length 180
  IF prevPh(w) THEN
    VowelStart(w/wi2)
  ENDIF
  
//  IF nextPh(r) AND next2Ph(isNotVowel) THEN
//    ChangePhoneme(iR)
//  ENDIF
  FMT(vowel/i_2)
endphoneme


phoneme i2
  vowel starttype #i endtype #i
  length 180
  ChangeIfNotStressed(I)
  IF prevPh(w) THEN
    VowelStart(w/wi2)
  ENDIF
  FMT(vowel/i_2)
endphoneme


phoneme u:
  vowel starttype #u endtype #u
  length 190
  FMT(vowel/u)
endphoneme


phoneme aU
  vowel starttype #a endtype #u
  length 220
  FMT(vdiph/aau_6)
endphoneme


phoneme aI
  vowel starttype #a endtype #i
  length 210
  FMT(vdiph/ai_5)
endphoneme


phoneme EI
  vowel  starttype #e  endtype #i
  length 210
  FMT(vdiph/eei)
endphoneme



phoneme OY
  vowel starttype #o endtype #i
  length 220
  FMT(vdiph/oi)
endphoneme


phoneme E:
  vowel starttype #e endtype #e
  length 200
  FMT(vowel/e_8)
endphoneme


phoneme e:
  vowel starttype #e endtype #e
  length 200
  FMT(vowel/e_2)
endphoneme


phoneme o:
  vowel starttype #o endtype #o
  length 210
  FMT(vowel/o)
endphoneme


phoneme y:
  vowel starttype #u endtype #u
  length 200
  FMT(vowel/y)
endphoneme


phoneme y
  vowel starttype #u endtype #u
  ipa ʏ
  length 110
  IF nextPh(*) THEN
    length 115
  ENDIF
  FMT(vowel/yy_4)
endphoneme


phoneme Y:
  vowel starttype #@ endtype #@
  length 180
  FMT(vowel/y#)
endphoneme


phoneme W
  vowel starttype #@ endtype #@
  length 150
  IF nextPh(*) THEN
    length 160
  ENDIF
  FMT(vowel/oe)
endphoneme



// CONSONANTS
//===========

phoneme ts
  import_phoneme consonants/ts
endphoneme


phoneme pF
  vls blb afr
  ipa pf
  Vowelout f1=0  f2=1000 -500 -350  f3=-200 80
  lengthmod 2
  WAV(ufric/f)    // could replace this with a [pf] wav file
endphoneme


phoneme g#    // for "ig" -> [IC] or [Ig]
  vls pal frc palatal
  lengthmod 3

  IF nextPhW(isVoiced) THEN
    ChangePhoneme(g)
  ELSE
    ChangePhoneme(C)
  ENDIF
endphoneme



phoneme l/    // used for [l] when not before a vowel
  liquid
  lengthmod 7

  IF nextPh(isVowel) THEN
    ChangePhoneme(l)
  ENDIF

  PrevVowelEndings
    VowelEnding(l/L1_@L, -60)
    VowelEnding(l/L1_aL, -40)
    VowelEnding(l/L1_eL, -30)
    VowelEnding(l/L1_iL, -30)
    VowelEnding(l/L1_oL, -40)
    VowelEnding(l/L1_uL, -40)
  EndSwitch

  FMT(l/l_3)
endphoneme


phoneme j
  liquid palatal
  lengthmod 7

  IF nextPh(isVowel) THEN
    NextVowelStarts
      VowelStart(j/j@)
      VowelStart(j/ja)
      VowelStart(j/je)
      VowelStart(j/ji)
      VowelStart(j/jo)
      VowelStart(j/ju)
    EndSwitch

    VowelEnding(j/xj, -30)

    IF prevPh(isPause) THEN
      FMT(j/_j_short)          // difference from base/j
    ENDIF
  ELSE
    // no vowel follows
    Vowelout len=70
    FMT(j/j_)
  ENDIF
endphoneme


phoneme r
  vcd alv flp rhotic
  lengthmod 6

  IF prevPhW(@-) THEN
  ELSE
    IF nextPhW(isVowel) THEN
      IF prevPhW(isVowel) THEN
        ChangePhoneme(R)
      ELSE
        IF prevPhW(t) THEN
        ELSE
          InsertPhoneme(@-)
        ENDIF
      ENDIF
   ENDIF
  ENDIF

  IF prevPh(isFlag1) THEN
      ChangePhoneme(NULL)   // 'r' is already included in the previous vowel
  ENDIF

  CALL base/*
endphoneme



phoneme iR  // TEST "vier" = [f'iR] not successful
  vowel starttype #i endtype #@
  ipa iɐ
  flag1
  length 240
  FMT(vdiph2/i@_3)
endphoneme


phoneme UR
  vowel starttype #u endtype #@
  ipa ʊɐ
  flag1
  length 180
  FMT(vwl_de/uu_@)
endphoneme




phoneme oU  // for English words
  import_phoneme en-us/oU
endphoneme

phoneme A~
  vowel  starttype #a endtype #a
  length 260
  FMT(vnasal/aa_n4)
endphoneme


phoneme l2  // as [l] but devoice previous phoneme
  liquid lengthmod 7
  ChangePhoneme (l)
endphoneme

phoneme b
  vcd alv frc sibilant
  voicingswitch p
  IF nextPh(l2) THEN
    ChangePhoneme(p)
  ENDIF
  CALL base/b
endphoneme

phoneme d
  vcd alv stop
  voicingswitch t
  IF nextPh(l2) THEN
    ChangePhoneme(t)
  ENDIF
  CALL base/d
endphoneme

phoneme g
  vcd vel stop
  voicingswitch k
  IF nextPh(l2) THEN
    ChangePhoneme(k)
  ENDIF
  CALL base/g
endphoneme


// translate from English to German phonemes
equivalents NULL   // disable this table
0	O
3	3
3:	W :
@	@
@-	@-
@2      @
@5      @
@L      U l
a       a
a#      a
A:      A:
A@      A: r
aa      a
aI      aI
aI@     aI 3
aU      aU
aU@     aU 3
A~	A~
E       E
e:      e:
e@      E: r
eI      e j
i       I
I       I
I2      I
i:      i:
i@      i: 3
i@3     i: r
O       O
O:      O :
o:      o:
O@      O : r
o@      O : r
OI      OY
oU      oU
O~ 	O n
U       U
u:      u:
U@      U r
V       W
IR	I r
VR	W r
b	b
C	C
d	d
D       D
dZ	dZ
f	f
g	g
h	h
j	j
k	k
l	l
l#	l#
m	m
n	n
N	N
n^	n^
p	p
Q	Q
r	r
r-      r
s	s
S	S
t	t
T       T
t2      t
tS	tS
v	v
w	w
x	x
z	z
Z	Z
endphoneme
