Skip to content

Instantly share code, notes, and snippets.

@AyishaR
Created March 14, 2021 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AyishaR/37d6cb4e89624dae282b299e9410aa65 to your computer and use it in GitHub Desktop.
Save AyishaR/37d6cb4e89624dae282b299e9410aa65 to your computer and use it in GitHub Desktop.
#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