0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-09 07:45:05 +00:00
uxn/projects/examples/devices/audio.tal

88 lines
1.9 KiB
Tal
Raw Normal View History

2021-04-21 19:44:57 +00:00
( dev/audio )
2021-05-24 21:52:11 +00:00
%4** { #20 SFT2 }
%8** { #30 SFT2 }
2021-04-21 19:44:57 +00:00
( devices )
2021-04-29 04:00:39 +00:00
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
2021-04-21 19:44:57 +00:00
2021-05-24 21:52:11 +00:00
( variables )
|0000
@timer $1
@progress $1
2021-04-21 19:44:57 +00:00
|0100 ( -> )
2021-04-29 04:00:39 +00:00
( theme )
#00ff .System/r DEO2
#0f0f .System/g DEO2
#0ff0 .System/b DEO2
2021-04-21 19:44:57 +00:00
2021-04-29 04:00:39 +00:00
( vectors )
;on-frame .Screen/vector DEO2
( setup synth )
#1202 .Audio0/adsr DEO2
;saw .Audio0/addr DEO2
#0100 .Audio0/length DEO2
#ff .Audio0/volume DEO
2021-04-21 19:44:57 +00:00
BRK
@on-frame ( -> )
2021-05-11 18:14:52 +00:00
( incr ) .timer LDZ #01 ADD .timer STZ
( skip ) .timer LDZ #10 EQU #01 JCN [ BRK ]
2021-04-21 19:44:57 +00:00
( get note )
2021-05-11 18:14:52 +00:00
;melody #00 .progress LDZ ADD2 LDA
2021-04-21 19:44:57 +00:00
( play note )
2021-04-29 04:00:39 +00:00
DUP .Audio0/pitch DEO
2021-04-21 19:44:57 +00:00
( erase last note )
#20 .Screen/color DEO
2021-04-21 19:44:57 +00:00
( draw note )
2021-05-24 21:52:11 +00:00
#00 SWP 4** #0100 SUB2 .Screen/y DEO2
#00 .progress LDZ 8** .Screen/x DEO2
;dot .Screen/addr DEO2
#21 .Screen/color DEO
2021-04-21 19:44:57 +00:00
2021-05-15 08:44:20 +00:00
( incr ) .progress LDZ #01 ADD #1f AND .progress STZ
2021-04-21 19:44:57 +00:00
2021-05-11 18:14:52 +00:00
#00 .timer STZ
2021-04-21 19:44:57 +00:00
BRK
2021-04-29 04:00:39 +00:00
@dot [ 003c 7eff 7e3c 0000 ]
2021-04-21 19:44:57 +00:00
2021-04-29 04:00:39 +00:00
@saw [
0003 0609 0c0f 1215 181b 1e21 2427 2a2d
3033 3639 3b3e 4143 4649 4b4e 5052 5557
595b 5e60 6264 6667 696b 6c6e 7071 7274
7576 7778 797a 7b7b 7c7d 7d7e 7e7e 7e7e
7f7e 7e7e 7e7e 7d7d 7c7b 7b7a 7978 7776
7574 7271 706e 6c6b 6967 6664 6260 5e5b
5957 5552 504e 4b49 4643 413e 3b39 3633
302d 2a27 2421 1e1b 1815 120f 0c09 0603
00fd faf7 f4f1 eeeb e8e5 e2df dcd9 d6d3
d0cd cac7 c5c2 bfbd bab7 b5b2 b0ae aba9
a7a5 a2a0 9e9c 9a99 9795 9492 908f 8e8c
8b8a 8988 8786 8585 8483 8382 8282 8282
8182 8282 8282 8383 8485 8586 8788 898a
8b8c 8e8f 9092 9495 9799 9a9c 9ea0 a2a5
a7a9 abae b0b2 b5b7 babd bfc2 c5c7 cacd
d0d3 d6d9 dcdf e2e5 e8eb eef1 f4f7 fafd ]
2021-04-21 19:44:57 +00:00
@melody [
54 52 54 4f 4b 4f 48 ff
54 52 54 4f 4b 4f 48 ff
54 56 57 56 57 54 56 54
2021-04-29 04:00:39 +00:00
56 52 54 52 54 50 54 ff ]