Skip to content

Instantly share code, notes, and snippets.

@dannycabrera
Created August 16, 2012 06:41
Show Gist options
  • Save dannycabrera/3367417 to your computer and use it in GitHub Desktop.
Save dannycabrera/3367417 to your computer and use it in GitHub Desktop.
Speex encode
// Here is what I am attempting, opening the file, encoding it (with your EncodeSpeech method)
// and trying to save the .spx back to a file. The encodedBytes returns with data but the newly
// create file "newFile" does not play. Am I missing something or am I just doing this the wrong
// way? Thanks for all your help.
string audioFile = @"C:\Users\DannyC\Desktop\newFileName.wav";
string newFile = @"C:\Users\DannyC\Desktop\Test.spx";
// Read file bytes
byte[] fileBytes = File.ReadAllBytes (audioFile);
// Speex encoded
byte[] encodedBytes = EncodeSpeech(fileBytes, fileBytes.Length);
// Write .spx file
File.WriteAllBytes(newFile, encodedBytes);
Here is the data on my .wav file:
General
Complete name : C:\Users\DannyC\Desktop\newFileName.wav
Format : AIFF
Format/Info : Apple/SGI
File size : 6.03 MiB
Duration : 4mn 46s
Overall bit rate : 177 Kbps
Audio
Format : PCM
Format settings, Endianness : Big
Duration : 4mn 46s
Bit rate mode : Constant
Bit rate : 176.4 Kbps
Channel(s) : 1 channel
Sampling rate : 11.025 KHz
Bit depth : 16 bits
Stream size : 6.03 MiB (100%)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment