Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Vibrato in PCM audio (fixed!)
#-*- coding: utf8 -*-
import numpy as n, pylab as p, scikits.audiolab as a
fa=44100 # sample rate
Dv=2048 # length of the table
fv=6. # vibrato frequency
nu=.2 # depth in semitones
f=440. # freq of the sound itself
tabv=n.sin(x) # sin table
ii=n.arange(fa * 2) # 2 seconds
gv=n.array(ii*fv*float(Dv)/fa, # indexes of the vibrato pattern
tv=tabv[gv%Dv]*nu # instant semitones deviation for each PCM sample
fi=f*( 2.**( tv/12. ) ) # instant freq in Hz of the sound
gi=n.array( ii * fi * (Dv/float(fa) ) , ) % Dv # indexes of the sound itself in the LUT
gi=n.array( ii * (Dv/float(fa)) * ff , ) % Dv
t=tabv[ gi ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment