vad_info.go 548 B

12345678910111213141516171819202122232425262728
  1. package vad
  2. import (
  3. "time"
  4. )
  5. type VADInfo struct {
  6. Frame int // 第几帧
  7. Offset int // 音频的偏移
  8. Active bool // 当前帧(时间窗口)是否检测到语音
  9. Time time.Duration // 时间点
  10. }
  11. func NewVADInfo(frame, offset int, active bool, nowTime time.Duration) *VADInfo {
  12. return &VADInfo{
  13. Frame: frame,
  14. Offset: offset,
  15. Active: active,
  16. Time: nowTime,
  17. }
  18. }
  19. func NewVADInfoBase(active bool, nowTime time.Duration) *VADInfo {
  20. return &VADInfo{
  21. Active: active,
  22. Time: nowTime,
  23. }
  24. }