Page 1 of 1
Random Piano Experiment
Posted: Mon Aug 30, 2010 4:10 pm
10 RANDOMIZE TIMER
100 a = INT(RND(1) * 7)
110 b = INT(RND(1) * 7)
120 IF a = b THEN 200 ELSE 100
200 e = INT(RND(1) * 6)
210 f = INT(RND(1) * 600)
220 IF e = f THEN 300 ELSE 200
300 h = INT(RND(1) * 10) + 1
310 i = INT(RND(1) * 1000)
320 IF h = i THEN 400 ELSE 300
400 k = INT(RND(1) * 10)
410 l = INT(RND(1) * 10)
420 IF k = l THEN 500 ELSE 400
500 PLAY CHR$(65 + a)
510 RANDOMIZE TIMER
520 PLAY "O" + STR$(e)
540 PLAY "L" + STR$(h)
600 IF k = 1 THEN PLAY "p4"
1000 GOTO 10
Posted: Sun Apr 03, 2011 9:55 pm
Once I made a program that would count from 1 to 8, Do Re Me, then it would look for random jumps of 2 or 3 up or down from that note, so it would play harmonies off the scale.
It would count, playing Do Re Me Fa So La Ti Do, but instead of playing those notes, it might play..
Mi Fa Mi Re.. and so on.
It sounded pretty interesting. I forget what other kind of jumps I had in it. Might've been 2, or 3, or 4 note jumps per base musical scale note.
Posted: Mon Apr 04, 2011 4:22 pm
Code: Select all
j = j + 1
PLAY "o" + STR$(INT(3 + 3 * SIN(j))) + CHR$(INT(99.5 + 2.5 * SIN(j)))
LOOP UNTIL INP(&H60) = 1
Posted: Mon Jun 06, 2011 6:52 pm
I remember years ago when I wanted to get Applesoft BASIC to generate polyphony, that is, more than one note at a time. I even wrote in to some magazine to ask for help. Needless to say, it was a little out of my league, as it required advanced assembly techniques.
The first program I ever typed in that generated random music was straight out of the BASIC manual for our Radio Shack MC-10. I'm not sure if I understood fully what it was trying to do at the time, but it was cool nonetheless.
Posted: Mon Jun 06, 2011 8:16 pm
"I remember years ago when I wanted to get Applesoft BASIC to generate polyphony, that is, more than one note at a time. I even wrote in to some magazine to ask for help. Needless to say, it was a little out of my league, as it required advanced assembly techniques. "
I remember such an ASM program, I used it & typed it in!
Posted: Tue Jun 07, 2011 1:31 pm
Kiyotewolf wrote:I remember such an ASM program, I used it & typed it in!
Did it actually work correctly? If I recall, the solution I was introduced to was kind of a "cheat," because I don't think the speaker or the primitive sound circuitry could genuinely produce multiple tones at the same time.
Posted: Tue Jun 07, 2011 1:55 pm
Yeah it did, it used arpeggio, it would play them a whole bunch of times in succession, within the space of a normal single note.
They use that same trick in QBasic, I can dig up a program that uses it alot, it's one of the songs from one of the Fievel movies, that they use that trick extensively. But it's all done, in the QBasic PLAY meta language.
Posted: Tue Jun 07, 2011 2:49 pm
Posted: Tue Jun 07, 2011 3:41 pm
"I don't think the speaker or the primitive sound circuitry could genuinely produce multiple tones at the same time."
It is possible to generate multiple tones at the same time, but it requires MOD PLAYER type pre-calculations on the fly, outputting audio to the 1-bit speaker, as if it was a 5-bit DAC, the same method as blitting the PC internal speaker.
You CAN mix down multiple channels of audio, on the fly, but only in carefully timed ASM, 6502 ASM, for the Apple, you see, but you gotta be a whiz.
People have done it, it's just marvelous to see & hear.
The Music Construction Set for Apple ][e COULD play 3 note polyphonic sound on the internal Apple speaker, cause it did something along those lines, and it was a native Apple program.
It's possible, to do it 'proper' and to do it in the 'cheat' way of arpeggio.
Posted: Wed Jun 08, 2011 5:19 pm
Well, Lord knows I did hear my fair share of games on the Apple ][ that really did some fancy things with audio and stretched the limit of what could be done with that little thing.
And yeah, I played a little bit with Music Construction Set back then. That was before I really knew anything about music theory (I'm now a hobbyist musician). At the very least, it was just fun putting random notes on the staff and listening to the results!
That arpeggio technique was pretty much what I had in mind, but I didn't know how to articulate it.
I ran that little program, by the way. Very cleverly done.
Posted: Wed Jun 27, 2012 7:05 am
Cool! Imma try this.