Created
May 15, 2016 13:49
-
-
Save yuka1984/65b8b372afde9035db5231fb575b4452 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class SpeakerTest | |
{ | |
private IVoiceCapture _capture; | |
private IVoiceSpeaker _speaker; | |
[SetUp] | |
public void Setup() | |
{ | |
_capture = new VoiceCapture(8000, 250); | |
_speaker = new VoiceSpeaker(8000); | |
} | |
[TearDown] | |
public void Tear() | |
{ | |
_capture.Dispose(); | |
} | |
[Test] | |
public void NSpeexTest() | |
{ | |
var encoder = new EncodeSubject(BandMode.Narrow); | |
var decoder = new DecodeSubject(BandMode.Narrow); | |
var _stopwatch = Stopwatch.StartNew(); | |
_capture.Subscribe(b => | |
{ | |
var time = _stopwatch.ElapsedMilliseconds; | |
Debug.WriteLine($"{time}msec PCM {b.Length}"); | |
}); | |
_capture.Subscribe(encoder); | |
encoder.Subscribe(b => | |
{ | |
var time = _stopwatch.ElapsedMilliseconds; | |
Debug.WriteLine($"{time}msec eSPX {b.Length}"); | |
}); | |
encoder.Subscribe(decoder); | |
decoder.Subscribe(b => | |
{ | |
var time = _stopwatch.ElapsedMilliseconds; | |
Debug.WriteLine($"{time}msec dSPX {b.Length}"); | |
}); | |
decoder.Delay(TimeSpan.FromMilliseconds(1000)).Subscribe(_speaker); | |
_capture.Start(); | |
Thread.Sleep(5000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment