Jump to content
IGNORED

Merry Christmas! (a demo?) My first basic code since I was 11 years old


jorge-1987

Recommended Posts

Hi friends! I have been away for some time, and lately I started playing with my retro projects again. I want to show you my first ever TI99 BASIC production. Nothing interesting, nothing fancy, and can be improved in so many ways, but I'm happy that it works, and I have learned some of the basics of BASIC (ha!) during the process.

 

Basically 4 FOR to create a christmas tree, some at signs to use a changing color lights, and a looooooot of call sounds to make some rudimentary music. The music and the change of the colors of the at signs it's in an infinite loop with a goto.


Video of it working: 

 

 

The source code in Github: https://github.com/jorge-1987/TI99-DEMOS/blob/main/NAVIDAD.BASIC

 

The source code plain:

10 L=15
11 R=1
12 CALL CLEAR
14 PRINT("FELIZ NAVIDAD!")
15 CALL SCREEN(6)
16 CALL COLOR(1,4,6)
17 CALL COLOR(2,2,6)
20 FOR N=1 to 5
21 CALL HCHAR(N,L,35,R)
22 L=L-2
23 R=R+4
24 NEXT N
25 L=15
26 R=1
27 CALL HCHAR(2,15,64)
28 CALL HCHAR(3,17,64)
29 CALL HCHAR(4,14,64)
30 FOR N=5 to 11
31 CALL HCHAR(N,L,35,R)
32 L=L-2
33 R=R+4
34 NEXT N
35 CALL HCHAR(6,14,64)
36 CALL HCHAR(7,17,64)
37 CALL HCHAR(9,13,64)
40 L=15
41 R=1
42 FOR N=11 to 17
43 CALL HCHAR(N,L,35,R)
44 L=L-2
45 R=R+4
46 NEXT N
47 CALL HCHAR(11,10,64)
48 CALL HCHAR(13,17,64)
49 CALL HCHAR(15,20,64)
50 FOR N=17 to 22
51 CALL HCHAR(N,11,43,8)
52 NEXT N
80 BH=494
81 CS=277
82 FS=370
83 GS=415

90 A=220
91 AH=440
92 AS=233
93 ASH=466
94 C=262
95 D=294
96 E=330
97 F=349
98 G=392
100 CALL SOUND(300,C,0)
110 CALL SOUND(300,F,0)
115 CALL SOUND(50,D,30)
120 CALL SOUND(200,F,0)
130 CALL SOUND(200,G,0)
140 CALL SOUND(200,F,0)
150 CALL SOUND(200,E,0)
160 CALL SOUND(300,D,0)
165 CALL SOUND(50,D,30)
170 CALL SOUND(300,D,0)
171 CALL COLOR(5,2,6)
180 CALL SOUND(100,D,30)
190 CALL SOUND(300,D,0)
200 CALL SOUND(300,G,0)
205 CALL SOUND(50,D,30)
210 CALL SOUND(200,G,0)
220 CALL SOUND(200,AH,0)
230 CALL SOUND(200,G,0)
240 CALL SOUND(200,F,0)
250 CALL SOUND(300,E,0)
265 CALL SOUND(50,D,30)
270 CALL SOUND(300,C,0)
271 CALL COLOR(5,3,6)
280 CALL SOUND(100,D,30)
290 CALL SOUND(300,C,0)
300 CALL SOUND(300,AH,0)
305 CALL SOUND(50,D,30)
310 CALL SOUND(200,AH,0)
320 CALL SOUND(200,ASH,0)
330 CALL SOUND(200,AH,0)
340 CALL SOUND(200,G,0)
350 CALL SOUND(300,F,0)
365 CALL SOUND(50,D,30)
370 CALL SOUND(300,D,0)
371 CALL COLOR(5,4,6)
380 CALL SOUND(100,D,30)
390 CALL SOUND(150,C,0)
395 CALL SOUND(25,D,30)
400 CALL SOUND(150,C,0)
405 CALL SOUND(25,D,30)
410 CALL SOUND(200,D,0)
415 CALL SOUND(50,D,30)
420 CALL SOUND(350,G,0)
425 CALL SOUND(50,D,30)
430 CALL SOUND(350,E,0)
425 CALL SOUND(50,D,30)
440 CALL SOUND(800,F,0)
441 CALL COLOR(5,5,6)
445 CALL SOUND(800,D,30)
446 CALL COLOR(5,6,6)

