extra.inpro.synthesis.visual
Class SegmentModel

java.lang.Object
  extended by extra.inpro.synthesis.visual.SegmentModel

public class SegmentModel
extends java.lang.Object

the data model that can be manipulated by VisualTTS. We support mbrola data (i.e. segments and associated lists of pitch marks) and import from and export to mbrola format.

Author:
timo

Nested Class Summary
static class SegmentModel.PitchRange
          PitchRange is a simple container for a minimum and maximum pitch.
static class SegmentModel.Segment
          A segment of speech, usually a phone/phoneme.
static class SegmentModel.SegmentBoundPitchMark
           
 
Field Summary
private  SegmentModel.Segment activeLabel
          one of the segments may be active, meaning that it can be modified by moveRightBoundaryOfActiveLabel, moveAllBoundariesRightOfActiveLabel, ...)
private  PitchMark activePitchMark
          one of the pitchmarks may be active.
private  java.util.List<SegmentModel.Segment> segments
           
 
Constructor Summary
SegmentModel(java.util.List<SegmentModel.Segment> segments)
           
 
Method Summary
static SegmentModel createTestModel()
           
 int getDuration()
          overall duration in milliseconds
private static java.util.List<java.lang.String> getLines(java.io.InputStream is)
           
 SegmentModel.PitchRange getPitchRange()
           
 SegmentModel.Segment getPredecessor(SegmentModel.Segment segment)
           
 SegmentModel.Segment getSegmentAt(int time)
          lookup the segment that spans time t (if any)
 java.util.List<SegmentModel.Segment> getSegments()
           
 SegmentModel.Segment getSuccessor(SegmentModel.Segment segment)
           
 void insertPitchMark(int time, int pitch)
           
 void insertSegment(java.lang.String newSegment, int time)
          insert a segment with the given label at a given time.
 void moveAllBoundariesRightOfActiveLabel(int newTime)
           
 void moveRightBoundaryOfActiveLabelTo(int newTime)
           
static SegmentModel readFromFile(java.lang.String filename)
          create a segment model from an mbrola-formatted file
static SegmentModel readFromMbrolaLines(java.util.List<java.lang.String> lines)
          read from a list of lines, which
static SegmentModel readFromStream(java.io.InputStream is)
          create a segment model from an mbrola-formatted input stream
static SegmentModel readFromString(java.lang.String mbrola)
           
static void remove(SegmentModel.SegmentBoundPitchMark pm)
           
 void removeSegment(SegmentModel.Segment l)
           
 void saveToFile(java.io.File file)
           
 void setActiveLabel(SegmentModel.Segment l)
           
 void setActivePitchMark(PitchMark pm)
           
 void setPitchOfActiveMarkTo(float pitch)
           
 java.lang.String toString()
          return the segmentModel in mbrola format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

segments

private final java.util.List<SegmentModel.Segment> segments

activeLabel

private SegmentModel.Segment activeLabel
one of the segments may be active, meaning that it can be modified by moveRightBoundaryOfActiveLabel, moveAllBoundariesRightOfActiveLabel, ...)


activePitchMark

private PitchMark activePitchMark
one of the pitchmarks may be active. it can then be modified by setPitchOfActiveMarkTo().

Constructor Detail

SegmentModel

SegmentModel(java.util.List<SegmentModel.Segment> segments)
Method Detail

createTestModel

public static SegmentModel createTestModel()

readFromMbrolaLines

public static SegmentModel readFromMbrolaLines(java.util.List<java.lang.String> lines)
read from a list of lines, which


readFromString

public static SegmentModel readFromString(java.lang.String mbrola)

readFromStream

public static SegmentModel readFromStream(java.io.InputStream is)
create a segment model from an mbrola-formatted input stream


getLines

private static java.util.List<java.lang.String> getLines(java.io.InputStream is)
                                                  throws java.io.IOException
Throws:
java.io.IOException

readFromFile

public static SegmentModel readFromFile(java.lang.String filename)
                                 throws java.io.IOException
create a segment model from an mbrola-formatted file

Throws:
java.io.IOException

saveToFile

public void saveToFile(java.io.File file)
                throws java.io.IOException
Throws:
java.io.IOException

getDuration

public int getDuration()
overall duration in milliseconds


setActiveLabel

public void setActiveLabel(SegmentModel.Segment l)

moveRightBoundaryOfActiveLabelTo

public void moveRightBoundaryOfActiveLabelTo(int newTime)

moveAllBoundariesRightOfActiveLabel

public void moveAllBoundariesRightOfActiveLabel(int newTime)

setActivePitchMark

public void setActivePitchMark(PitchMark pm)

setPitchOfActiveMarkTo

public void setPitchOfActiveMarkTo(float pitch)

insertSegment

public void insertSegment(java.lang.String newSegment,
                          int time)
insert a segment with the given label at a given time. the place of insertion into the segment list is ensured depending on whether time t is before or after the time of the segment currently spanning this time.


removeSegment

public void removeSegment(SegmentModel.Segment l)

insertPitchMark

public void insertPitchMark(int time,
                            int pitch)

remove

public static void remove(SegmentModel.SegmentBoundPitchMark pm)

getPredecessor

public SegmentModel.Segment getPredecessor(SegmentModel.Segment segment)

getSuccessor

public SegmentModel.Segment getSuccessor(SegmentModel.Segment segment)

getSegmentAt

public SegmentModel.Segment getSegmentAt(int time)
lookup the segment that spans time t (if any)


getSegments

public java.util.List<SegmentModel.Segment> getSegments()

getPitchRange

public SegmentModel.PitchRange getPitchRange()

toString

public java.lang.String toString()
return the segmentModel in mbrola format

Overrides:
toString in class java.lang.Object