def preprocess_sample(aud_sample,rate):
# Step 0: Pre-process the speech sample
# a. Down-sample to 8 MHz (should be enough for Autism detection - only human speech)
# b. Normalization [Apply gain s.t the sample data is in the range [-1.0, 1.0]
# c. Noise Cancellation
proc_sample = signal.resample(aud_sample, len(aud_sample)*SAMPLING_RATE/rate)
if np.max(proc_sample) > 1.0:
proc_sample = proc_sample*1.0/pow(2, 15)
proc_sample = noise_removal(proc_sample)
return proc_sample
评论列表
文章目录