500 CALL SOUND(500,E,0)
510 CALL SOUND(500,AH,0)
520 CALL SOUND(300,GS,0)
530 CALL SOUND(300,AH,0)
540 CALL SOUND(800,FS,0)
541 CALL COLOR(5,7,6)
550 CALL SOUND(800,BH,30)
560 CALL SOUND(500,AH,0)
570 CALL SOUND(500,BH,0)
580 CALL SOUND(300,AH,0)
590 CALL SOUND(300,FS,0)
600 CALL SOUND(600,E,0)
601 CALL COLOR(5,8,6)
610 CALL SOUND(800,BH,30)
620 CALL SOUND(500,E,0)
630 CALL SOUND(500,AH,0)
640 CALL SOUND(300,GS,0)
650 CALL SOUND(300,AH,0)
670 CALL SOUND(800,FS,0)
671 CALL COLOR(5,9,6)
680 CALL SOUND(1,BH,30)
690 CALL SOUND(500,D,0)
700 CALL SOUND(500,E,0)
710 CALL SOUND(300,FS,0)
720 CALL SOUND(300,E,0)
721 CALL SOUND(50,BH,30)
730 CALL SOUND(600,E,0)
731 CALL COLOR(5,10,6)
740 CALL SOUND(1,BH,30)
750 CALL SOUND(500,E,0)
760 CALL SOUND(500,D,0)
761 CALL SOUND(50,BH,30)
770 CALL SOUND(300,D,0)
780 CALL SOUND(800,CS,0)
781 CALL COLOR(5,11,6)
790 CALL SOUND(800,D,30)
791 CALL COLOR(5,12,6)

800 GOTO 100

 

Hope you like it! Thanks!

 

PS: Please don't be too harsh, I know is nothing interesting nor innovative, it was my first run playing with TI BASIC.

  • Like 13
Link to comment
Share on other sites

Welcome back.

I think it's a great return to TI99.

I also like the fact that the pieces are in tune. 

Sometimes after listening to computer music I have to visit a chiropractor. :)

 

Not sure if you studied music notation, but the timing system in music is like the old British measurement system for inches, where each smaller division is divided by two.

 

So you can make perfect musical timings by defining note times as variables and using the variable names in place of milliseconds in the sound() function.

If you base everything on a "master" value" then it is simple to change the speed as well.

The master value becomes the "metronome" to control the speed. 

 

Something like this can be added as a sub-routine. GOSUB to 2010 before using the note names. 

 

2000 REM set metronome and note values
2010 METRO=500 
2020 WHOLE=METRO
2030 HALF=WHOLE/2
2040 QUART=HALF/2
2050 N8TH=QUART/2
2060 N16TH=N8TH/2
2999 RETURN 

 

A WHOLE note fills an entire "measure" of music, typically 4 "beats".  (3 beats if it's a waltz or minuette) 

Songs can typically be notated with 1/2notes , quarter notes and 8th notes. 

 

Extras:

Some (many?) songs require "dotted" notes which add 50% more time to the time value.

Easy in BASIC.

DOTQUART=QUART*1.5 
DOT8TH=N8TH*1.5
ETC..

 

 

  • Like 8
  • Thanks 1
Link to comment
Share on other sites

3 minutes ago, TheBF said:

Welcome back.

I think it's a great return to TI99.

I also like the fact that the pieces are in tune. 

Sometimes after listening to computer music I have to visit a chiropractor. :)

 

Not sure if you studied music notation, but the timing system in music is like the old British measurement system for inches, where each smaller division is divided by two.

 

So you can make perfect musical timings by defining note times as variables and using the variable names in place of milliseconds in the sound() function.

If you base everything on a "master" value" then it is simple to change the speed as well.

The master value becomes the "metronome" to control the speed. 

 

Something like this can be added as a sub-routine. GOSUB to 2010 before using the note names. 

 

2000 REM set metronome and note values
2010 METRO=500 
2020 WHOLE=METRO
2030 HALF=WHOLE/2
2040 QUART=HALF/2
2050 N8TH=QUART/2
2060 N16TH=N8TH/2
2999 RETURN 

 

