public class AudioFormatOutputStream extends OutputStream
OutputStream
in MaryClient.process(String, String, String, String, String, String, OutputStream)
or
MaryClient.process(String, String, String, String, String, String, OutputStream, long)
does not provide any hints on
the audio format that is being sent by mary. This poses difficulties in playing back the audio since the actual format depends
on the voice used.
This class encapsulates an OutputStream
that would be used to carry the audio data as well as the AudioFormat
of
that data.
It is also possible to extend this class and create a new internally used OutputStream
once
setFormat(AudioFormat)
has been called.
An example usage might be
MaryClient processor = MaryClient.getMaryClient(); ByteArrayOutputStream out = new ByteArrayOutputStream(); AudioFormatOutputStream afos = new AudioFormatOutputStream(out); processor.process("this is a test", "TEXT", "AUDIO", "en-US", "WAVE", "cmu-slt-hsmm", afos, 5000); AudioFormat format = afos.getFormat());
Modifier | Constructor and Description |
---|---|
protected |
AudioFormatOutputStream() |
|
AudioFormatOutputStream(OutputStream out) |
Modifier and Type | Method and Description |
---|---|
AudioFormat |
getFormat() |
OutputStream |
getOutputStream() |
void |
setFormat(AudioFormat format) |
protected void |
setOutputStream(OutputStream out) |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
close, flush
protected AudioFormatOutputStream()
public AudioFormatOutputStream(OutputStream out)
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public AudioFormat getFormat()
public void setFormat(AudioFormat format) throws IOException
IOException
protected void setOutputStream(OutputStream out)
public OutputStream getOutputStream()
Copyright © 2000–2016 DFKI GmbH. All rights reserved.