ImageVerifierCode 换一换
格式:DOCX , 页数:19 ,大小:46.98KB ,
资源ID:4144939      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/4144939.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(流行音乐乐曲演奏程序.docx)为本站会员(b****3)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

流行音乐乐曲演奏程序.docx

1、流行音乐乐曲演奏程序流行音乐乐曲演奏程序一、需求说明1、通过一个较大型实用程序的设计与实现,综合运用所学知识,加深理解和掌握。同时培养学生分析问题和解决问题的能力,以及自学能力。2、编写用键盘选择计算机演奏歌曲的程序,歌曲清单至少包括3首;3、程序应该有操作提示、输入和输出,界面追求友好,最好是菜单式的界面;4、设计若干用例(测试数据),上机测试程序并分析所设计的程序;二、设计说明1、简要分析为了编写一个流行音乐乐曲演奏程序,分析时按照课程设计的要求必须要有操作提示、输入和输出。在界面设计时应该追求友好,能够使用户便于使用该程序。而且按照课题要求最好能够实现菜单式的界面,进一步提高该程序界面的

2、友好性。同时,在设计分析时也必须解决发声问题。分析设计时按照课本P383(10.4 通用发声程序)所示的设计方法解决发声问题。2、概要分析2.1 用户界面 以下是显示音乐菜单的字符串msgmenu db* ,0dh,0ah db* The pop music menu is that: * ,0dh,0ah db* * ,0dh,0ah db* 1:dahai * ,0dh,0ah ;张宇生大海 db* 2:dongfengpo * ,0dh,0ah ;周杰伦东风破 db* 3:dashetou * ,0dh,0ah ;吴克群大舌头 db* ,0dh,0ah,$ 2.2 模块定义、原理 2.2

3、.2 提示选择乐曲msgchoose db 0dh,0ah,Input the number(13) to choose the music you want,input:,$ 在出现菜单时,同时出现选择乐曲模块,帮助用户认识菜单和操作菜单的方法。 2.2.2提示音乐播放msgdoing db 0dh,0ah,0dh,0ah db 0dh,0ah, Now,playing the pop music which you chose!Please enjoying. db 0dh,0ah,0dh,0ah,$ 在用户选择所选音乐,程序演奏音乐时,同时显示以上程序段,提示用户系统已经在演奏所选流行歌

4、曲。 2.2.3 提示输入字符错误msgerror db 0dh,0ah,0dh,0ah,0dh,0ah,! sorry, you input a wrong number!,0dh,0ah db please try to choose from 1 to 3 again!,input:,$ 如果出现用户输入字符不符合程序定义的字符串时,程序显示以上模块段,提示用户操作错误,同时程序转回菜单,提示用户重新操作。 2.2.4 乐曲频率表和节拍表 以下节选大舌头流行乐曲的频率表和节拍表,其余乐曲见源程序段。 freq_dashetou dw 524,524,524,524,494,524,588

5、,524 ;频率表 dw 524,524,524,524,494,524,494,392 dw 524,524,524,524,494,524,588,524 dw 330,330,294,294,262,330,300,262 dw 524,524,524,524,494,524,588,524 dw 524,524,524,524,494,524,494,392 dw 524,524,524,524,494,524,588,524 dw 330,330,294,294,262,330,300,262 dw -1 time_dashetou dw 500,500,500,500,1000,5

6、00,500,500 ;节拍表 dw 500,500,500,500,1000,500,500,500 dw 500,500,500,500,1000,500,500,500 dw 500,500,500,250,250,500,500,1000 dw 500,500,500,500,1000,500,500,500 dw 500,500,500,500,1000,500,500,500 dw 500,500,500,500,1000,500,500,500 dw 500,500,500,250,250,500,500,1000 2.2.5 乐曲处理模块 以下节选第一乐曲的处理模块,其余乐曲可

7、见源程序。music1:dispmsg msgdoing ;music1处理程序段 mov si,offset freq_dahai mov di,offset time_dahaim1: mov cx,si cmp cx,-1 ;-1用于判断是否结束歌曲 je next mov bx,di call gensound add si,2 ;取下一频率值 add di,2 ;取下一节拍值 jmp m1 2.2.6音乐处理模块 gensound proc near push dx mov al,0b6h ; 向计数器写控制数 out 43h,al ; 方式3、双字节写和二进制计数方式写到控制口 m

8、ov dx,08h ; 设置被除数 mov ax,3208h div cx ; 其商为预置值 out 42h,al ; 先送LSB mov al,ah out 42h,al ; 后送MSB in al,61h ; 读端口原值 mov ah,al or al,3 out 61h,al ; 接通扬声器l2: push dx push ax mov dx,8h mov ax,0f05hs1: sub ax,1 sbb dx,0 jnz s1 pop ax pop dx dec bx jnz l2 mov al,ah ; 写回61h端口值,关闭扬声器 out 61h,al pop dx retgens

