Skip to content

Commit

Permalink
perf: new frequency process
Browse files Browse the repository at this point in the history
  • Loading branch information
wst24365888 committed Jun 7, 2022
1 parent caf2252 commit 3a57331
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions voice_presentation_control/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,22 @@ def freqs_process(self, fft_wave: np.ndarray) -> np.ndarray:

# filter
fft_filter = vib_fft.copy()
noise_indices = np.where((abs(fft_freqs) > 8000) & (abs(fft_freqs) < 10000))
fft_filter[noise_indices] = fft_filter[noise_indices] * 0.5 # .1
fft_filter = fft_filter / 10

noise_indices = np.where(abs(fft_freqs) >= 10000)
fft_filter[noise_indices] = fft_filter[noise_indices] * 0.1 # .05
noise_indices = np.where(((abs(fft_freqs) >= 100) & (abs(fft_freqs) < 200))) # n
fft_filter[noise_indices] = fft_filter[noise_indices] * 10

noise_indices = np.where(abs(fft_freqs) >= 15000)
fft_filter[noise_indices] = fft_filter[noise_indices] * 0
noise_indices = np.where(((abs(fft_freqs) >= 1500) & (abs(fft_freqs) < 2000))) # p
fft_filter[noise_indices] = fft_filter[noise_indices] * 2

noise_indices = np.where(((abs(fft_freqs) >= 3000) & (abs(fft_freqs) < 3500))) # n
fft_filter[noise_indices] = fft_filter[noise_indices] * 5

noise_indices = np.where(((abs(fft_freqs) >= 5000) & (abs(fft_freqs) < 8000))) # x
fft_filter[noise_indices] = fft_filter[noise_indices]

noise_indices = np.where((abs(fft_freqs) > 8000))
fft_filter[noise_indices] = fft_filter[noise_indices] * 0 # .1

filter_wave_ifft = np.fft.ifft(fft_filter).real

Expand Down

0 comments on commit 3a57331

Please sign in to comment.