Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 29th, 2012  |  syntax: None  |  size: 0.48 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. VOIP SIP - Help to encode from PCM to U-law
  2. SoundEffect soundEffect = new SoundEffect(buffer, 8000, AudioChannels.Mono);
  3. SoundEffectInstance soundInstance = soundEffect.CreateInstance();
  4. soundInstance.Play();
  5.        
  6. public Microphone microphone = Microphone.Default;    
  7. private byte[] buffer;
  8. Queue<byte[]> recordedVoice = new Queue<byte[]>();
  9.        
  10. microphone.GetData(buffer);
  11.        
  12. recordedVoice.Enqueue(buffer);
  13.        
  14. byte[] encoded = G711MuLaw.G711MuLawEncode(recordedVoice.Dequeue());