/*
         * Tests taking an utterance of "Test", outputting to a PCM raw file taken from Rust OnPlayerVoice.  Use ffmpeg to encode to a WAV file and check it sounds right.
         */
        public static void TestStaticFrameDecode()
        {
            int counterX = 0;

            // Handled OPUS packets
            byte[] buffer0 = new byte[] { 0x57, 0x5c, 0x35, 0x00, 0x01, 0x00, 0x10, 0x01, 0x0b, 0xc0, 0x5d, 0x06, 0xbf, 0x02, 0x4e, 0x00, 0x00, 0x00, 0x68, 0x02, 0xe6, 0xaf, 0x5c, 0xb7, 0xb0, 0xf5, 0x00, 0x65, 0x98, 0xec, 0x9a, 0xd5, 0x08, 0xb6, 0x21, 0x23, 0x46, 0x4b, 0x71, 0x35, 0x02, 0x03, 0x45, 0x90, 0xc2, 0xa6, 0x0a, 0x55, 0x56, 0xad, 0xa2, 0xb6, 0xfc, 0x67, 0x6b, 0x65, 0xf7, 0xf4, 0xc8, 0x55, 0x18, 0xfd, 0x1e, 0x92, 0x7c, 0x91, 0x28, 0x3f, 0x7f, 0x44, 0x7e, 0x99, 0xa0, 0xcd, 0x17, 0xd1, 0xf3, 0x58, 0x57, 0x67, 0x80, 0xca, 0x36, 0xc3, 0x07, 0xe3, 0xe2, 0x4c, 0x7d, 0x31, 0x74, 0x93, 0x53, 0xac, 0xc1, 0xbf, 0x51, 0x00, 0x01, 0x00, 0x68, 0x2f, 0x36, 0x14, 0xc3, 0x62, 0xf5, 0x1a, 0xc0, 0x69, 0xef, 0x46, 0x79, 0x7f, 0xab, 0xe7, 0x64, 0x04, 0xd2, 0xb8, 0x33, 0x3a, 0x29, 0x46, 0x28, 0xfb, 0xe3, 0xa0, 0x3b, 0xb8, 0xc4, 0xaf, 0x09, 0x3f, 0xd1, 0x47, 0xbe, 0x00, 0x2b, 0x76, 0xff, 0xff, 0x41, 0xeb, 0xd2, 0x0a, 0x6f, 0x93, 0x07, 0x44, 0x70, 0xe9, 0x14, 0x35, 0x27, 0xc7, 0x8c, 0x9c, 0x49, 0x05, 0x63, 0x4a, 0xd8,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39, 0x85 };
            byte[] buffer1 = new byte[] { 0x57, 0x5c, 0x35, 0x00, 0x01, 0x00, 0x10, 0x01, 0x0b, 0xc0, 0x5d, 0x06, 0x15, 0x01, 0x5e, 0x00, 0x08, 0x00, 0x68, 0xac, 0xac, 0xc2, 0x05, 0x2c, 0x6a, 0x52, 0xba, 0x5f, 0xf4, 0xbd, 0x56, 0xc3, 0xdf, 0x81, 0xe5, 0x20, 0x3b, 0xe5, 0x51, 0x61, 0xfc, 0x0e, 0x34, 0x5b, 0xe4, 0x8c, 0xae, 0x16, 0x70, 0x13, 0x68, 0xc5, 0xf4, 0xbe, 0xb6, 0xb0, 0x9e, 0x0d, 0xf6, 0x53, 0x51, 0x64, 0x06, 0x9e, 0x0f, 0x73, 0xff, 0x79, 0x25, 0xf0, 0xae, 0xe1, 0x79, 0x91, 0x53, 0xc5, 0xe5, 0x3d, 0xe5, 0xe9, 0x4c, 0xf2, 0x06, 0x2a, 0xd0, 0x79, 0x8e, 0x63, 0xb6, 0x3c, 0x64, 0xd8, 0x50, 0x81, 0x7a, 0xbc, 0x58, 0x82, 0x3c, 0xf1, 0x74, 0xcd, 0x72, 0x14, 0x64, 0x91, 0x7d, 0x00, 0x9e, 0xd5, 0x4b, 0x8e, 0x57, 0x00, 0x09, 0x00, 0x68, 0xaa, 0xb2, 0x06, 0x09, 0x58, 0x67, 0x15, 0xc3, 0x17, 0x6a, 0x2c, 0xd0, 0xd6, 0x50, 0x21, 0x29, 0x29, 0x1b, 0xa3, 0xa0, 0x28, 0xa9, 0xd8, 0x50, 0x83, 0xd4, 0x27, 0x16, 0xae, 0x41, 0x72, 0x53, 0x07, 0x47, 0x00, 0xae, 0x3a, 0x6a, 0x8c, 0x61, 0x15, 0x19, 0x34, 0xba, 0x3e, 0x43, 0x9c, 0x2a, 0xbf, 0xda, 0xfd, 0x0b, 0xae, 0xa4, 0x5b, 0xb5, 0xa4, 0x48, 0xca, 0xa9, 0x31, 0x0b, 0x9e, 0xf1, 0x79, 0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92, 0x60, 0x92, 0x92, 0x43, 0x8e, 0x12, 0xc3, 0x6a, 0x8e, 0xd4, 0xc1, 0xfd, 0xa6, 0x6b, 0x24, 0x76, 0x4a, 0x09, 0x48, 0x9a, 0x7b, 0x07, 0xac, 0x39, 0x4a, 0xf5, 0xa4, 0x58, 0x41, 0x7d, 0x66, 0xda, 0x8c, 0x5b, 0x76, 0x48 };
            byte[] buffer2 = new byte[] { 0x57, 0x5c, 0x35, 0x00, 0x01, 0x00, 0x10, 0x01, 0x0b, 0xc0, 0x5d, 0x06, 0x08, 0x01, 0x50, 0x00, 0x0e, 0x00, 0x68, 0x90, 0xe5, 0x82, 0x5c, 0xb4, 0xdf, 0x98, 0xe6, 0x46, 0x54, 0x83, 0xc7, 0x6c, 0x67, 0x67, 0xc5, 0x91, 0x90, 0x51, 0xf2, 0x18, 0xb6, 0x25, 0xcc, 0xb1, 0xa1, 0xb6, 0x6f, 0xaf, 0x42, 0xde, 0x1d, 0x7b, 0x4c, 0x97, 0xd0, 0x48, 0x71, 0x7e, 0xe9, 0xac, 0x38, 0x78, 0x14, 0x47, 0xae, 0x17, 0x7c, 0x9f, 0x6b, 0x05, 0x8a, 0x28, 0x2e, 0x46, 0xdc, 0x02, 0xc8, 0x5b, 0xb5, 0xe7, 0x1a, 0x87, 0x70, 0x44, 0x08, 0xd5, 0xad, 0xd1, 0xc8, 0xb1, 0xb1, 0x65, 0x24, 0xe8, 0xa4, 0x60, 0x46, 0x64, 0x54, 0x00, 0x0f, 0x00, 0x68, 0x90, 0xd7, 0x53, 0x4f, 0xf7, 0x40, 0xeb, 0xb5, 0x32, 0x91, 0xb7, 0x35, 0x0d, 0xe7, 0xac, 0xf0, 0x6d, 0x87, 0x9b, 0xf7, 0xe8, 0xb0, 0x5f, 0x04, 0xcb, 0x1a, 0x1c, 0x87, 0x9c, 0x09, 0x5b, 0xce, 0x64, 0x8a, 0xe1, 0x56, 0x89, 0xff, 0xd2, 0x25, 0xee, 0x88, 0x55, 0x7b,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 0xb9, 0x29, 0x3c, 0x0c, 0x1a, 0x72, 0x69, 0x74, 0x01, 0xbf, 0xc8, 0x10, 0x37, 0xcb, 0x62, 0x25, 0xcb, 0x9d, 0xf2, 0xe0, 0x27, 0x33, 0x24, 0xa5, 0xeb, 0x35, 0xa1, 0x7d, 0x92, 0x95, 0xbb, 0x2f, 0xd5, 0x26, 0x5d, 0x59, 0x2c, 0xb8, 0x45, 0xdc, 0xa8, 0xbf, 0xf0, 0x58, 0x00, 0x12, 0x00, 0x68, 0x90, 0x5b, 0xea, 0xd7, 0xe9, 0xa6, 0x68, 0x1e, 0xfd, 0xc0, 0x26, 0xa1, 0x22, 0x57, 0x43, 0x7a, 0x08, 0xa0, 0xf5, 0xc2, 0x36, 0x1b, 0x69, 0x29, 0xe5, 0x55, 0xe2, 0x52, 0xda, 0xc6, 0xa9, 0x0f, 0xbf, 0x20, 0xec, 0x46, 0x66, 0xbb, 0xc8, 0x70, 0x70, 0x0f, 0xce, 0xac, 0xd7, 0x94, 0x79, 0x3b, 0x6b, 0x04, 0x42, 0x29, 0xdf, 0x75, 0x9a, 0x68, 0x6c, 0x3e, 0xdb, 0x84, 0xc3, 0x3e, 0x64, 0x56, 0xc1, 0x36, 0x14, 0xda, 0x0f, 0xfa, 0x5c, 0xa7, 0xe5, 0x9d, 0xf6, 0x93, 0x3a, 0xdc, 0xa2, 0x11, 0xa7, 0xf4, 0x52, 0x0a, 0x22, 0x8f, 0x8d, 0xd8, 0x10, 0x58, 0xc7 };
            byte[] buffer3 = new byte[] { 0x57, 0x5c, 0x35, 0x00, 0x01, 0x00, 0x10, 0x01, 0x0b, 0xc0, 0x5d, 0x06, 0xfb, 0x00, 0x4c, 0x00, 0x13, 0x00, 0x68, 0x8e, 0xf6, 0x5a, 0xe3, 0xdd, 0x4a, 0x27, 0x33, 0x31, 0x54, 0xa7, 0x6f, 0xb4, 0xb6, 0x70, 0xa2, 0xba, 0x34, 0x06, 0xb1, 0xdf, 0x9b, 0x2d, 0x59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 0x71, 0x65, 0x1f, 0x0e, 0x21, 0xa9, 0x1c, 0x47, 0x22, 0xd4, 0xfc, 0x15, 0x46, 0x45, 0x1b, 0xff, 0x7e, 0xb3, 0xd5, 0x7e, 0x78, 0x4a, 0xaf, 0xb4, 0x23, 0xb1, 0x91, 0x84, 0x35, 0x16, 0x0f, 0x9b, 0xdc, 0x80, 0x00, 0x6a, 0x43, 0x54, 0x9c, 0x15, 0xab };
            byte[] buffer4 = new byte[] { 0x57, 0x5c, 0x35, 0x00, 0x01, 0x00, 0x10, 0x01, 0x0b, 0xc0, 0x5d, 0x06, 0xe2, 0x00, 0x4a, 0x00, 0x16, 0x00, 0x68, 0x37, 0xdb, 0x97, 0x26, 0x0e, 0xc5, 0xd0, 0xa9, 0xb8, 0xdf, 0x05, 0x8f, 0xf3, 0xc0, 0xba, 0x72, 0x72, 0x57, 0x17, 0x49, 0x61, 0x96, 0x06, 0xdf, 0xfb, 0x95, 0xe6, 0x1d, 0xb0, 0xd7, 0x57, 0xf8, 0x2b, 0xaa, 0x80, 0xaa, 0x81, 0xad, 0x13, 0x4a, 0x58, 0x6d, 0x00, 0x8a, 0x14, 0xe6, 0x01, 0x0f, 0x68, 0xcd, 0x0e, 0xc4, 0x50, 0x4d, 0x9a, 0xa7, 0x70, 0x6d, 0x3f, 0x18, 0xc8, 0x31, 0x44, 0xb8, 0x31, 0x17, 0xb2, 0x38, 0xe8, 0x85, 0xef, 0x4e, 0x94, 0x48, 0x00, 0x17, 0x00, 0x68, 0x37, 0x1f, 0x5e, 0xa0, 0x2c, 0x25, 0x87, 0x86, 0x0d, 0x7c, 0xba, 0x51, 0xe2, 0xa8, 0x37, 0x36, 0x05, 0x7d, 0xa3, 0xc2, 0x1e, 0xa8, 0x44, 0x1f, 0xa3, 0xcc, 0x46, 0xb7, 0x4e, 0xac, 0x87, 0x17, 0x3c, 0x0b, 0x84, 0x1d, 0x79, 0x71, 0xcd, 0x7e, 0x2b, 0xe3, 0xc6, 0x11, 0x7b,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, 0x68, 0x31, 0x1a, 0xed, 0x6b, 0x5c, 0x59, 0x5f, 0x46, 0x61, 0xaf, 0x7a, 0x7d, 0x34, 0x7a, 0x22, 0x9b, 0x3f, 0xe5, 0x46, 0xe4, 0x0f, 0xcf, 0x8c, 0x72, 0x44, 0x3c, 0x24, 0xa9, 0x47, 0x8e, 0xb2, 0xaa, 0xda, 0x6d, 0x79, 0x62, 0x5c, 0xba, 0xdb, 0xd9, 0x6b, 0xda, 0x63, 0xc4, 0xf8, 0x25, 0x60, 0xf2, 0x0d, 0x46, 0xe0, 0x57, 0x63, 0xb4, 0x77, 0x1d, 0x09, 0x8e, 0x6f, 0x01, 0x8c, 0x0a, 0xae, 0xbd, 0x34, 0x23, 0x9c, 0xd5, 0xc1, 0xfa, 0xab, 0x95, 0xd3, 0x4a, 0x00, 0x1b, 0x00, 0x68, 0x31, 0x1b, 0xef, 0x6a, 0xc0, 0xea, 0xa0, 0xde, 0x6e, 0x01, 0x67, 0xee, 0xcd, 0x6b, 0x67, 0xde, 0xcb, 0x4a, 0x35, 0x63, 0x9a, 0x09, 0xd9, 0x99, 0x65, 0xd2, 0x44, 0x4d, 0x45, 0x88, 0x66, 0x6c, 0x5a, 0x2d, 0x3f, 0x2a, 0x17, 0xb6, 0x1b, 0x18, 0xd6, 0xcc, 0x52, 0x96, 0xc7, 0x31, 0x5a, 0xec, 0x54, 0x1a, 0x28, 0x7b, 0x13, 0x55, 0xc9, 0x60, 0x65, 0x18, 0x13, 0x5c, 0x36, 0xb3, 0xd2, 0x84, 0x8c, 0x36, 0xfe, 0x0f, 0xd2, 0x04, 0x38, 0x0c, 0x5d, 0xd1, 0xf4, 0xc6, 0x42 };
            byte[] buffer5 = new byte[] { 0x57, 0x5c, 0x35, 0x00, 0x01, 0x00, 0x10, 0x01, 0x0b, 0xc0, 0x5d, 0x06, 0xee, 0x00, 0x54, 0x00, 0x1c, 0x00, 0x68, 0x81, 0x38, 0x35, 0x54, 0x57, 0x7b, 0x03, 0x77,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08, 0x99, 0x29, 0x6d, 0xdd, 0x45, 0xad, 0x76, 0xa6, 0xc7, 0x60, 0x7e, 0x26, 0x3e, 0x49, 0xdb, 0x48, 0x00, 0x21, 0x00, 0x68, 0x32, 0xce, 0x91, 0xdb, 0x79, 0xde, 0x7c, 0xb5, 0x57, 0x4e, 0xd1, 0x7f, 0x63, 0xcd, 0xa4, 0xd1, 0x31, 0x57, 0x69, 0x20, 0x23, 0x03, 0xca, 0xbb, 0x8b, 0x42, 0x50, 0x94, 0x3f, 0xc6, 0x51, 0x29, 0x2d, 0xde, 0x0f, 0x07, 0x2f, 0xff, 0xa7, 0x9e, 0x07, 0x8e, 0xd8, 0x85, 0x9e, 0xe4, 0x8f, 0x25, 0x06, 0xef, 0x08, 0x9e, 0x89, 0x6c, 0x28, 0x8b, 0xb2, 0xe3, 0xe0, 0xea, 0xa2, 0xaf, 0xbf, 0x39, 0xbe, 0xcd, 0xaa, 0xcb, 0x15, 0x1a, 0x5c, 0xa6, 0xd8, 0x95, 0xc2 };
            byte[] buffer6 = new byte[] { 0x57, 0x5c, 0x35, 0x00, 0x01, 0x00, 0x10, 0x01, 0x0b, 0xc0, 0x5d, 0x06, 0xf2, 0x00, 0x48, 0x00, 0x22, 0x00, 0x68, 0x31, 0x1e, 0xd4, 0xa8, 0x85, 0xea, 0x74, 0xd8, 0x04, 0x66, 0x47, 0x8b, 0x41, 0x41, 0xef, 0xa1, 0xaa, 0xda, 0x98, 0xa5, 0x4f, 0xe5, 0xaf, 0x1c, 0xcc, 0xb0, 0xdc, 0x9b, 0x44, 0x06, 0x69, 0xa0, 0x10, 0xd7, 0x65, 0x8b, 0xf7, 0x93, 0x3f, 0x7d, 0x60, 0x5c, 0x88, 0xde, 0x18, 0xd5, 0x24, 0x91, 0xe3, 0x8e, 0x6b, 0x13, 0xf1, 0xb8, 0xcb, 0xb3, 0x2d, 0x66, 0x89, 0x2d, 0x6b, 0x4a, 0xf5, 0x2e, 0x82, 0x9c, 0x18, 0x21, 0x3a, 0x04, 0x43, 0x4d, 0x00, 0x23, 0x00, 0x68, 0x31, 0x20, 0xa6, 0x06, 0xa1, 0xa9, 0x2d, 0x89, 0x8f, 0x64, 0x3a, 0xdb, 0xbf, 0x80, 0x37, 0xed, 0x76, 0xd5, 0x89, 0x38, 0xcb, 0x19, 0xd3, 0x22, 0x0f, 0x5e, 0x7f, 0x20, 0x95, 0x54, 0x13, 0xce, 0x4a, 0x12, 0x0e, 0xf3, 0x77, 0x2f, 0x57, 0xc2, 0x65, 0x10, 0x39, 0xaa, 0xee, 0x77, 0xca, 0x1f, 0x37, 0xf2, 0x57, 0x8b, 0xee, 0xf4, 0xb5, 0xb7, 0x86, 0x34, 0x0f, 0x44, 0xeb, 0x52, 0xbb, 0x9d, 0xd7, 0xcc, 0x53, 0x27, 0x73, 0xff, 0x22, 0xda, 0x11, 0x0e, 0x62, 0x94, 0x51, 0x00, 0x24, 0x00, 0x68, 0x31, 0x1e, 0xd4, 0x30, 0x14, 0x33, 0xa9, 0x62, 0xa3, 0x87, 0x7c, 0x58, 0xe9, 0x30, 0xf2, 0x18, 0x17, 0x37, 0xc2, 0x39, 0xf3, 0x79, 0x5e, 0x02, 0x56, 0x3c, 0xeb, 0x56, 0xbc, 0x38, 0xb7, 0xd1, 0xf7, 0x48, 0x15, 0xda, 0x5c, 0xec, 0x30, 0x58, 0xc6, 0x15, 0xb6, 0xd0, 0x75, 0x12, 0xc5, 0xde, 0x64, 0xa4, 0xc1, 0x96, 0xf9, 0x98, 0x8a, 0x74, 0xd4, 0x76, 0x4c, 0xb6, 0x8b, 0xea, 0xb1, 0xe1, 0x7a, 0x90, 0x3c, 0x76, 0xf1, 0xd5, 0xdf, 0x70, 0xa2, 0xd3, 0xfd, 0xa9, 0xe6, 0xbb, 0x03, 0x18, 0x0b, 0xc0, 0x5d, 0x06, 0x63, 0x00, 0x4e, 0x00, 0x25, 0x00, 0x68, 0x31, 0x1f, 0x81, 0x15, 0x30, 0x0b, 0x41, 0xb6, 0x73, 0x8a, 0x5b, 0x3f, 0x51, 0xfb, 0x22, 0xa2, 0xda, 0x40, 0xe9, 0x53, 0xf9, 0x41, 0x32, 0xb7, 0xf3, 0xc4, 0x5e, 0xb5, 0xce, 0x37, 0xc6, 0xe4, 0x49, 0x8b, 0xd9, 0x9e, 0x5d, 0x83, 0xbc, 0x21, 0x4e, 0x27, 0x39, 0x9f, 0xcc, 0x9c, 0x67, 0x8e, 0x7d, 0x1c, 0xff, 0xdc, 0x7a, 0xfe, 0x22, 0xa0, 0x7b, 0x65, 0x61, 0x8b, 0xbf, 0x59, 0x24, 0x19, 0xab, 0x3e, 0xf2, 0x7f, 0x8a, 0xef, 0xca, 0x4e, 0x3f, 0x20, 0x62, 0xc5, 0x8d, 0x01, 0x00, 0x26, 0x00, 0x68, 0x01, 0x00, 0x27, 0x00, 0x68, 0x01, 0x00, 0x28, 0x00, 0x68, 0xff, 0xff, 0x75, 0xd9, 0x21, 0x79 };

            // Unhandled Silence packets
            byte[] buffer7 = new byte[] { 0x57, 0x5c, 0x35, 0x00, 0x01, 0x00, 0x10, 0x01, 0x0b, 0xc0, 0x5d, 0x00, 0xee, 0x02, 0x8c, 0xf6, 0x8f, 0x2d };
            byte[] buffer8 = new byte[] { 0x57, 0x5c, 0x35, 0x00, 0x01, 0x00, 0x10, 0x01, 0x0b, 0xc0, 0x5d, 0x00, 0xee, 0x02, 0x8c, 0xf6, 0x8f, 0x2d };
            byte[] buffer9 = new byte[] { 0x57, 0x5c, 0x35, 0x00, 0x01, 0x00, 0x10, 0x01, 0x0b, 0xc0, 0x5d, 0x00, 0xee, 0x02, 0x8c, 0xf6, 0x8f, 0x2d };

            Console.WriteLine("Opening output PCM raw file...");
            BinaryWriter Writer;

            try
            {
                Writer = new BinaryWriter(File.OpenWrite(@"..\..\..\..\test.pcm"));
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR! Failed to open the output PCM file.");
                Console.WriteLine(ex.ToString());
                return;
            }

            SteamVoiceFrame nEncoder = new SteamVoiceFrame();


            byte[] data = null;
            for (counterX = 0; counterX < 7; counterX++)
            {
                if (counterX == 0)
                {
                    data = buffer0;
                }
                if (counterX == 1)
                {
                    data = buffer1;
                }
                if (counterX == 2)
                {
                    data = buffer2;
                }
                if (counterX == 3)
                {
                    data = buffer3;
                }
                if (counterX == 4)
                {
                    data = buffer4;
                }
                if (counterX == 5)
                {
                    data = buffer5;
                }
                if (counterX == 6)
                {
                    data = buffer6;
                }

                if (counterX == 7)
                {
                    data = buffer7;
                }
                if (counterX == 8)
                {
                    data = buffer8;
                }
                if (counterX == 9)
                {
                    data = buffer9;
                }


                // Skip header
                //  * nHeader  : 0x57, 0x5c, 0x35, 0x00, 0x01, 0x00, 0x10, 0x01
                byte[] payloadData   = data.Skip(8).ToArray();
                int    payloadLength = 0;

                Console.WriteLine(" ####################### Decoding Compressed Chunk #" + counterX);

                do
                {
                    // Skip header
                    //  * nPayload : 0x0b, 0xc0, 0x5d, 0x06
                    payloadData = payloadData.Skip(payloadLength + 4).ToArray();

                    payloadLength = payloadData[1];
                    payloadLength = (payloadLength << 8) + payloadData[0];

                    // Payload data length doesnt count the size field
                    payloadLength += 2;

                    byte[] bufferOutAudio;
                    int    decompAudioSize = nEncoder.DecodePayload(payloadData, payloadLength, out bufferOutAudio);

                    Console.WriteLine(" * Output from decompressor = " + decompAudioSize);

                    // 16bit PCM, so 2x sample size
                    Writer.Write(bufferOutAudio, 0, decompAudioSize * 2);
                } while ((payloadData.Length - payloadLength - 4) > 0);


                Writer.Flush();


                Console.WriteLine("");
            }

            Writer.Close();
        }
        /*
         * Tests taking PCM from a source, simple mono-8KHz PCM WAV file, and encoding and decoding and confirming output is similar to input.
         * NOTE: OPUS is a lossy encoder.
         */
        public static void TestWaveFrameEncodeDecode()
        {
            Console.WriteLine("Opening WAV file source, and initializing Steam-OPUS Encoder...");

            int i = 0;

            WavHandler   wv = new WavHandler();
            BinaryWriter Writer;

            try
            {
                wv.OpenAndRead(@"..\..\..\..\musicbox.wav");
                Writer = new BinaryWriter(File.OpenWrite(@"..\..\..\..\test.pcm"));
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR! Failed to open the sample WAV file, or output PCM file.");
                Console.WriteLine(ex.ToString());
                return;
            }

            SteamVoiceFrame nEncoder = new SteamVoiceFrame();


            // Frame size in bytes ; this is 0x500/1280 audio samples
            int MaxSize = 160 * 8;

            do
            {
                Console.WriteLine(i / MaxSize + " chunk ==================================");

                // 16bit PCM, so half the start and size
                var bufferAudioSamples = wv.GetClipBytes(0, i, MaxSize);

                // Exceeded data size, exit
                if (bufferAudioSamples == null)
                {
                    break;
                }

                byte[] nComp;
                int    size = nEncoder.EncodeSamplesToFrame(bufferAudioSamples, out nComp);

                Console.WriteLine("Compressed " + i / MaxSize + " Size=" + size + " -> " + nComp[0]);

                // Skip header
                byte[] payloadData = nComp.Skip(12).ToArray();

                byte[] bufferOutAudio;
                int    decompAudioSize = nEncoder.DecodePayload(payloadData, payloadData.Length - 4, out bufferOutAudio);

                // Write raw read samples - OK
                // Writer.Write(bufferAudioSamples, 0, MaxSize);

                // Output raw->compressed->decompressed->raw audio
                Writer.Write(bufferOutAudio, 0, decompAudioSize * 2);

                Writer.Flush();

                Console.WriteLine(" * Input to compressor = " + MaxSize);
                Console.WriteLine(" * Output from decompressor = " + decompAudioSize * 2);

                Console.WriteLine("");

                i += MaxSize;
            } while (true);

            Writer.Close();
        }