A WHOLE note fills an entire "measure" of music, typically 4 "beats".  (3 beats if it's a waltz or minuette) 

Songs can typically be notated with 1/2notes , quarter notes and 8th notes. 

 

Extras:

Some (many?) songs require "dotted" notes which add 50% more time to the time value.

Easy in BASIC.

DOTQUART=QUART*1.5 
DOT8TH=N8TH*1.5
ETC..

 

 

Thank you so much for the compliment and the tip!

 

To be fair, I discussed the tunes with two friends who are musicians. I knew that I was doing something barebones, but wanted it to sound at least acceptable since I was going to listen to it like 10000 times while trying. So I went online, found a table with the hz for each musical note, converted that to each octave into variables, and so on.

 

But you are 100% right that I did not know how to properly manage the timing, so I basically adjusted the timing by ear changing the values to what it sounded better (for me after running it again and again and again).

I did not know what you are mentioning, and it's a great tip, I'm writing a note with you suggestion, I guess that the only constrain is that I would need to get the musical sheet for the song and read it properly. 

Maybe I will do this as a yearly challenge and try to improve it each year, next time with sub-routines and better timing as you showed me, sounds fun. Thanks!!

 

  • Like 6
Link to comment
Share on other sites

Nice.  The world needs more TI BASIC music demos!  On a system where making actual games in the native BASIC was extremely difficult, graphical music demos were a natural genre for the platform, allowing for worthwhile programming experimentation by the average user with worthwhile results.   So those are always appreciated. 

  • Like 4
Link to comment
Share on other sites

47 minutes ago, pixelpedant said:

Nice.  The world needs more TI BASIC music demos!  On a system where making actual games in the native BASIC was extremely difficult, graphical music demos were a natural genre for the platform, allowing for worthwhile programming experimentation by the average user with worthwhile results.   So those are always appreciated. 

I wish someone told me that I could do this in TI BASIC when I was a kid, I would have hundreds of tapes with Black Sabbath demos at this point, lol I need to get working on using the Speech Synthetizer, something that I have seen on your videos.

 

I guess that I need to retroactively make Black Sabbath demos now.

  • Like 3
  • Haha 1
Link to comment
Share on other sites

1 hour ago, jorge-1987 said:

I wish someone told me that I could do this in TI BASIC when I was a kid, I would have hundreds of tapes with Black Sabbath demos at this point, lol I need to get working on using the Speech Synthetizer, something that I have seen on your videos.

 

I guess that I need to retroactively make Black Sabbath demos now.

 

If you have some Black Sabbath MIDI's I know a way to catch up a little on the lost time...

 

 

I haven't tested it yet with the latest major release of MuseScore that came out in December.

 

Steve

 

  • Like 1
  • Haha 1
Link to comment
Share on other sites

9 hours ago, jorge-1987 said:

PS: Please don't be too harsh, I know is nothing interesting nor innovative, it was my first run playing with TI BASIC.

Don't be discouraged, if you try-now,

I know that you can lend a helping hand.:lol:

 

Because there's good in everyone, and a new day has begun.🕗

You can see the morning sun, if you try...🌞

 

And... I know, things will be better... Yes, they will!:party:

 

But please, NO, BLACK SABBOTH!:o

 

 P.S. Prospero Año y Felicidad!📅

:)

  • Haha 2
Link to comment
Share on other sites

16 hours ago, SteveB said:

 

If you have some Black Sabbath MIDI's I know a way to catch up a little on the lost time.

....

 

Wow... This is super interesting indeed... It looks so good that it feels like cheating, hahah

 

Definetely will give it a try. Thanks!

Link to comment
Share on other sites

14 hours ago, HOME AUTOMATION said:

Don't be discouraged, if you try-now,

I know that you can lend a helping hand.:lol:

 

Because there's good in everyone, and a new day has begun.🕗

You can see the morning sun, if you try...🌞

 

And... I know, things will be better... Yes, they will!:party:

 

But please, NO, BLACK SABBOTH!:o

 

 P.S. Prospero Año y Felicidad!📅

:)

Hahaha, thanks and Feliz año!!!

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...