def otherLagrangeInterpolation():
    sample_rate, sample = wavfile.read('songs/hakuna_matata.wav')
    x = np.array(range(0, 100))
    y = np.array(sample[5000000:5000100])

    sample_rateBAD, sampleBAD = wavfile.read(
        'songs/bad_songs/not_good_song.wav')
    sampleBAD = sampleBAD[5000000:5000100]

    BadSample = y.copy()

    dz.theEvilMethod(BadSample, 0.5, blocksize=2)
    matches = recognize.cheat(y, BadSample)
    f = lagrange(x, y)
    IwannaSee(y, BadSample, sampleBAD)
Ejemplo n.º 2
0
def akimaInterpolation():
    sample_rate, sample = wavfile.read('songs/hakuna_matata.wav')
    sample = sample[5000000:5000100]

    sample_rateBAD, sampleBAD = wavfile.read(
        'songs/bad_songs/not_good_song.wav')
    sampleBAD = sampleBAD[5000000:5000100]

    BadSample = sample.copy()

    dz.theEvilMethod(BadSample, 0.5)
    matches = recognize.cheat(sample, BadSample)
    x, y = utils.tovalidxy(BadSample, matches)
    f = Akima1DInterpolator(x, y)
    IwannaSee(sample, BadSample, sampleBAD)
def cubicSplineInterpolation():
    sample_rate, sample = wavfile.read('songs/hakuna_matata.wav')

    BadSample = sample.copy()

    dz.theEvilMethod(BadSample, 0.5)
    matches = recognize.cheat(sample, BadSample)
    x, y = utils.tovalidxy(BadSample, matches)
    f = InterpolatedUnivariateSpline(x, y)

    xNotValid = utils.invalidx(matches)
    fixedy = f(xNotValid)
    utils.replace(BadSample, xNotValid, fixedy)
    wavfile.write('songs/generator_song/regen_splineUnivariate_song.wav',
                  sample_rate, BadSample)
Ejemplo n.º 4
0
def cubitInterpolation1D():
    sample_rate, sample = wavfile.read('songs/hakuna_matata.wav')

    BadSample = sample.copy()

    dz.theEvilMethod(BadSample, 0.5)
    wavfile.write('songs/bad_songs/not_good_song.wav', sample_rate, BadSample)

    matches = recognize.cheat(sample, BadSample)
    x, y = utils.tovalidxy(BadSample, matches)
    f = interp1d(x, y, kind='cubic', fill_value='extrapolate')

    xNotValid = utils.invalidx(matches)
    fixedy = f(xNotValid)
    utils.replace(BadSample, xNotValid, fixedy)
    wavfile.write('songs/generator_song/regen_sinOriginal_song.wav',
                  sample_rate, BadSample)
Ejemplo n.º 5
0
def lagrangeInterpolation():
    sample_rate, sample = wavfile.read('songs/hakuna_matata.wav')
    sample = sample[5000000:5000100]

    sample_rateBAD, sampleBAD = wavfile.read(
        'songs/bad_songs/not_good_song.wav')
    sampleBAD = sampleBAD[5000000:5000100]

    BadSample = sample.copy()

    dz.theEvilMethod(BadSample, 0.7)
    matches = recognize.cheat(sample, BadSample)
    x, y = utils.tovalidxy(BadSample, matches)

    f = BarycentricInterpolator(x, y)
    utils.repair(BadSample, matches, f)

    IwannaSee(sample, BadSample, sampleBAD)