
//====================================================
//  Portuguese  - based on Base2
//====================================================

phoneme I   // epenthetic i
  vwl starttype #i endtype #i
  unstressed
  length 90
  FMT(vowel/ii_6)
endphoneme

phoneme e~
  vwl starttype #e endtype #e
  length 240
  FMT(vnasal/e_n)
endphoneme

phoneme i~
  vwl starttype #i endtype #i
  length 240
  IfNextVowelAppend(;)
  FMT(vnasal/i_n)
endphoneme

phoneme o~
  vwl starttype #o endtype #o
  length 240
  FMT(vnasal/o_n)
endphoneme

phoneme u~
  vwl starttype #u endtype #u
  length 180
  FMT(vnasal/u_n)
endphoneme

phoneme &~
  vwl  starttype #@ endtype #@
  ipa ɐU+0303
  length 180
  IF thisPh(isFinalVowel) THEN
    FMT(vnasal/a#_n2)
  ELSE
    FMT(vnasal/a#_n)
  ENDIF
endphoneme

phoneme &U~
  vwl  starttype #@ endtype #u
  ipa ɐU+0303ʊU+0303
  length 240
  FMT(vnasal/a#u_n)
endphoneme

phoneme oI~
  vwl starttype #o endtype #i
  ipa oU+0303ɪU+0303
  length 260
  FMT(vnasal/oi_n)
endphoneme




phoneme &
  vwl starttype #@ endtype #@
  length 180
  FMT(vowel/a#_3)
endphoneme

phoneme &/       // Used for final "a" when next word starts with "a"
  vwl starttype #@ endtype #@
  length 180
  IF nextPh(isVowel) THEN
    ChangePhoneme(NULL)
  ENDIF
  FMT(vowel/a#_3)
endphoneme


phoneme A            // for "al" in European Portuguese, don't reduce to [&]
  vwl starttype #a endtype #a
  length 200
  FMT(vowel/a_2)
endphoneme



phoneme E
  vwl starttype #e endtype #e
  length 170
  FMT(vowel/ee_3)
endphoneme

phoneme e
  vwl starttype #e endtype #e
  length 160
  FMT(vowel/e)
endphoneme


phoneme y          // this is the same as [i] for Brazil
  vwl starttype #i endtype #i
  length 110
  IfNextVowelAppend(;)
  FMT(vowel/ii_6)
endphoneme


phoneme i/            // changes to [j] before a vowel
  vwl starttype #i endtype #i
  length 150
  IF nextPh(isVowel) THEN
    ChangePhoneme(j)
  ENDIF
  IfNextVowelAppend(;)
  FMT(vowel/ii_6)
endphoneme


phoneme O
  vwl starttype #o endtype #o
  length 170
  FMT(vowel/0)
endphoneme


phoneme u
  vwl starttype #u endtype #u
  length 160
  FMT(vowel/u_bck)
endphoneme

phoneme U
  vwl starttype #u endtype #u
  length 140
  IF thisPh(isWordEnd) AND thisPh(isAfterStress) AND nextPh(isVowel) THEN
    ChangePhoneme(w)
  ENDIF
  FMT(vowel/uu_bck)
endphoneme




phoneme aI
  vwl starttype #a endtype #i
  length 230
  IfNextVowelAppend(;)
  FMT(vdiph/ai)
endphoneme


phoneme eI
  vwl starttype #e endtype #i
  length 210
  IfNextVowelAppend(;)
  FMT(vdiph/ei)
endphoneme


phoneme OI
  vwl starttype #o endtype #i
  length 230
  IfNextVowelAppend(;)
  FMT(vdiph/0i)
endphoneme


phoneme eU
  vwl starttype #e endtype #u
  length 230
  FMT(vdiph/eu)
endphoneme


phoneme EU
  vwl starttype #e endtype #u
  length 230
  FMT(vdiph/eeu)
endphoneme




phoneme l
  import_phoneme en/l   // use 'dark' [l] after a vowel, should be [w]
endphoneme


phoneme x
  CALL base1/h
  ipa x
endphoneme


phoneme r-
  import_phoneme en/r-
endphoneme


phoneme s#     // This is [s] for Brazil, [S] for Portugal
  IF nextPh(isVoiced) THEN
    ChangePhoneme(z)
  ENDIF

  CALL base1/s
  ipa s
endphoneme


phoneme *
  vcd alv stp
  lengthmod 6
  ipa ɾ
  Vowelin f1=1  f2=1700 -300 300  f3=0 80
  Vowelout f1=2 f2=1700 -300 300  f3=0 80
  IF PreVoicing THEN
    FMT(d/x_tap)
  ENDIF
  FMT(d/tap2) addWav(x/d, 40)
endphoneme

