HP Forums

Full Version: ( Free42 ) Random Melody
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This program run the "Random Tone" between
Tone 1 to 6 in an infinite loop to produce
"Random Melody"

Demo Clip: https://youtu.be/PxY_8OMilUQ

Program:

LBL "T"
RAN 6 x 1 + IP
1 - X=0
GTO 00 //(1)
1 - X= 0
GTO 01 //(2)
1 - X=0
GTO 02 //(3)
1 - X=0
GTO 03 //(4)
1 - X=0
GTO 04 //(5)
1 - X=0
GTO "T"
TONE 6 //(6)
GTO "RANT"
LBL 00 TONE 1 GTO "T"
LBL 01 TONE 2 GTO "T"
LBL 02 TONE 3 GTO "T"
LBL 03 TONE 4 GTO "T"
LBL 04 TONE 5 GTO "T"

Gamo 5/31/2020
Why not use TONE IND ST X?
Werner
Thanks for the review Werner
This is my first try on HP-42S programming and
That is very nice idea about the Indirect Stack manipulation.

Gamo
Very nice musical program. I like how stretched a few tones into a medley.
Thanks Eddie and Werner for the review.
As Werner mentioned about TONE IND ST X

Here is the program updates.

LBL "TT"
RAN 9 x 1 + IP
TONE IND ST X
GTO "TT"

Much shorter program and this time used all
9 Tones, test it and sound melody is not as good
to hear compared to only 6 Tones version.

Gamo
(05-31-2020 05:23 PM)Gamo Wrote: [ -> ]Thanks Eddie and Werner for the review.
As Werner mentioned about TONE IND ST X

Here is the program updates.

LBL "TT"
RAN 9 x 1 + IP
TONE IND ST X
GTO "TT"

Much shorter program and this time used all
9 Tones, test it and sound melody is not as good
to hear compared to only 6 Tones version.

Gamo

You don't really need the IP. Also, there are 10 tones from 0 to 9, so you can do:

LBL "TT"
RAN
10
x
TONE IND ST X
GTO "TT"

to play a random melody with the 10 different tones.
ijabbott, Thanks for the updates and thats right no need of the

[1 + IP] I was thinking about that Random Dice routine and just

put it in eventhough this have nothing to do with Random Tones.

Gamo
Reference URL's