daytripper.m.zip

  • PUDN用户
    了解作者
  • matlab
    开发工具
  • 1KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 3
    下载次数
  • 2009-11-27 14:02
    上传日期
Writes frequencies for different notes in matlab, and plays the first two lines of the Beatles Daytripper.
daytripper.m.zip
  • daytripper.m
    2.9KB
内容介绍
% note durations x1 = 0:0.0001:0.25; x2 = 0:0.0001:.5; x3 = 0:0.0001:0.75; % constructing notes [letter][ocatave][duration] ex: C31 P = sawtooth(pi*16.35*(0:0.0001:0.08)); P0 = sawtooth(pi*16.35*(0:0.0001:0.125)); P1 = sawtooth(pi*16.35*x1); P2 = sawtooth(pi*16.35*x2); A31 = sawtooth(pi*440*x1); A32 = sawtooth(pi*440*x2); A33 = sawtooth(pi*440*x3); A41 = sawtooth(2*pi*440*x1); A42 = sawtooth(2*pi*440*x2); A43 = sawtooth(2*pi*440*x3); A51 = sawtooth(4*pi*440*x1); A52 = sawtooth(4*pi*440*x2); A53 = sawtooth(4*pi*440*x3); B31 = sawtooth(pi*493.88*x1); B32 = sawtooth(pi*493.88*x2); B33 = sawtooth(pi*493.88*x3); B41 = sawtooth(2*pi*493.88*x1); B42 = sawtooth(2*pi*493.88*x2); B43 = sawtooth(2*pi*493.88*x3); B51 = sawtooth(4*pi*493.88*x1); B52 = sawtooth(4*pi*493.88*x2); B53 = sawtooth(4*pi*493.88*x3); C41 = sawtooth(2*pi*261.63*x1); C42 = sawtooth(2*pi*261.63*x2); C43 = sawtooth(2*pi*261.63*x3); C51 = sawtooth(2*pi*523.25*x1); C52 = sawtooth(2*pi*523.25*x2); C53 = sawtooth(2*pi*523.25*x3); C61 = sawtooth(4*pi*523.25*x1); C62 = sawtooth(4*pi*523.25*x2); C63 = sawtooth(4*pi*523.25*x3); Cs41 = sawtooth(2*pi*277.18*x1); Cs42 = sawtooth(2*pi*277.18*x2); Cs43 = sawtooth(2*pi*277.18*x3); D41 = sawtooth(2*pi*293.66*x1); D42 = sawtooth(2*pi*293.66*x2); D43 = sawtooth(2*pi*293.66*x3); D51 = sawtooth(2*pi*587.33*x1); D52 = sawtooth(2*pi*587.33*x2); D53 = sawtooth(2*pi*587.33*x3); E31 = sawtooth(pi*329.63*x1); E32 = sawtooth(pi*329.63*x2); E33 = sawtooth(pi*329.63*x3); E41 = sawtooth(2*pi*329.63*x1); E42 = sawtooth(2*pi*329.63*x2); E43 = sawtooth(2*pi*329.63*x3); E51 = sawtooth(2*pi*659.26*x1); E52 = sawtooth(2*pi*659.26*x2); E53 = sawtooth(2*pi*659.26*x3); F31 = sawtooth(pi*349.23*x1); F32 = sawtooth(pi*349.23*x2); F33 = sawtooth(pi*349.23*x3); F41 = sawtooth(2*pi*349.23*x1); F42 = sawtooth(2*pi*349.23*x2); F43 = sawtooth(2*pi*349.23*x3); F51 = sawtooth(2*pi*698.46*x1); F52 = sawtooth(2*pi*698.46*x2); F53 = sawtooth(2*pi*698.46*x3); Fs31 = sawtooth(pi*369.99*x1); Fs32 = sawtooth(pi*369.99*x2); Fs33 = sawtooth(pi*369.99*x3); Fs41 = sawtooth(2*pi*369.99*x1); Fs42 = sawtooth(2*pi*369.99*x2); Fs43 = sawtooth(2*pi*369.99*x3); G31 = sawtooth(pi*392*x1); G32 = sawtooth(pi*392*x2); G33 = sawtooth(pi*392*x3); G41 = sawtooth(2*pi*392*x1); G42 = sawtooth(2*pi*392*x2); G43 = sawtooth(2*pi*392*x3); G51 = sawtooth(2*pi*783.99*x1); G52 = sawtooth(2*pi*783.99*x2); G53 = sawtooth(2*pi*783.99*x3); Gs31 = sawtooth(pi*415.3*x1); Gs32 = sawtooth(pi*415.3*x2); Gs33 = sawtooth(pi*415.3*x3); Gs41 = sawtooth(2*pi*415.3*x1); Gs42 = sawtooth(2*pi*415.3*x1); Gs43 = sawtooth(2*pi*415.3*x1); % Making the song l1 = [E33,G31,Gs31,B31,E41,D43,P0,B31,Fs41,P,B31,D41,E41,P0]; l2 = [A33,C41,Cs41,E41,A41,G43,P0,E41,B41,P,E41,G41,A41,P0]; part1 = [l1,l1,l1,l1]; part2 = [l2,l2,l1,l1]; song = [part1,part2]; % Play song sound(song,10000);
评论
    相关推荐