9、ound endp gensound 程序能产生1965535Hz的声音,这个频率的下限19Hz是使除法不产生溢出的最小的DI值。其上限实际上是多余的,因为人们最高能够听到的音频约为20000Hz。2.2.7 音符的频率表1234567低音131147165175196220247中音262294330349392220494高音5245886606987848809842.3 数据流图 流行乐曲程序演示流程图 Y N N Y三、详细的算法描述3.1 主程序表述code segmentassume cs:code,ds:databegin:mov ax,data mov ds,axnext:

10、dispmsg msgmenu dispmsg msgchoose ;提示菜单及输入数字inputbegin:mov ah,01h int 21h cmp al,q ;输入q则退出 je exit cmp al,1 ;比较数字4? ja doagain and ax,000fh ;将ASCII码转换成数字,以便后面指向table表里对应的地址 dec ax ;减1,对应地址 shl ax,1 ;相当于ax*2,因为table里的相邻偏移地址是2 mov bx,ax jmp tablebx ;间接转移:IP-table+bx跳到table里面对应的程序段exit: mov ah,4ch int

11、21h 3.2 音乐处理程序详细描述music1: dispmsg msgdoing mov si,offset freq_dahai mov di,offset time_dahaim1: mov cx,si cmp cx,-1 je next mov bx,di call gensound add si,2 add di,2 jmp m1music2:dispmsg msgdoing mov si,offset freq_dongfengpo mov di,offset time_dongfengpom2: mov cx,si cmp cx,-1 je next mov bx,di cal

12、l gensound add si,2 add di,2 jmp m2music3:dispmsg msgdoing mov si,offset freq_dashetou mov di,offset time_dashetoum3: mov cx,si cmp cx,-1 je xx jmp xx1xx: jmp nextxx1: mov bx,di call gensound add si,2 add di,2 jmp m3 3.3 音乐处理程序详细描述 gensound proc near push dx mov al,0b6h ; 向计数器写控制数 out 43h,al ; 方式3、双

13、字节写和二进制计数方式写到控制口 mov dx,08h ; 设置被除数 mov ax,3208h div cx ; 其商为预置值 out 42h,al ; 先送LSB mov al,ah out 42h,al ; 后送MSB in al,61h ; 读端口原值 mov ah,al or al,3 out 61h,al ; 接通扬声器l2: push dx push ax mov dx,8h mov ax,0f05hs1: sub ax,1 sbb dx,0 jnz s1 pop ax pop dx dec bx jnz l2 mov al,ah ; 写回61h端口值,关闭扬声器 out 61h

14、,al pop dx retgensound endp四、源程序与执行结果4.1 源程序dispmsg macro message ;用来调用显示字符串的宏 mov dx,offset message mov ah,9 int 21h endmdata segment;音乐播放时,提示的字符msgdoing db 0dh,0ah,0dh,0ah db 0dh,0ah, Now,playing the pop music which you chose!Please enjoying. db 0dh,0ah,0dh,0ah,$;提示选择乐曲msgchoose db 0dh,0ah,Input t

15、he number(13) to choose the music you want,input:,$;提示输入字符错误msgerror db 0dh,0ah,0dh,0ah,0dh,0ah,! sorry, you input a wrong number!,0dh,0ah db please try to choose from 1 to 3 again!,input:,$;以下是显示音乐菜单的字符串msgmenu db* ,0dh,0ah db* The pop music menu is that: * ,0dh,0ah db* * ,0dh,0ah db* 1:dahai * ,0d

16、h,0ah ;张宇生大海 db* 2:dongfengpo * ,0dh,0ah ;周杰伦东风破 db* 3:dashetou * ,0dh,0ah ;吴克群大舌头 db* ,0dh,0ah,$ ;以下对应为各乐曲的频率表和节拍时间表freq_dahai dw 196,220 dw 262,262,262,262,262,220,196 dw 262,262,262,262,294,262,220,262 dw 294,294,294,294,294,262,220 dw 294,294,294,294,330,294,330,392 dw 440,440,392,440,392,330 dw

17、 294,294,330,294,262,220,196,220 dw 262,262,262,262,262,220 dw 262,196,220 dw 440,440,392,440,524,440 dw 392,330,294,262,220,196,220 dw 262,262,262,262,294,262 dw 262,330,392 dw 440,440,440,440,524,440 dw 392,392,392,440,392,330,294 dw 262,262,262,262,294 dw 330,330,294 dw 262,262,262,262,524,440 dw

18、 392,392,392,440,392,330,392 dw 440,524,524,440,392 dw 392,330,392 dw 440,440,440,440,524,440 dw 392,392,392,440,392,330,294 dw 262,262,262,262,392 dw 330,330,294 dw 262,262,262,262,294,330 dw 392,392,330,392,330,392 dw 440 dw 9,9,196,660,294,294,262 dw 262,-1 ;最后一个以“1”控制结束time_dahai dw 400,400 dw 4

