Colored
Auto-generated documentation for musicalgestures._colored module.
- Mgt-python / Modules / Musicalgestures / Colored
MgAudioProcessor
class MgAudioProcessor(object):
def __init__(
filename,
n_fft,
fmin,
fmax=None,
window_function=np.hanning,
):
MgAudioProcessor().peaks
def peaks(start_seek, end_seek, block_size=1024):
Read all samples between start_seek and end_seek, then find the minimum and maximum peak in that range. Returns that pair in the order they were found. So if min was found first, it returns (min, max) else the other way around.
MgAudioProcessor().read_samples
def read_samples(start, size, resize_if_less=False):
Read size samples starting at start, if resize_if_less is True and less than size samples are read, resize the array to size and fill with zeros
MgAudioProcessor().spectral_centroid
def spectral_centroid(seek_point):
Starting at seek_point to read n_fft samples and calculate the spectral centroid
MgWaveformImage
class MgWaveformImage(object):
def __init__(image_width=2500, image_height=500, cmap='freesound'):
MgWaveformImage().draw_peaks
def draw_peaks(x, peaks, spectral_centroid):
Draw 2 peaks at x using the spectral_centroid for color
MgWaveformImage().interpolate_colors
def interpolate_colors(colors, flat=False, num_colors=256):
Given a list of colors, create a larger list of colors linearly interpolating the first one. If flatten is True a list of numbers will be returned. If False, a list of (r,g,b) tuples. num_colors is the number of colors wanted in the final list
min_max_level
def min_max_level(filename):