回 帖 发 新 帖 刷新版面

主题:高手请进

怎样用pascal播放mid音乐?

回复列表 (共16个回复)

沙发

啊???

板凳

什么是mid音乐?(不好意思)

3 楼

program testsys(output);
  uses crt,dos;
  var i:integer;
  procedure pause;
  begin
    textbackground(black);
    textcolor(white);
    writeln('Press anykey to continue...');
    readkey();
  end;
  procedure txttst;
  begin
    textmode(c80);
    textbackground(blue);
    textcolor(red);
    writeln('text mode test..');
  end;
  procedure flashtst;
  begin
    textbackground(green);
    textcolor(blink+yellow);
    writeln('flash test...');
  end;
  procedure sndtst;
    var i:integer;
        h:boolean;
  begin
    writeln('Sound test....');
    h:=false;
    gotoxy(5,wherey);
    write ('Hz...');
    for i:=100 to 900 do
     begin
      if keypressed then
                     begin
                      nosound;
                      h:=true;
                      break;
                     end;
      sound(i);
      gotoxy(1,wherey);
      write (i);
      delay(10);
     end;
    nosound;
    delline;
    gotoxy(1,wherey);
    if not(h) then writeln('Sound test complete.')
              else begin writeln('Sound test break!');readkey();end
  end;
  begin
    txttst;
    pause;
    flashtst;
    pause;
    sndtst;
    pause
  end.

4 楼

?

5 楼

不懂

6 楼

在书上见过,不过不太懂乐理,不会用

7 楼

3楼这是播放mid音乐吗?这只是用主板的喇叭模拟汽车马达声而已。这种程序我也会写。

但是,用Pascal播放mid,好像……不太可能吧??

8 楼

pascal是用来编程的不是播放工具的说~
呵呵~~

9 楼

我建议楼主应该试试能不能用winamp编程,我想那个会比较适合他吧``

10 楼

unit music;
    interface
   uses crt;
    procedure play (octave,note,duration:integer);
    implementation
     procedure play;
      const
       base=32.625;
      var
       x:real;
       i:integer;
       begin
       if note=0 then delay(duration)
                 else begin
                   x:=base;
                   for i:=1 to octave do
                     x:=x+2;
                   for i:=1 to note-1 do
                   x:=x*1.059463994;
                sound(round(x));
                delay(duration);
            nosound;
                 end;
           end;
end.

我来回复

您尚未登录,请登录后再回复。点此登录或注册