A little musical demo to show off the R42 BASIC additions

All aspects of programming on the Commander X16.
MooingLemur
Posts: 34
Joined: Sat Feb 19, 2022 4:44 pm

A little musical demo to show off the R42 BASIC additions

Post by MooingLemur »

Copy and paste into emulator version R42 should work :)

Code: Select all

100 FMINIT
110 FOR I=1 TO 7
120 FMINST I,50
130 NEXT
135 FMINST 0,24
137 DATA 0,"V0RV0RV0RV0RV0R"
140 DATA 0,"O3G>CE",4,"L16T90O3","CDEG>",4,"O7","C<GED"
150 DATA 0,"O3A>CE",4,"O2","AB>CE",4,"O6","AEC<B"
160 DATA 0,"O3G>CE",4,"O3","CDEG>",4,"O7","C<GED"
170 DATA 0,"O3A>CE",4,"O2","AB>CE",4,"O6","AEC<B"
180 DATA 0,"O3A>CF",4,"O2","FGA>C",4,"O6","FC<AG"
190 DATA 0,"O3B>DG",4,"O2","GAB>D",4,"O6","GD<BA"
200 DATA 0,"O3A-C>G",4,"O2","A->CE-G",4,"O6","A-GE-C<"
210 DATA 0,"O3B->FG",4,"O2","B->DFA",4,"O6","B-AFD<"
220 DATA 0,"V48RV48RV48RV63RV63R"
290 DATA -1
300 READ L
310 IF L<0 THEN GOTO 380
313 IF L>0 THEN GOTO 320
315 READ A$
317 FMCHORD 1,A$
319 GOTO 300
320 READ A$,B$
330 FMPLAY 0,A$
340 FOR I=1 TO L
345 FMDRUM 4,35
347 IF I=2 OR I=4 THEN FMDRUM 5,39
350 FMPLAY 0,B$
360 NEXT
370 GOTO 300
380 RESTORE 140
385 FMDRUM 5,46
390 GOTO 300
User avatar
StephenHorn
Posts: 565
Joined: Tue Apr 28, 2020 12:00 am
Contact:

Re: A little musical demo to show off the R42 BASIC additions

Post by StephenHorn »

May you always walk in the light of the Crystal.
Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
grml
Posts: 60
Joined: Sat Aug 13, 2022 8:31 pm

Re: A little musical demo to show off the R42 BASIC additions

Post by grml »

I had a bunch of fun with FMDRUM in a loop in BASIC. You can create some really cool sound effects by triggering a number of those sounds really fast. Some real nice gunshot sound effects, even with a kind of reverb effect!

How are those percussions created? They do sound like samples.
MooingLemur
Posts: 34
Joined: Sat Feb 19, 2022 4:44 pm

Re: A little musical demo to show off the R42 BASIC additions

Post by MooingLemur »

grml wrote: Wed Mar 08, 2023 12:45 am
How are those percussions created? They do sound like samples.
They are all simple YM2151 patches. One of the requirements for how the music commands worked in BASIC was that all the sounds would be triggered without requiring the CPU to control any envelopes or macros while the note is playing. The patch is loaded, and the X16 issues a key on event. No further register writes are needed.

This means making some types of instruments sound realistic is nearly impossible to pull off, but I think about 95% of them are at least passable.
User avatar
desertfish
Posts: 1123
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: A little musical demo to show off the R42 BASIC additions

Post by desertfish »

Oh , wow, this is the first time I've heard those new sound basic commands . Stellar job!!
Ed Minchau
Posts: 508
Joined: Sat Jul 11, 2020 3:30 pm

Re: A little musical demo to show off the R42 BASIC additions

Post by Ed Minchau »

That's wild. In BASIC yet. Great addition.
EbonHawk
Posts: 17
Joined: Thu Mar 16, 2023 10:37 am

Re: A little musical demo to show off the R42 BASIC additions

Post by EbonHawk »

Nice!! :o
User avatar
ahenry3068
Posts: 1195
Joined: Tue Apr 04, 2023 9:57 pm

Re: A little musical demo to show off the R42 BASIC additions

Post by ahenry3068 »

Is there anywhere I can find documentation on these
Basic keywords.... ?
User avatar
StephenHorn
Posts: 565
Joined: Tue Apr 28, 2020 12:00 am
Contact:

Re: A little musical demo to show off the R42 BASIC additions

Post by StephenHorn »

The documentation is hosted on GitHub:
https://github.com/X16Community/x16-docs
Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
User avatar
ahenry3068
Posts: 1195
Joined: Tue Apr 04, 2023 9:57 pm

Re: A little musical demo to show off the R42 BASIC additions

Post by ahenry3068 »

Thank you
Post Reply