19、00,200,400,400,800,400,400 dw 400,200,400,200,200,800,400,400 dw 400,200,400,400,800,400,400 dw 400,200,400,200,200,800,400,400 dw 400,800,400,800,400,400 dw 400,200,200,400,400,800,400,400 dw 400,200,400,400,800,800 dw 1600,800,800 dw 400,800,400,800,400,400 dw 400,400,400,400,800,400,400 dw 400,80

20、0,400,800,400,200 dw 2400,400,400 dw 400,800,400,800,400,400 dw 400,800,200,200,800,400,400 dw 400,800,400,800,800 dw 2400,400,400 dw 400,800,400,800,400,400 dw 400,800,200,200,800,400,400 dw 800,400,800,400,200 dw 2400,400,400 dw 400,800,400,800,400,400 dw 400,800,200,200,800,400,400 dw 400,800,400

21、,800,800 dw 2400,400,400 dw 400,800,400,800,400,400 dw 400,800,400,800,400,400 dw 3200 dw 800,400,400,400,400,400,400 dw 4000freq_dongfengpo dw 294,262,294,330,294,262,294,262,262,220,294 dw 294,262,294,330,294,262,294,262,262,220,196 dw 392,392,330,330,330,330,349,392,349,349 dw 294,294,330,294,262

22、,220,262,440,440,440,392,392 dw 294,262,294,330,294,262,294,262,262,220,294 dw 294,220,262,294,262,294,330,392,392,330,392 dw 392,392,392,440,330,349,392,440,349 dw 294,294,262,330,294,262,220,294,262,294,262 dw 392,392,392,440,494,440,392,330,330,330,294,294 dw 392,392,392,330,294,294,262,294,262,2

23、94,330,330 dw 247,247,294,330,294,330,392,330,294,262,294,220 dw 262,262,294,330,294,330,392,440,392,392,330,330,330,330,294 dw 392,392,392,440,494,440,392,330,330,330,294,294 dw 392,392,392,330,294,294,262,294,262,294,330,330 dw 247,247,294,330,294,330,392,440,392,392,330,392,440,440,392,330,392,33

24、0,292 dw 294,294,262,330,294,262,220,294,262 dw -1time_dongfengpo dw 800,800,800,1600,800,800,800,800,800,800,1600 dw 800,800,800,1600,800,800,800,800,800,800,1600 dw 800,800,800,800,800,800,800,1600,800,1600 dw 800,800,800,800,1000,800,800,800,800,800,800,800 dw 800,800,880,1600,800,800,800,800,800

25、,800,1000 dw 800,800,800,1600,800,400,800,800,800,800,1600 dw 800,800,800,1600,800,800,1600,800,800,1000 dw 800,800,800,800,800,800,800,800,800,800,2400 dw 800,800,800,1600,200,800,600,800,800,800,800,1600 dw 800,800,800,800,800,800,600,800,800,800,800,1600 dw 800,800,800,800,800,800,600,800,800,800

26、,800,1600 dw 800,800,800,800,800,800,600,800,800,800,800,800,800,800,800XX文库 - 让每个人平等地提升自我 dw 800,800,800,1600,200,800,600,800,800,800,800,1600 dw 800,800,800,800,800,800,600,800,800,800,800,1600 dw 800,800,800,800,800,800,600,800,800,800,800,1600,800,800,800,1600,400,800,600 dw 800,800,800,800,800,

27、800,600,800,4000freq_dashetou dw 524,524,524,524,494,524,588,524 dw 524,524,524,524,494,524,494,392 dw 524,524,524,524,494,524,588,524 dw 330,330,294,294,262,330,300,262 dw 524,524,524,524,494,524,588,524 dw 524,524,524,524,494,524,494,392 dw 524,524,524,524,494,524,588,524 dw 330,330,294,294,262,33

28、0,300,262 dw -1 time_dashetou dw 500,500,500,500,1000,500,500,500 dw 500,500,500,500,1000,500,500,500 dw 500,500,500,500,1000,500,500,500 dw 500,500,500,250,250,500,500,1000 dw 500,500,500,500,1000,500,500,500 dw 500,500,500,500,1000,500,500,500 dw 500,500,500,500,1000,500,500,500 dw 500,500,500,250

29、,250,500,500,1000 table dw music1,music2,music3 ;取得各个标号的偏移地址data ends;主程序code segmentassume cs:code,ds:databegin:mov ax,data mov ds,axnext: dispmsg msgmenu dispmsg msgchoose ;提示菜单及输入数字inputbegin:mov ah,01h int 21h cmp al,q ;输入q则退出 je exit cmp al,1 ;比较数字4? ja doagain and ax,000fh ;将ASCII码转换成数字,以便后面指向table

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1