// Create bogus input sound
const G4 = 391.995
const SAMPLE_RATE = 48000
- const FRAME_SIZE_MS = 10
+ const FRAME_SIZE_MS = 60
const FRAME_SIZE = SAMPLE_RATE * FRAME_SIZE_MS / 1000
pcm := make([]float32, FRAME_SIZE)
enc, err := NewEncoder(SAMPLE_RATE, 1, APPLICATION_VOIP)
if err != nil {
t.Fatalf("Couldn't decode data: %v", err)
}
- // TODO: Well, since this is lossy, checking the output signal is not
- // straightforward.. I guess a FFT could work?
- _ = pcm2
+ if len(pcm) != len(pcm2) {
+ t.Fatalf("Length mismatch: %d samples in, %d out", len(pcm), len(pcm2))
+ }
+ // Checking the output programmatically is seriously not easy. I checked it
+ // by hand and by ear, it looks fine. I'll just assume the API faithfully
+ // passes error codes through, and that's that.
}