(array, width)
| 73 | |
| 74 | # Smooth the voice detection with a moving average |
| 75 | def moving_average(array, width): |
| 76 | array_padded = np.concatenate((np.zeros((width - 1) // 2), array, np.zeros(width // 2))) |
| 77 | ret = np.cumsum(array_padded, dtype=float) |
| 78 | ret[width:] = ret[width:] - ret[:-width] |
| 79 | return ret[width - 1:] / width |
| 80 | |
| 81 | audio_mask = moving_average(voice_flags, vad_moving_average_width) |
| 82 | audio_mask = np.round(audio_mask).astype(np.bool) |
no outgoing calls
no test coverage detected