Click or drag to resize
SpeechDecoderStreamType Property
Gets or sets or Sets the StreamType property.

Namespace: StreamCoders.Decoder
Assembly: MediaSuite (in MediaSuite.dll) Version: 2.0.5.0 (2.0.5.0)
Syntax
public SpeechStreamType StreamType { get; set; }

Property Value

Type: SpeechStreamType
Describes the way a stream is packed. This is currently used for AMRNB only.
Examples
SpeechDecoder dec = new SpeechDecoder();
dec.Bitrate = 12200;
dec.SetCodec(StreamCoders.Codec.AMRNB);
dec.StreamType = StreamCoders.SpeechStreamType.StorageFormat;  // It's using RFC 3267
bool initres = dec.Init();
if(initres == false)
    return;

WaveOutput wout = new WaveOutput();
wout.BitsPerSample = 16;
wout.Channels = 1;
wout.SampleRate = 8000;
wout.Init();
wout.OpenDevice();

FileStream ifs = new FileStream("file.amr", FileMode.Open);
BinaryReader br = new BinaryReader(ifs);
ifs.Position = 6;

int bytesread = 0;
bool eof = false;
int packetMS = 20;
int packetduration = 32;    // 20ms in octets (AMR 12.2)

byte[] buf = new byte[packetduration];

uint seq = 10;
int ts = new System.Random(Environment.TickCount).Next();
while (!eof)
{
    int startDuration = Environment.TickCount;
    bytesread = br.Read(buf, 0, packetduration);

    if (bytesread < packetduration)
        eof = true;
    byte[] samples =  dec.Decode(buf);

    if (samples != null)
    {
        wout.Enqueue(samples);
    }
}

Console.WriteLine("done");
Console.ReadLine();
See Also