• 大小: 3.2MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-10
  • 语言: Matlab
  • 标签: matlab  gui  

资源简介

完整的matlab gui音乐合成器,包含加包络和加谐波,和输入乐谱并播放功能

资源截图

代码片段和文件信息




% 化蝶
clear all;clc;
freq=8000;
T=1/freq;
pattime=1;
note1=0:T:2*pattime;
note2=0:T:1*pattime;
note3=0:T:1.5*pattime;
note4=0:T:0.75*pattime;
note8=0:T:0.5*pattime;
note16=0:T:0.25*pattime;
note_1=349.23;
note_2=392;
note_3=440;
note_5=523.25;
note_6=587.33;
note_7=659.25;
note_5b=261.63;
note_6b=293.66;
note_7b=329.63;
note_1p=698.46;
note_2p=783.99;

amp=[1 0.01 0.02]‘;
n=length(amp);
freq_note=[note_5note_5note_6...
    note_2...
    note_1note_1note_6b...
    note_2...
    note_5note_5...
    note_6note_1pnote_6note_5...
    note_1note_1note_6b...
    note_2...
    note_5note_2...
    note_1note_7bnote_6b...
    note_5bnote_5...
    note_2note_3note_2...
    note_1note_1note_6b...
    note_2note_3note_2note_1...
    note_2note_1note_7bnote_6b...
    note_5b...
    note_5b0...
    note_5note_2...
    note_1note_7bnote_6b...
    note_5bnote_5...
    note_2note_3note_2...
    note_1note_1note_6b...
    note_2note_3note_2note_1...
    note_2pnote_1pnote_7note_6...
    note_5...
    note_50];

length_note=[length(note2)length(note8)length(note8)... %音符节拍长度数组
length(note1)...
length(note2)length(note8)length(note8)...
length(note1)...
length(note2)length(note2)...
length(note8)length(note8)length(note8)length(note8)...
length(note2)length(note8)length(note8)...
length(note1)...
length(note2)length(note2)...
length(note2)length(note8)length(note8)...
length(note2)length(note2)...
length(note2)length(note8)length(note8)...
length(note2)length(note8)length(note8)...
length(note8)length(note8)length(note8)length(note8)...
length(note8)length(note8)length(note8)length(note8)...
length(note1)...
length(note2)length(note2)...
length(note2)length(note2)...
length(note2)length(note8)length(note8)...
length(note2)length(note2)...
length(note2)length(note8)length(note8)...
length(note2)length(note8)length(note8)...
length(note8)length(note8)length(note8)length(note8)...
length(note8)length(note8)length(note8)length(note8)...
length(note1)...
length(note2)length(note2)];

freq=[];
for i=1:length(length_note)
freq=[freq;freq_note(i)*ones(length_note(i)1)];
end
note=[];
for i=1:length(length_note) %音符节拍数组
if length_note(i)==(1*pattime/T+1)
note=[note[0:T:1*pattime]];
elseif length_note(i)==(0.5*pattime/T+1)
note=[note[0:T:0.5*pattime]];
elseif length_note(i)==(2*pattime/T+1)
note=[note[0:T:2*pattime]];
elseif length_note(i)==(1.5*pattime/T+1)
note=[note[0:T:1.5*pattime]];
elseif length_note(i)==(0.75*pattime/T+1)
note=[note[0:T:0.75*pattime]];
else
note=[note[0:T:0.25*pattime]];
end
end
shape1=[];
for i=1:length(length_note)
shape1=[shape1;shape_env1(length_note(i))‘];
end
wave=sin(2*pi*(freq.*note‘)*[1:n])*amp.*shape1;
wave=wave‘;
sound(wave8000);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-03-22 21:38  musicgui6\
     文件       25252  2017-03-19 13:46  musicgui6\bofang.jpg
     文件        2944  2017-03-07 16:09  musicgui6\dongfanghong.m
     文件      322732  2017-03-22 17:00  musicgui6\example.mat
     文件        2918  2017-03-20 17:40  musicgui6\huadie.m
     文件       62520  2017-03-13 12:04  musicgui6\musicgui.mat
     文件       15295  2017-03-22 21:38  musicgui6\musicgui6.fig
     文件       42829  2017-03-22 21:38  musicgui6\musicgui6.m
     文件         649  2017-03-13 12:33  musicgui6\Rhythm.m
     文件       12973  2017-03-18 10:14  musicgui6\shape_env3.m
     文件        2962  2017-03-09 13:46  musicgui6\shape_env_electronicorgan.m
     文件        8080  2017-03-09 13:35  musicgui6\shape_env_flute.m
     文件        3257  2017-03-09 12:39  musicgui6\shape_env_guitar.m
     文件        3299  2017-03-15 16:30  musicgui6\shape_env_guitar1.m
     文件        2391  2017-03-16 20:10  musicgui6\shape_env_guitar2.m
     文件       13658  2017-03-16 19:51  musicgui6\shape_env_kouqin1.m
     文件        3173  2017-03-09 12:10  musicgui6\shape_env_piano.m
     文件       12553  2017-03-15 16:24  musicgui6\shape_env_piano1.m
     文件       16203  2017-03-15 16:38  musicgui6\shape_env_piano2.m
     文件        3120  2017-03-09 12:46  musicgui6\shape_env_saxophone.m
     文件        4075  2017-03-16 19:56  musicgui6\shape_env_saxphone1.m
     文件        3800  2017-03-16 19:58  musicgui6\shape_env_saxphone2.m
     文件        9590  2017-03-09 13:28  musicgui6\shape_env_trumpet.m
     文件        6089  2017-03-09 13:02  musicgui6\shape_env_violin.m
     文件       25274  2017-03-19 14:05  musicgui6\shengcheng.jpg
     文件        3728  2017-03-13 08:47  musicgui6\SoundVolume.m
     文件       92697  2017-03-19 13:13  musicgui6\zhujiemian.jpg
     文件     2911676  2016-01-30 15:46  musicgui6\石进 - 夜的钢琴曲四.mp3
     文件       13214  2017-03-18 10:17  musicgui6\谐波.docx
     文件        2164  2017-03-18 14:13  musicgui6\谐波比例 (1).docx - 快捷方式.lnk

评论

共有 条评论