I am trying to generate some impulse which I can use as filter where I can change amplitude and phase response of the audio the impulse is being applied to...My question is there a better way of doing this than the code I have used, and if my code is achieving its task correctly...
clear all,
close all,
amp=randi([0 144],22049,1)
phase=randi([0 360],22049,1)
a=db2mag(amp)
a2=flipud(a)
a3=[0; a; 0; a2]
N=numel(a3)
ph=wrapToPi(deg2rad(phase))
ph2=flipud(ph)
ph2=ph2.*-1
ph3=[0; ph; 0; ph2]
mk2=real(ifft(pol2cart(ph3,a3)))
fs=44100
mk2=mk2/max(max(abs(mk2)))
mk2 = mk2(1:floor(length(mk2)/2))
audiowrite('RandomFilterFromImpulse.wav',mk2,fs,'BitsPerSample',24)
Aucun commentaire:
Enregistrer un commentaire