Documentation ¶
Index ¶
- Constants
- Variables
- func Amplitude(decibelLevel float64) float64
- func Frequency(pitch float64) float64
- func IsSeparator(c string) bool
- func NewFormulaSymMap() *map[string]FormulaSymbolType
- func PlaySound()
- func PointData(pt Point, model *Model) (time, value float64)
- func PointDataMinMax(pt Point, model *Model, baseline, delta, min, max float64) (time, value float64)
- func PointTime(pt Point, model *Model) float64
- func SpeedOfSound(temp float64) float64
- type BoolNode
- type Category
- type Control
- func (ctrl *Control) CalcChunks(text string) int
- func (ctrl *Control) InitUtterance(w *bufio.Writer)
- func (ctrl *Control) NextChunk(text string) int
- func (ctrl *Control) PhoneticParse(psp PhoneticParser, pString string, writer *bufio.Writer)
- func (ctrl *Control) SetIntonation(intonation int64)
- func (ctrl *Control) SynthPhoneticStringChunk(psp PhoneticParser, pschunk string, writer *bufio.Writer)
- func (ctrl *Control) SynthPhoneticStringToBuf(psp PhoneticParser, pString, trmParamFile string, buf []float64)
- func (ctrl *Control) SynthPhoneticStringToFile(psp PhoneticParser, pString, trmParamFile, outputFile string)
- func (ctrl *Control) SynthSequenceToBuf(trmParaFile string, buf []float64)
- func (ctrl *Control) SynthSequenceToFile(trmParamFile, outputFile string)
- func (ctrl *Control) ValidPosture(token string) bool
- type Drift
- type EqGrp
- type Equation
- type Event
- type ExprSymEquation
- type Foot
- type FormulaNode
- type FormulaNodeParser
- func (fnp *FormulaNodeParser) Finished() bool
- func (fnp *FormulaNodeParser) NextSymbol()
- func (fnp *FormulaNodeParser) Parse() *FormulaNode
- func (fnp *FormulaNodeParser) ParseExpr() *FormulaNode
- func (fnp *FormulaNodeParser) ParseFactor() *FormulaNode
- func (fnp *FormulaNodeParser) ParseTerm() *FormulaNode
- func (fnp *FormulaNodeParser) SkipSpaces()
- type FormulaSymMap
- type FormulaSymbolType
- type FormulaValueList
- type FricationInjCoefs
- type IntRange
- type IntonationFlags
- type IntonationPt
- type LogicNodeType
- type LogicSymbolType
- type Model
- func (mdl *Model) CategoryTry(nm string) *Category
- func (mdl *Model) ClearFormulaVals()
- func (mdl *Model) EquationGroupTry(nm string) *EqGrp
- func (mdl *Model) EquationIndexTry(nm string) (grpIdx, eqIdx int)
- func (mdl *Model) EquationTry(nm string) *Equation
- func (mdl *Model) EvalEquationFormula(eq *Equation) float64
- func (mdl *Model) FirstRule(postureSequence []Posture, ruleIdx int) (*Rule, int)
- func (mdl *Model) Param(idx int) (*Param, error)
- func (mdl *Model) ParamIdx(nm string) int
- func (mdl *Model) ParamMax(idx int) (float64, error)
- func (mdl *Model) ParamMin(idx int) (float64, error)
- func (mdl *Model) ParamTry(nm string) *Param
- func (mdl *Model) PostureTry(nm string) *Posture
- func (mdl *Model) Reset()
- func (mdl *Model) Save(configDir, configFile string)
- func (mdl *Model) SymbolTry(nm string) *Symbol
- func (mdl *Model) TransitionGroupIndexTry(nm string) (grpIdx, eqIdx int)
- func (mdl *Model) TransitionGroupSpIndexTry(nm string) (grpIdx, eqIdx int)
- func (mdl *Model) TransitionGroupSpTry(nm string) *TransGrp
- func (mdl *Model) TransitionGroupTry(nm string) *TransGrp
- func (mdl *Model) TransitionSpTry(nm string) *Transition
- func (mdl *Model) TransitionTry(nm string) *Transition
- type ModelConfig
- type NasalCoefs
- type NasalSections
- type NodeType
- type OroPharynxCoefs
- type OroPharynxRegions
- type OroPharynxSects
- type Param
- type ParamTransition
- type Parser
- type PhoneticParser
- type Point
- type PointOrSlope
- type Posture
- type PostureData
- type Rule
- func (r *Rule) EvalBoolExpr(postures []Posture) bool
- func (r *Rule) EvalExprSyms(tempos []float64, postures []Posture, model *Model, syms []*float64)
- func (r *Rule) ExprEq(nm string) *ExprSymEquation
- func (r *Rule) SetExprList(exprs []string, model *Model) *[]BoolNode
- func (r *Rule) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type RuleData
- type Sequence
- func (seq *Sequence) AddFoot()
- func (seq *Sequence) AddIntonationPoint(semiTone, offsetTime, slope float64, ruleIdx int)
- func (seq *Sequence) AddPosture()
- func (seq *Sequence) AddToneGroup()
- func (seq *Sequence) ApplyIntonation()
- func (seq *Sequence) ApplyIntonationSmooth()
- func (seq *Sequence) ApplyRule(rule *Rule, postures []Posture, tempos []float64, postureIdx int)
- func (seq *Sequence) ClearMacroIntonation()
- func (seq *Sequence) GenOutput(w *bufio.Writer)
- func (seq *Sequence) GenerateEventList()
- func (seq *Sequence) GetBeatAtIndex(idx int) float64
- func (seq *Sequence) InitToneGroups(intonationPath string) error
- func (seq *Sequence) InsertEvent(n int, t, v float64) *Event
- func (seq *Sequence) NewPostureWithObject(p *Posture)
- func (seq *Sequence) ParseGroups(idx int, count int, f *bufio.Reader)
- func (seq *Sequence) SetFixedIntonationParams(pitch, pretonicRange, pretonicLift, tonicRange, tonicMovement float64)
- func (seq *Sequence) SetFullTimeScale()
- func (seq *Sequence) SetRadiusCoefs(values []float64)
- func (seq *Sequence) SetZeroRef(nv int)
- func (seq *Sequence) SlopeRatioEvents(evIdx int, sr *SlopeRatio, baseline, paramDelta, min, max float64) float64
- type Slope
- type SlopeRatio
- type Symbol
- type SymbolType
- type Target
- type ThreeWayJunction
- type ToneGroup
- type ToneType
- type TractCtrl
- type TractParams
- type TransGrp
- type TransGrps
- type TransGrpsSp
- type Transition
- type TransitionType
- type TrmConfig
- type Tube
- func (tube *Tube) InitNasal()
- func (tube *Tube) InitSndBuf(frames int, channels, rate, bitDepth int)
- func (tube *Tube) InitSynth()
- func (tube *Tube) InitializeSynthesizer()
- func (tube *Tube) MonoScale() float64
- func (tube *Tube) ParseTrmFile(fn string)
- func (tube *Tube) RateInterpolation()
- func (tube *Tube) Reset()
- func (tube *Tube) ResizeSndBuf(frames int)
- func (tube *Tube) SetCtrlParams(idx int)
- func (tube *Tube) SetFricationTaps()
- func (tube *Tube) StereoScale(leftScale, rightScale *float64)
- func (tube *Tube) SynthReset(initBuffer bool)
- func (tube *Tube) SynthSignal()
- func (tube *Tube) SynthToFile(trmParamFile, outFile string)
- func (tube *Tube) SynthTrmInput()
- func (tube *Tube) TubeCoefficients()
- func (tube *Tube) VocalTract(input, frication float64) (output float64)
- type VoiceParams
Constants ¶
const ( SymInvalid = iota SymAdd SymSub SymMult SymDiv SymRtParen SymLftParen SymString SymTypeN )
const ( FormulaSymTransition1 = iota FormulaSymTransition2 FormulaSymTransition3 FormulaSymTransition4 FormulaSymQssa1 FormulaSymQssa2 FormulaSymQssa3 FormulaSymQssa4 FormulaSymQssb1 FormulaSymQssb2 FormulaSymQssb3 FormulaSymQssb4 FormulaSymTempo1 FormulaSymTempo2 FormulaSymTempo3 FormulaSymTempo4 FormulaSymRd FormulaSymBeat FormulaSymMark1 FormulaSymMark2 FormulaSymMark3 FormulaSymTypeN )
const ( OroPharynxReg1 = iota // S1 OroPharynxReg2 // S2 OroPharynxReg3 // S3 OroPharynxReg4 // S4 & S5 OroPharynxReg5 // S6 & S7 OroPharynxReg6 // S8 OroPharynxReg7 // S9 OroPharynxReg8 // S10 OroPharynxRegCnt )
const ( OroPharynxC1 = iota // R1-R2 (S1-S2) OroPharynxC2 // R2-R3 (S2-S3) OroPharynxC3 // R3-R4 (S3-S4) OroPharynxC4 // R4-R5 (S5-S6) OroPharynxC5 // R5-R6 (S7-S8) OroPharynxC6 // R6-R7 (S8-S9) OroPharynxC7 // R7-R8 (S9-S10) OroPharynxC8 // R8-Air (S10-Air) OroPharynxCoefCnt )
const ( OroPharynxS1 = iota // OroPharynxReg1 OroPharynxS2 // OroPharynxReg2 OroPharynxS3 // OroPharynxReg3 OroPharynxS4 // OroPharynxReg4 OroPharynxS5 // OroPharynxReg4 OroPharynxS6 // OroPharynxReg5 OroPharynxS7 // OroPharynxReg5 OroPharynxS8 // OroPharynxReg6 OroPharynxS9 // OroPharynxReg7 OroPharynxS10 // OroPharynxReg8 OroPharynxSectCnt )
const ( NasalS1 = iota NasalS2 NasalS3 NasalS4 NasalS5 NasalS6 NasalSectCnt Velum = NasalS1 )
const ( NasalC1 = NasalS1 // N1-N2 NasalC2 = NasalS2 // N2-N3 NasalC3 = NasalS3 // N3-N4 NasalC4 = NasalS4 // N4-N5 NasalC5 = NasalS5 // N5-N6 NasalC6 = NasalS6 // N6-Air NasalCoefCnt = NasalSectCnt )
const ( ThreeWayLeft = iota ThreeWayRight ThreeWayUpper ThreeWayCnt )
const ( FricationInjC1 = iota // S3 FricationInjC2 // S4 FricationInjC3 // S5 FricationInjC4 // S6 FricationInjC5 // S7 FricationInjC6 // S8 FricationInjC7 // S9 FricationInjC8 // S10 FricationInjCoefCnt )
const Bottom = 1
const DiPhone = 2
const Factor = 377.0
const GlottalSourcePulse = 0
const GlottalSourceSine = 1
const GsTrmTubeMinRadius = 0.001
const InitialSeed = 0.7892347
const OutputScale = 0.95
const PitchBase = 220.0
const PitchOffset = 3
const TetraPhone = 4
const Top = 0
const TriPhone = 3
const VolMax = 60
const VtScale = 0.125
Variables ¶
var Kit_FormulaSymbolType = kit.Enums.AddEnum(FormulaSymTypeN, kit.NotBitFlag, nil)
var Kit_Intonation = kit.Enums.AddEnum(IntonationFlagsN, kit.BitFlag, nil)
var Kit_LogicNodeType = kit.Enums.AddEnum(LogicNodeTypeN, kit.NotBitFlag, nil)
var Kit_LogicSymbolType = kit.Enums.AddEnum(LogicSymTypeN, kit.NotBitFlag, nil)
var Kit_NodeType = kit.Enums.AddEnum(NodeTypeN, kit.NotBitFlag, nil)
var Kit_SymbolType = kit.Enums.AddEnum(SymTypeN, kit.NotBitFlag, nil)
var Kit_ToneType = kit.Enums.AddEnum(ToneTypeN, kit.NotBitFlag, nil)
var Kit_TransitionType = kit.Enums.AddEnum(TransTypeN, kit.NotBitFlag, nil)
Functions ¶
func IsSeparator ¶
func NewFormulaSymMap ¶
func NewFormulaSymMap() *map[string]FormulaSymbolType
func PointDataMinMax ¶
func PointDataMinMax(pt Point, model *Model, baseline, delta, min, max float64) (time, value float64)
PointDataMinMax
func SpeedOfSound ¶
SpeedOfSound returns the speed of sound according to the value of the temperature (in Celsius degrees)
Types ¶
type BoolNode ¶
type BoolNode struct { Type LogicNodeType Child1 *BoolNode Child2 *BoolNode Cat *Category MatchAll bool }
func (*BoolNode) BoolNodeEval ¶
type Control ¶
type Control struct { Model *Model Sequence *Sequence ModelConfig ModelConfig TrmConfig TrmConfig Tube *Tube `view:"noinline"` }
func NewControl ¶
func (*Control) CalcChunks ¶
Chunks are separated by /c. There is always one /c at the begin and another at the end of the string.
func (*Control) InitUtterance ¶
func (*Control) PhoneticParse ¶
func (ctrl *Control) PhoneticParse(psp PhoneticParser, pString string, writer *bufio.Writer)
func (*Control) SynthPhoneticStringChunk ¶
func (ctrl *Control) SynthPhoneticStringChunk(psp PhoneticParser, pschunk string, writer *bufio.Writer)
func (*Control) SynthPhoneticStringToBuf ¶
func (ctrl *Control) SynthPhoneticStringToBuf(psp PhoneticParser, pString, trmParamFile string, buf []float64)
func (*Control) SynthPhoneticStringToFile ¶
func (ctrl *Control) SynthPhoneticStringToFile(psp PhoneticParser, pString, trmParamFile, outputFile string)
func (*Control) SynthSequenceToBuf ¶
SynthSequenceToBuf synthesizes speech from data contained in the event list
func (*Control) SynthSequenceToFile ¶
SynthSequenceToFile synthesizes speech from data contained in the event list
type Drift ¶
type Drift struct { Deviation float64 `desc:"the amount of drift in semitones above and below the median. A value around 1 or so should give good results."` Offset float64 `desc:"pitch offset"` Seed float64 `desc:""` A0 float64 `desc:""` B1 float64 `desc:""` PrvSample float64 `desc:""` }
func (*Drift) SetUp ¶
Setup sets the params - deviation value around 1 should be good, sr the sample rate of the system in Hz---this should be the same as the control rate (250 Hz), lpcutoff - the cutoff in Hz of the lowpass filter applied to the noise generator. This value must range from 0 Hz to nyquist. A low value around 1 - 4 Hz should give good results.
type Equation ¶
type Equation struct { Name string `xml:"name,attr"` Comment string `xml:"comment"` Formula string `xml:"formula,attr"` FormulaRoot *FormulaNode }
func (*Equation) EvalFormula ¶
func (eq *Equation) EvalFormula(sl *FormulaValueList) float64
func (*Equation) SetFormula ¶
func (eq *Equation) SetFormula(formula string) *FormulaNode
type ExprSymEquation ¶
type Foot ¶
type FormulaNode ¶
type FormulaNode struct { Type NodeType Child1 *FormulaNode Child2 *FormulaNode Symbol FormulaSymbolType `desc:"These are dynamic variables looked up from a map"` ConstVal float64 `desc:"Constants in some formulas"` }
func NewFormulaConstNode ¶
func NewFormulaConstNode(val float64) *FormulaNode
NewFormulaSymbolNode is a special case for variables of type FormulaSymbolType
func NewFormulaNode ¶
func NewFormulaNode(c1 *FormulaNode, c2 *FormulaNode, nodeType NodeType) *FormulaNode
NewFormulaNode
func NewFormulaSymbolNode ¶
func NewFormulaSymbolNode(symbol FormulaSymbolType) *FormulaNode
NewFormulaSymbolNode is a special case for variables of type FormulaSymbolType
func (*FormulaNode) Eval ¶
func (fn *FormulaNode) Eval(sl *FormulaValueList) float64
type FormulaNodeParser ¶
type FormulaNodeParser struct { FormulaValueList FormulaValueList S string Pos int Symbol string SymbolType SymbolType }
func NewFormulaNodeParser ¶
func NewFormulaNodeParser(s string) *FormulaNodeParser
func (*FormulaNodeParser) Finished ¶
func (fnp *FormulaNodeParser) Finished() bool
func (*FormulaNodeParser) NextSymbol ¶
func (fnp *FormulaNodeParser) NextSymbol()
func (*FormulaNodeParser) ParseExpr ¶
func (fnp *FormulaNodeParser) ParseExpr() *FormulaNode
ParseExpr EXPRESSION -> TERM { ADD_OP TERM }
func (*FormulaNodeParser) ParseFactor ¶
func (fnp *FormulaNodeParser) ParseFactor() *FormulaNode
Parse Factor -- FACTOR -> "(" EXPRESSION ")" | SYMBOL | CONST | ADD_OP FACTOR
func (*FormulaNodeParser) ParseTerm ¶
func (fnp *FormulaNodeParser) ParseTerm() *FormulaNode
ParseTerm TERM -> FACTOR { MULT_OP FACTOR }
func (*FormulaNodeParser) SkipSpaces ¶
func (fnp *FormulaNodeParser) SkipSpaces()
SkipSpaces moves the index into string past white space
type FormulaSymMap ¶
type FormulaSymMap struct {
SymMap map[string]FormulaSymbolType
}
type FormulaValueList ¶
type FormulaValueList [FormulaSymTypeN]float64
type FricationInjCoefs ¶
type FricationInjCoefs int32
FricationInjCoefs are the oropharynx scattering junction coefficients (between each region)
type IntRange ¶
IntRange is the way to specify the min and max values for an integer range (used here when generating random numbers)
type IntonationFlags ¶
type IntonationFlags int64
IntonationFlags
const ( // 0x01 IntonationMicro IntonationFlags = iota // 0x02 IntonationMacro // 0x04 IntonationSmooth // 0x08 IntonationDrift // 0x10 IntonationRandom IntonationFlagsN )
type IntonationPt ¶
type IntonationPt struct { SemiTone float64 `desc:"value of the intonation in semitones"` Offset float64 `desc:"points are timed wrt a beat + this offset"` Slope float64 `desc:"Slope of point"` RuleIdx int `desc:"Index of posture which is the focus of this point"` Sequence *Sequence `desc:"Current events"` }
func NewIntonationPt ¶
func NewIntonationPt(seq *Sequence) *IntonationPt
func (*IntonationPt) AbsTime ¶
func (ip *IntonationPt) AbsTime() float64
func (*IntonationPt) BeatTime ¶
func (ip *IntonationPt) BeatTime() float64
type LogicNodeType ¶
type LogicNodeType int
const ( // LogicSymInvalid LogicNodeInvalid LogicNodeType = iota // LogicNodeOr // LogicNodeNot // LogicNodeXor // LogicNodeAnd // LogicNodeTerminal LogicNodeTypeN )
type LogicSymbolType ¶
type LogicSymbolType int
const ( // LogicSymInvalid LogicSymInvalid LogicSymbolType = iota // LogicSymOr // LogicSymNot // LogicSymXor // LogicSymAnd // LogicSymRtParen // LogicSymLftParen // LogicSymString LogicSymTypeN )
type Model ¶
type Model struct { Categories []Category `xml:"categories>category"` Params []Param `xml:"parameters>parameter"` Symbols []Symbol `xml:"symbols>symbol"` Postures []Posture `xml:"postures>posture"` Rules []*Rule `xml:"rules>rule"` EqGrps []EqGrp `xml:"equations>equation-group"` TransGrps TransGrps `xml:"transitions>transition-group"` TransGrpsSp TransGrpsSp `xml:"special-transitions>transition-group"` FormulaVals FormulaValueList }
func (*Model) CategoryTry ¶
CategoryTry returns the address of the named Category or nil if not found
func (*Model) ClearFormulaVals ¶
func (mdl *Model) ClearFormulaVals()
func (*Model) EquationGroupTry ¶
EquationGroupTry
func (*Model) EquationIndexTry ¶
EquationIndexTry returns the group and equation index if name is found, otherwise -1, -1
func (*Model) EvalEquationFormula ¶
EvalEquationFormula
func (*Model) FirstRule ¶
FirstRule finds the first Rule that matches the given sequence of Postures. Returns rule and index
func (*Model) PostureTry ¶
CategoryTry returns the address of the named Posture or nil if not found
func (*Model) TransitionGroupIndexTry ¶
TransitionGroupIndexTry returns the group and transition index if name is found, otherwise -1, -1
func (*Model) TransitionGroupSpIndexTry ¶
TransitionGroupSpIndexTry returns the special group and transition index if name is found, otherwise -1, -1
func (*Model) TransitionGroupSpTry ¶
TransitionGroupSpTry returns the address of the named special TransitionGroup or nil if not found
func (*Model) TransitionGroupTry ¶
TransitionGrpTry returns the address of the named TransitionGroup or nil if not found
func (*Model) TransitionSpTry ¶
func (mdl *Model) TransitionSpTry(nm string) *Transition
TransitionSpTry returns the address of the named special Transition or nil if not found
func (*Model) TransitionTry ¶
func (mdl *Model) TransitionTry(nm string) *Transition
TransitionTry returns the address of the named Transition or nil if not found
type ModelConfig ¶
type ModelConfig struct { Name string Desc string Voice string ControlRate float64 `desc:"1.0-1000.0 input tables/second (Hz)"` Tempo float64 PitchOffset float64 DriftDeviation float64 DriftLowCutoff float64 Intonation int64 `desc:"Holds IntonationFlags"` MicroIntonation int `desc:"One of 5 types of intonation"` MacroIntonation int `desc:"One of 5 types of intonation"` SmoothIntonation int `desc:"One of 5 types of intonation"` DriftIntonation int `desc:"One of 5 types of intonation"` RandomIntonation int `desc:"One of 5 types of intonation"` // Intonation parameters. NotionalPitch float64 PretonicRange float64 PretonicLift float64 TonicRange float64 TonicMovement float64 Dictionary1 string Dictionary2 string Dictionary3 string }
func (*ModelConfig) Defaults ¶
func (mc *ModelConfig) Defaults()
func (*ModelConfig) Load ¶
func (mc *ModelConfig) Load(path string) error
Load will be passed data/en/trm_control_model.config or equivalent file
func (*ModelConfig) OpenJSON ¶
func (mc *ModelConfig) OpenJSON(fn string) error
OpenJSON opens model config from a JSON-formatted file (i.e. model params)
type NasalSections ¶
type NasalSections int32
NasalSections are different sections of the nasal tract
type OroPharynxCoefs ¶
type OroPharynxCoefs int32
OroPharynxCoefs are the oropharynx scattering junction coefficients (between each region)
type OroPharynxRegions ¶
type OroPharynxRegions int32
OroPharynxRegions are different regions of the vocal tract
type OroPharynxSects ¶
type OroPharynxSects int32
OroPharynxCoefs are the oropharynx scattering junction coefficients (between each region)
type Param ¶
type ParamTransition ¶
type ParamTransition struct { Name string `xml:"attr,name"` Type string `xml:"attr,transition"` Transition *Transition }
type Parser ¶
type Parser struct { Model *Model Str string Pos int Symbol string SymType LogicSymbolType }
Parse
func (*Parser) GetBoolNode ¶
GetNode returns the next boolean node
func (*Parser) SkipSpaces ¶
func (pars *Parser) SkipSpaces()
SkipSpaces moves the index into string past white space
type PhoneticParser ¶
type Point ¶
type Point struct { PointOrSlope Type TransitionType `xml:"type,attr"` Value float64 `xml:"value,attr"` IsPhantom bool `xml:"is-phantom,attr"` FreeTime float64 `xml:"free-time,attr" desc:"milliseconds"` TimeExpr *Equation `xml:"time-expression,attr"` }
Point -- If timeExpression is not empty, time = timeExpression, otherwise time = freeTime.
func (*Point) IsSlopeRatio ¶
type PointOrSlope ¶
type PointOrSlope struct { }
func (*PointOrSlope) IsSlopeRatio ¶
func (pos *PointOrSlope) IsSlopeRatio() bool
type Posture ¶
type Posture struct { Name string `xml:"symbol,attr"` Categories []Category `xml:"posture-categories>category-ref"` ParamTargets []Target `xml:"parameter-targets>target"` SymTargets []Target `xml:"symbol-targets>target"` Comment string `xml:"comment"` }
func NewPosture ¶
func (*Posture) CategoryTry ¶
CategoryTry returns the address of the named Posture or nil if not found
func (*Posture) IsMemberOfCategory ¶
type PostureData ¶
func (*PostureData) Defaults ¶
func (pd *PostureData) Defaults()
type Rule ¶
type Rule struct { BoolExprs []string `xml:"boolean-expressions>boolean-expression"` ParamTransitions []*ParamTransition `xml:"parameter-profiles>parameter-transition"` SpecialTransitions []*ParamTransition `xml:"special-profiles>parameter-transition"` ExprSymEquations []*ExprSymEquation `xml:"expression-symbols>symbol-equation"` Comment string `xml:"comment"` BoolNodes []BoolNode }
func (*Rule) EvalBoolExpr ¶
func (*Rule) EvalExprSyms ¶
EvalExpr
func (*Rule) ExprEq ¶
func (r *Rule) ExprEq(nm string) *ExprSymEquation
func (*Rule) UnmarshalXML ¶
type Sequence ¶
type Sequence struct { Model *Model Events []Event ZeroRef int ZeroIdx int Duration int TimeQuant int MacroFlag bool MicroFlag bool DriftFlag bool SmoothInton bool PitchMean float64 GlobalTempo float64 Multiplier float64 PostureDatum []*PostureData PostureTempos []float64 CurPosture int Feet []*Foot CurFoot int ToneGroups []*ToneGroup CurToneGroup ToneType RuleDatum []*RuleData CurRule int Min [16]float64 Max [16]float64 IntonationPts []IntonationPt Drift *Drift TgUseRandom bool IntonRandom float64 TgParams [][]float64 TgCount []int UseFixedIntonation bool IntonationParams []float64 `desc:"these will be the random intonation values or the fixed if useFixed is true"` IntonationParamsFixed []float64 RadiusCoef []float64 // TRM::Tube::TOTAL_REGIONS Rand *rand.Rand // contains filtered or unexported fields }
func NewSequence ¶
func (*Sequence) AddIntonationPoint ¶
func (*Sequence) AddPosture ¶
func (seq *Sequence) AddPosture()
func (*Sequence) AddToneGroup ¶
func (seq *Sequence) AddToneGroup()
func (*Sequence) ApplyIntonation ¶
func (seq *Sequence) ApplyIntonation()
func (*Sequence) ApplyIntonationSmooth ¶
func (seq *Sequence) ApplyIntonationSmooth()
func (*Sequence) ClearMacroIntonation ¶
func (seq *Sequence) ClearMacroIntonation()
func (*Sequence) GenerateEventList ¶
func (seq *Sequence) GenerateEventList()
func (*Sequence) GetBeatAtIndex ¶
func (*Sequence) InitToneGroups ¶
func (*Sequence) InsertEvent ¶
InsertEvent
func (*Sequence) NewPostureWithObject ¶
func (*Sequence) ParseGroups ¶
func (*Sequence) SetFixedIntonationParams ¶
func (*Sequence) SetFullTimeScale ¶
func (seq *Sequence) SetFullTimeScale()
func (*Sequence) SetRadiusCoefs ¶
func (*Sequence) SetZeroRef ¶
func (*Sequence) SlopeRatioEvents ¶
func (seq *Sequence) SlopeRatioEvents(evIdx int, sr *SlopeRatio, baseline, paramDelta, min, max float64) float64
type Slope ¶
type Slope struct { PointOrSlope Slope float64 `xml:"slope,attr"` DisplayTime float64 `xml:"display-time,attr"` }
func (*Slope) IsSlopeRatio ¶
type SlopeRatio ¶
type SlopeRatio struct { PointOrSlope Points []*Point `xml:"points>point"` Slopes []*Slope `xml:"slopes>slope"` }
func NewSlopeRatio ¶
func NewSlopeRatio() *SlopeRatio
func (*SlopeRatio) IsSlopeRatio ¶
func (sr *SlopeRatio) IsSlopeRatio() bool
func (*SlopeRatio) NSlopeUnits ¶
func (sr *SlopeRatio) NSlopeUnits() float64
type Symbol ¶
type SymbolType ¶
type SymbolType int
type ThreeWayJunction ¶
type ThreeWayJunction int32
ThreeWayJunction for the three-way junction alpha coefficients
type TractCtrl ¶
type TractCtrl struct { GlotPitch float64 `` /* 137-byte string literal not displayed */ GlotVol float64 `min:"0" max:"60" desc:"glottal volume (DB?) typically 60 when present and 0 when not, and sometimes 54, 43.5, 42, "` AspVol float64 `min:"0" max:"10" desc:"aspiration volume -- typically 0 when not present and 10 when present"` FricVol float64 `min:"0" max:"24" desc:"fricative volume -- typically 0 or .25 .4, .5, .8 but 24 for ph"` FricPos float64 `min:"1" max:"7" desc:"ficative position -- varies continuously between 1-7"` FricCf float64 `` /* 136-byte string literal not displayed */ FricBw float64 `min:"500" max:"4500" desc:"fricative bw seems like a frequency -- common intermediate values are 600, 900, 2000, 2600"` Radii [OroPharynxRegCnt]float64 `desc:"Radii 2-8 radius of pharynx vocal tract segment as determined by tongue etc -- typically around 1, ranging .5 - 1.7"` Velum float64 `min:".1" max:"1.5" desc:"velum opening -- 1.5 when fully open, .1 when closed, and .25, .5 intermediates used"` }
ToDo: desc for all Radii
func (*TractCtrl) SetFromParams ¶
SetFromParams fast copy of parameters from other control params
func (*TractCtrl) SetFromValues ¶
SetFromValues - order must be preserved!
func (*TractCtrl) UpdateFromDeltas ¶
UpdateFromDeltas updates values in this set of params from deltas
type TractParams ¶
type TractParams struct { Temp float64 Loss float64 MouthCoef float64 NoseCoef float64 ThroatCutoff float64 ThroatVol float64 VtlOff float64 MixOff float64 WaveForm int32 NoiseMod bool }
func (*TractParams) Defaults ¶
func (vtc *TractParams) Defaults()
Defaults sets the default values for the vocal tract
type TransGrp ¶
type TransGrp struct { Name string `xml:"name,attr"` Transitions []*Transition `xml:"transition"` }
type TransGrps ¶
type TransGrps struct {
Grps []*TransGrp `xml:"transitions>transition-group"`
}
func (*TransGrps) UnmarshalXML ¶
type TransGrpsSp ¶
type TransGrpsSp struct {
Grps []*TransGrp `xml:"special-transitions>transition-group"`
}
func (*TransGrpsSp) UnmarshalXML ¶
func (grps *TransGrpsSp) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Transition ¶
type Transition struct { Name string `xml:"name,attr"` Type TransitionType `xml:"type,attr"` PtSlpList []interface{} `xml:"point-or-slopes>slope-ratio>points>point"` Comment string `xml:"comment"` }
Transition
type TransitionType ¶
type TransitionType int
TransitionType
const ( // TransInvalid TransInvalid TransitionType = iota // TransDiPhone TransDiPhone // TransTriPhone TransTriPhone // TransTetraPhone TransTetraPhone TransTypeN )
type TrmConfig ¶
type TrmConfig struct { OutputRate float64 `desc:"output sample rate (22.05, 44.1)"` Volume float64 `desc:"master volume (0 - 60 dB)"` Channels int `desc:"# of sound output channels (1, 2)"` Balance float64 `desc:"stereo balance (-1 to +1)"` Waveform float64 `desc:"GS waveform type (0=PULSE, 1=SINE)"` VtlOffset float64 `desc:"tube length offset"` Temperature float64 `desc:"tube temperature (25 - 40 C)"` LossFactor float64 `desc:"junction loss factor in (0 - 5 %)"` MouthCoef float64 `desc:"mouth aperture coefficient"` NoseCoef float64 `desc:"nose aperture coefficient"` ThroatCutoff float64 `desc:"throat lp cutoff (50 - nyquist Hz)"` ThroatVolume float64 `desc:"throat volume (0 - 48 dB)"` NoiseModulation int `desc:"pulse mod. of noise (0=OFF, 1=ON)"` MixOffset float64 `desc:"noise crossmix offset (30 - 60 dB)"` // Parameters that depend on the voice. GlottalPulseTp float64 `desc:"% glottal pulse rise time"` GlottalPulseTnMin float64 `desc:"% glottal pulse fall time minimum"` GlottalPulseTnMax float64 `desc:"% glottal pulse fall time maximum"` Breathiness float64 `desc:"% glottal source breathiness"` VocalTractLength float64 RefGlottalPitch float64 ApertureRadius float64 `desc:"aperture scl. radius (3.05 - 12 cm)"` // ToDo: nose sections should be a lookup NoseRadii []float64 `desc:"fixed nose radii (0 - 3 cm)"` // ToDo: also shouldn't be hardcoded RadiusCoefs []float64 GlobalRadiusCoef float64 GlobalNoseRadiusCoef float64 }
func NewTrmConfig ¶
func NewTrmConfig() *TrmConfig
NewTrmConfig creates and returns a TrmConfig struct after making slices for NoseRadii and RadiusCoefs
type Tube ¶
type Tube struct { Buf sound.Wave `desc:""` Volume float64 `desc:""` Balance float64 `desc:""` Duration float64 `desc:""` // duration of synthesized sound Params TractParams `desc:""` Voice VoiceParams `desc:""` Dictionary etable.Table `desc:""` TrmParams []TractCtrl `desc:"all of the trm params read from the trmParamFile"` // derived values CtrlRate float64 `desc:""` // 1.0-1000.0 input tables/second (Hz) CtrlPeriod int `desc:""` SampleRate int `desc:""` TubeLength float64 `desc:""` // actual length in cm CurData TractCtrl `desc:""` // current control data CurDelta TractCtrl `desc:""` // current control data // tube and tube coefficients Oropharynx [OroPharynxSectCnt][2][2]float64 OropharynxCoefs [OroPharynxCoefCnt]float64 Nasal [NasalSectCnt][2][2]float64 NasalCoefs [NasalCoefCnt]float64 Alpha [ThreeWayCnt]float64 CurPtr int PrvPtr int // memory for frication taps FricationTap [FricationInjCoefCnt]float64 DampingFactor float64 // calculated CrossmixFactor float64 // calculated BreathFactor float64 PrvGlotAmplitude float64 SynthOutput []float64 Wave []float64 RateConverter trm.RateConverter MouthRadiationFilter trm.RadiationFilter MouthReflectionFilter trm.ReflectionFilter NasalRadiationFilter trm.RadiationFilter NasalReflectionFilter trm.ReflectionFilter Throat trm.Throat GlottalSource trm.WavetableGlottalSource BandpassFilter trm.BandpassFilter NoiseFilter trm.NoiseFilter NoiseSource trm.NoiseSource }
func (*Tube) InitSndBuf ¶
InitBuffer
func (*Tube) InitializeSynthesizer ¶
func (tube *Tube) InitializeSynthesizer()
InitializeSynthesizer initializes all variables so that the synthesis can be run
func (*Tube) ParseTrmFile ¶
ParseTrmFile trm parameter file, order is fixed!
func (*Tube) RateInterpolation ¶
func (tube *Tube) RateInterpolation()
RateInterpolation interpolates table values at the sample rate
func (*Tube) SetCtrlParams ¶
SetCtrlParams calculates the current table values, and their associated sample-to-sample delta values.
func (*Tube) SetFricationTaps ¶
func (tube *Tube) SetFricationTaps()
SetFricationTaps Sets frication taps according to the current position and amplitude of frication
func (*Tube) StereoScale ¶
StereoScale
func (*Tube) SynthTrmInput ¶
func (tube *Tube) SynthTrmInput()
SynthTrmInput synthesizes from the trm parameter data
func (*Tube) TubeCoefficients ¶
func (tube *Tube) TubeCoefficients()
TubeCoefficients calculates the scattering coefficients for the vocal tract according to the current radii. Also calculates the coefficients for the reflection/radiation filter pairs for the mouth and nose.
func (*Tube) VocalTract ¶
Update updates the pressure wave throughout the vocal tract, and returns the summed output of the oral and nasal cavities. Also injects frication appropriately
type VoiceParams ¶
type VoiceParams struct { TractLength float64 `desc:"length of vocal tract - shortest for baby voice, longest for male voice"` GlotPulseFallMin float64 `desc:"glottal pulse is the rate at which the vocal folds of the glottis open and close - not sure about FallMin/FallMax"` GlotPulseFallMax float64 `desc:"glottal pulse is the rate at which the vocal folds of the glottis open and close - not sure about FallMin/FallMax"` GlotPitchRef float64 `desc:"the pitch of the voice is usually set by the frequency of glottal pulses during vowels or voiced consonants"` Breath float64 `desc:"how much air escapes on each glottal pulse, more for female voices"` GlotPulseRise float64 `desc:"glottal pulse is the rate at which the vocal folds of the glottis open and close - not sure about rise"` ApertureRadius float64 `desc:""` NoseRadii [6]float64 `desc:"fixed nose radii (0 - 3 cm)"` NoseRadiusCoef float64 `desc:"global nose radius coefficient"` RadiusCoef float64 `desc:""` }
VoiceParams are the parameters that control the quality of the voice
func (*VoiceParams) Defaults ¶
func (vp *VoiceParams) Defaults()
DefaultParams are the defaults, some of which don't change