Enjoy programming more!
Kidspod is a post site which supports young programmers.
First step to join us.
Register as a member
For members

2019/05/01 20:54:44

MixJuice GET URL : kidspod.club/mj/813

PWM MUSIC 主よ人の望みよ喜びよ

OUT5 PWM5 に圧電サウンダを接続して音を鳴らします。

SOURCE CODE

10 'シュヨヒトノノゾミヨヨロコビヨ
20 CLS:?"シュヨヒトノノゾミヨヨロコビヨ"
30 LET[0],2273,2025,3822,3405,3034,2863,2551,1911
40 LET[8],2145,2145,3608,3214,3214,2703,2408
50 L=10:N=2:P=30:O=20
60 M="ECDEGFFAGGHBHGECDE":GSB@P
70 M="FGAGFEDEC<B>CD<GB>DFED":GSB@P
80 M="ECDEGFFAGGHBHGECDE":GSB@P
90 M="<A>GFEDC<G>C<B>CEGHGE<EG>C":GSB@P
100 M="E-----F--G-----G--F-----E--D":GSB@P
110 M="<GAB>DCDFEFD<BGB>DFED":GSB@P
120 M="E-----F--G-----GECDEFE--D--":GSB@P
130 M="CEDEGFFAGGHBHGECDE":GSB@P
140 M="FGAGFEDEC<B>CD<GB>DFED":GSB@P
150 M="E-----F--G-----GECDEFE--D--":GSB@P
160 M="C--E--G--H--------":GSB@P
170 END
180 @P:C=PEEK(M):M=M+1:F=0
190 IFC=34OUT5,0:RTN
200 IFC=60O=O/2:GOTO@P
210 IFC=62O=O*2:GOTO@P
220 IFC=45GOTO@L
230 IFC=95OUT5,0:GOTO@@L
240 IF(C>64)*(C<73)F=[C-65]
250 IF(C>96)*(C<104)F=[C-89]
260 IFF=0GOTO@P
270 F=F/O:PWM5,F*P/100,F
280 @L:WAITL-N
290 IFPEEK(M)<>45OUT5,0
300 WAITN:GOTO@P

COMMENT