function trial4(audio,a)
%a=arduino('COM3');
servoAttach(a,9);
servoAttach(a,8);
servoWrite(a,9,10);
servoWrite(a,8,100);
time=0;
[d,sr] = audioread(audio);
 beat = beat2(d,sr);
 beat=size(beat);
 beat=beat(2);
 f=size(d);
 timesec=round(f(1)/sr);
 beatime=round(10*(timesec/beat))/10;
 t=beatime;
 n=2;
 while t<1
 t=beatime*n;
 n=n+1;
 end
 sound(audioread(audio),sr);
while time<timesec
    for i=0.1:0.1:t
        angle=i*(pi/t);
        o = (round(300*cos(angle)))/10; 
        p = (round(300*sin(angle)))/10;
        servoWrite(a,9,10+p);
        servoWrite(a,8,100-o);
        pause(0.094);
    end
        time=time+t;
end
