BookmarkSubscribeRSS Feed

[SAS 프로그래밍 고수 백승민] SAS로 작곡을 해보아요

Started ‎06-11-2020 by
Modified ‎06-12-2020 by
Views 81

CALL SOUND 모율을 사용하여서 SAS로 음악을 들을수가 있답니다. 프로그램 짜다가 심심하실때 돌려보세요.

PC내부 사운드라서 작게 들릴수도 있습니다.

call sound(주파수, 길이);

: http://support.sas.com/documentation/cdl/en/hostwin/61924/HTML/default/win-callrout-sound.htm

* Old MacDonald had a farm. (맥도널드 아저씨는 농장을 가지고 있어요.): http://cafe.daum.net/statsas/B3m/7305

* 떳다 떳다 비행기 : http://cafe.daum.net/statsas/B3m/11418

* http://www.sas.com/offices/europe/uk/newsletter/feature/25feb_mar07/sound.html

 

%let pc=1.25;

%macro df3(note,octave,length);
       select(&note.);
             when('A')  call sound(55*(2**&octave.),&length.*160*&pc.);
             when('A#') call sound(58*(2**&octave.),&length.*160*&pc.);
             when('Bb') call sound(58*(2**&octave.),&length.*160*&pc.);
             when('B')  call sound(62*(2**&octave.),&length.*160*&pc.);
             when('C')  call sound(65*(2**&octave.),&length.*160*&pc.);
             when('C#') call sound(69*(2**&octave.),&length.*160*&pc.);
             when('Db') call sound(69*(2**&octave.),&length.*160*&pc.);
             when('D')  call sound(73.5*(2**&octave.),&length.*160*&pc.);
             when('D#') call sound(73.5*(2**&octave.),&length.*160*&pc.);
             when('Eb') call sound(78*(2**&octave.),&length.*160*&pc.);
             when('E')  call sound(82*(2**&octave.),&length.*160*&pc.);
             when('F')  call sound(87*(2**&octave.),&length.*160*&pc.);
             when('F#') call sound(92.5*(2**&octave.),&length.*160*&pc.);
             when('Gb') call sound(92.5*(2**&octave.),&length.*160*&pc.);
             when('G')  call sound(98*(2**&octave.),&length.*160*&pc.);
             when('G#') call sound(104*(2**&octave.),&length.*160*&pc.);
             when('Ab') call sound(104*(2**&octave.),&length.*160*&pc.);
             when('R')  call sleep((&length./3)*&pc.,1);
       otherwise;
end;

 

%mend;

data _null_;
     do i=1 to 2;
        %df3('C',3,1);
        %df3('C',3,1);
        %df3('C',3,1);
        %df3('G',2,1);
        %df3('A',3,1);
        %df3('A',3,1);
        %df3('G',2,2);
        %df3('E',3,1);
        %df3('E',3,1);
        %df3('D',3,1);
        %df3('D',3,1);
        %df3('C',3,2);
        if i=1 then do;
           %df3('R',1,2);
           %df3('G',2,2);
        end;
     end;

     %df3('G',2,.5);
     %df3('G',2,.5);
     %df3('C',3,1);
     %df3('C',3,1);
     %df3('C',3,1);
     %df3('G',2,.5);
     %df3('G',2,.5);
     %df3('C',3,1);
     %df3('C',3,1);
     %df3('C',3,2);
     %df3('C',3,.5);
     %df3('C',3,.5);
     %df3('C',3,1);
     %df3('C',3,.5);
     %df3('C',3,.5);
     %df3('C',3,1);
     %df3('C',3,.5);
     %df3('C',3,.5);
     %df3('C',3,.5);
     %df3('C',3,.5);
     %df3('C',3,1);
     %df3('C',3,1);
     %df3('C',3,1);
     %df3('C',3,1);
     %df3('C',3,1);
     %df3('G',2,1);
     %df3('A',3,1);
     %df3('A',3,1);
     %df3('G',2,2);
     %df3('E',3,1);
     %df3('E',3,1);
     %df3('D',3,1);
     %df3('D',3,1);
     %df3('C',3,3);

run;

Version history
Last update:
‎06-12-2020 01:11 AM
Updated by:
Contributors

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Article Labels
Article Tags