Created
March 14, 2021 14:43
-
-
Save AyishaR/37d6cb4e89624dae282b299e9410aa65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Processing the data | |
dataset_min = 0.0 | |
dataset_max = 1.0 | |
def denormalize_dataset(input_val): | |
global dataset_min, dataset_max | |
return input_val * (dataset_max - dataset_min) | |
#Function to normalize input values | |
def normalize_dataset(input_val): | |
global dataset_min, dataset_max | |
dataset_min = np.min(input_val) | |
dataset_max = np.max(input_val) | |
diff = dataset_max - dataset_min | |
if (diff != 0): | |
input_val /= diff | |
return input_val | |
def interpolateAudio(audio): | |
factor = float(mic_sr)/desired_sr | |
x_interp_values = [] | |
for i in range(len(audio)): | |
x_interp_values.append(int(factor*i)) | |
audio_interpolated = np.interp(range(int(len(audio)*factor)), x_interp_values, audio) | |
return mic_sr, audio_interpolated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment