Skip to content

Instantly share code, notes, and snippets.

View AhmadMoussa's full-sized avatar
🔮
Hello, is this Turing?

Ahmad Moussa AhmadMoussa

🔮
Hello, is this Turing?
View GitHub Profile
@AhmadMoussa
AhmadMoussa / WaveformZoomer.py
Last active December 9, 2019 07:33
Interactive Matplotlib tool that allows you to plot a waveform as well as zoom in on certain spots
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
import librosa
fig, ax = plt.subplots()
plt.subplots_adjust(left=0.1, bottom=0.35)
samples = 1
audio, sr = librosa.core.load("Snare.wav") # load your audio here
@AhmadMoussa
AhmadMoussa / DataLoader.py
Last active December 8, 2019 05:35
DataLoader for data loading purposes C:
import os
import numpy as np
class DataLoader():
def __init__(self, data_path, data_shape, index_path = 0, batch_size = 1):
self.data_path = data_path
self.data_shape = data_shape
self.data_index = self._load_data_index(index_path) if index_path else self._create_data_index(data_path)
self.shuffled_index = self.data_index
self.batch_size = batch_size