Package nzilbb.media.wav
Class FragmentExtractor
- java.lang.Object
-
- nzilbb.media.wav.FragmentExtractor
-
- All Implemented Interfaces:
MediaConverter
public class FragmentExtractor extends Object implements MediaConverter
MediaConverter that extracts portions of sound samples using the javax.sound.sampled API, with optional resampling.- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Constructor Summary
Constructors Constructor Description FragmentExtractor()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParameterSet
configure(ParameterSet configuration)
Configure the converter.boolean
conversionSupported(String sourceType, String destinationType)
Determines whether this converter supports conversion between the given types.Double
getEnd()
Getter forend
.Integer
getSampleRate()
Getter forsampleRate
: Sample rate.Double
getStart()
Getter forstart
.FragmentExtractor
setEnd(Double end)
Setter forend
.FragmentExtractor
setSampleRate(Integer newSampleRate)
Setter forsampleRate
: Sample rate.FragmentExtractor
setStart(Double start)
Setter forstart
.MediaThread
start(String sourceType, File source, String destinationType, File destination)
Starts conversion.
-
-
-
Method Detail
-
getSampleRate
public Integer getSampleRate()
Getter forsampleRate
: Sample rate.- Returns:
- Sample rate.
-
setSampleRate
public FragmentExtractor setSampleRate(Integer newSampleRate)
Setter forsampleRate
: Sample rate.- Parameters:
newSampleRate
- Sample rate.- Returns:
- this
-
getStart
public Double getStart()
Getter forstart
.- Returns:
- Start time of fragment.
-
setStart
public FragmentExtractor setStart(Double start)
Setter forstart
.- Parameters:
start
- Start time of fragment.- Returns:
- this.
-
getEnd
public Double getEnd()
Getter forend
.- Returns:
- End time of fragment.
-
setEnd
public FragmentExtractor setEnd(Double end)
Setter forend
.- Parameters:
end
- End time of fragment.- Returns:
- this.
-
configure
public ParameterSet configure(ParameterSet configuration) throws MediaException
Configure the converter. This might include executable paths, conversion parameters, etc.This method can be invoked with an empty parameter set, to discover what (if any) parameters are required. If parameters are returned, and user interaction is possible, then the user may be presented with an interface for setting/confirming these parameters.
- Specified by:
configure
in interfaceMediaConverter
- Parameters:
configuration
- The configuration for the converter.- Returns:
- A list of configuration parameters must be set before the converter can be used.
- Throws:
MediaException
- If an error occurs.
-
conversionSupported
public boolean conversionSupported(String sourceType, String destinationType) throws MediaException
Determines whether this converter supports conversion between the given types.- Specified by:
conversionSupported
in interfaceMediaConverter
- Parameters:
sourceType
- The MIME type of the source media.destinationType
- The MIME type of the destination format.- Returns:
- true if the converter can convert from the sourceType to the destinationType, false otherwise.
- Throws:
MediaException
- If an error occurs.
-
start
public MediaThread start(String sourceType, File source, String destinationType, File destination) throws MediaException
Starts conversion.- Specified by:
start
in interfaceMediaConverter
- Parameters:
sourceType
- The MIME type of the source media.source
- The source file.destinationType
- The MIME type of the destination format.destination
- The destination file.- Returns:
- A thread that is processing the media.
- Throws:
MediaException
- If an error occurs.
-
-