Random Piano Experiment
Random Piano Experiment
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
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
- Kiyotewolf
- Veteran
- Posts: 96
- Joined: Tue Apr 01, 2008 11:38 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.
~Kiyote!
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.
~Kiyote!
Banana phone! We need more lemon pledge. * exploding fist of iced tea! * I see your psycho cat and counter with a duck that has a broken leg, in a cast.
Code: Select all
DO
j = j + 1
PLAY "o" + STR$(INT(3 + 3 * SIN(j))) + CHR$(INT(99.5 + 2.5 * SIN(j)))
LOOP UNTIL INP(&H60) = 1
- msdos622wasfun
- Coder
- Posts: 24
- Joined: Sun Jun 20, 2010 11:19 pm
- Location: Michigan, USA
- Contact:
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.
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.
Check out my Freeware at <a href="http://erichkohl.blogspot.com/p/my-software.html">My Software Page!</a>
- Kiyotewolf
- Veteran
- Posts: 96
- Joined: Tue Apr 01, 2008 11:38 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!
:M
I remember such an ASM program, I used it & typed it in!
:M
Banana phone! We need more lemon pledge. * exploding fist of iced tea! * I see your psycho cat and counter with a duck that has a broken leg, in a cast.
- msdos622wasfun
- Coder
- Posts: 24
- Joined: Sun Jun 20, 2010 11:19 pm
- Location: Michigan, USA
- Contact:
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.Kiyotewolf wrote:I remember such an ASM program, I used it & typed it in!
Check out my Freeware at <a href="http://erichkohl.blogspot.com/p/my-software.html">My Software Page!</a>
- Kiyotewolf
- Veteran
- Posts: 96
- Joined: Tue Apr 01, 2008 11:38 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.
:M
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.
:M
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.
Banana phone! We need more lemon pledge. * exploding fist of iced tea! * I see your psycho cat and counter with a duck that has a broken leg, in a cast.
- Kiyotewolf
- Veteran
- Posts: 96
- Joined: Tue Apr 01, 2008 11:38 pm
- Kiyotewolf
- Veteran
- Posts: 96
- Joined: Tue Apr 01, 2008 11:38 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.
:M
It's possible, to do it 'proper' and to do it in the 'cheat' way of arpeggio.
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.
:M
It's possible, to do it 'proper' and to do it in the 'cheat' way of arpeggio.
Banana phone! We need more lemon pledge. * exploding fist of iced tea! * I see your psycho cat and counter with a duck that has a broken leg, in a cast.
- msdos622wasfun
- Coder
- Posts: 24
- Joined: Sun Jun 20, 2010 11:19 pm
- Location: Michigan, USA
- Contact:
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.
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.
Check out my Freeware at <a href="http://erichkohl.blogspot.com/p/my-software.html">My Software Page!</a>