Jump to content
IGNORED

Music in applesoft basic


classicgamer_27330

Recommended Posts

http://eightbitsoundandfury.ld8.org/programming.html

 

I've found on youtube somebody has got the us national anthem as a program pretty neat

 

wish I was that talented

 

Thank You for the Link to this Web Site... There is some good information there....

 

I have played an instrument for many years... But you don't need to have Musical Talent to Find a Song and Transcribe it for a Music Program for the Computer...

 

 

MarkO

Link to comment
Share on other sites

But you don't need to have Musical Talent to Find a Song and Transcribe it for a Music Program for the Computer...

That's pretty much where i was going except that i disassembled the machine code on that page, wrote my own music sequencer around it and made a start on importing a tune. The only problem i've had is being limited to three octaves, my first choice of one channel piece needed four just for the bit i wanted to transcribe!

  • Like 1
Link to comment
Share on other sites

That's pretty much where i was going except that i disassembled the machine code on that page, wrote my own music sequencer around it and made a start on importing a tune. The only problem i've had is being limited to three octaves, my first choice of one channel piece needed four just for the bit i wanted to transcribe!

I believe that 3 Octaves is the Limit..

 

You might be able to learn something from Paul Lutus' Electronic Duet Code..

 

 

MarkO

Link to comment
Share on other sites

More about how multiple clicks can appear like a tone, and why we read $C030 to get there:

http://lateblt.tripod.com/appl2snd.htm

 

Correct me if I'm wrong, but doesn't this routine do the same thing, but slightly less spaghetti and five bytes shorter? (Note: I didn't rewrite it in order to optimize, but to understand the routine)

0302 LDY $0301
0305 LDA $C030
0308 LDX $0300
030B DEX
030C BNE $030B
030E DEY
030F BNE $0305
0311 RTS

Or as a BASIC program:

 

10 DATA 172,1,3,173,48,192,174,0,3,202,208,253,136,208,244,96

20 FOR I=770 TO 785:READ V:POKE I,V:NEXT

 

I don't know if the frequencies change the slightest, but when testing in an online Apple ][ emulator the function appears to be intact.

 

Edit: Nope, my version causes higher frequencies and shorter notes, apparently due to the missing dummy loop that delays the original program. It probably means if the dummy loop can be extended, we can achieve greater range of frequencies on behalf of pitch resolution, and that durations need to be shortened.

Edited by carlsson
Link to comment
Share on other sites

After a lot of trial and error, I found adding NOP's probably is the best. Note that the routine still communicates by 768 and 769, I just moved it in memory so I could compare the sound of the two routines. Since this routine is position independent, it can be loaded to 770 as well.

0320 LDA $C030
0323 LDX $0300
0326 DEX
0327 BEQ $0320
0329 NOP
032A NOP
032B DEY
032C BNE $0326
032E DEC $0301
0331 BNE $0326
0333 RTS

10 DATA 173,48,192,174,0,3,202,240,247,234,234,136,208,248,206,1,3,208,243,96

20 FOR I=800 TO 819:READ V:POKE I,V:NEXT

 

To make lighter and faster sounds:

 

10 DATA 173,48,192,174,0,3,202,240,247,234,136,208,249,206,1,3,208,244,96

20 FOR I=800 TO 818:READ V:POKE I,V:NEXT

To make darker and slower sounds:
10 DATA 173,48,192,174,0,3,202,240,247,234,234,234,136,208,247,206,1,3,208,242,96

20 FOR I=800 TO 820:READ V:POKE I,V:NEXT

 

To paraphrase Donkey Kong: How Low Can You Get? You could get very bassy notes if you add more NOP's, and then extend the range by quite a lot on behalf of the pitch resolution.

Edited by carlsson
Link to comment
Share on other sites

The problem i have is that i've no ear for music; i can sort of tell if a note is off but not necessarily in which direction or by how much, so there's no chance of me doing much more than writing a driver around an already established tone generator!

 

What i'll probably do is improve the driver i wrote a bit before shoving a picture and perhaps a text line on screen and releasing the lot including source...

 

Edit: carlsson, i'm going to use your generator rather than the original if that's okay? (With a credit of course.)

Edited by TMR
Link to comment
Share on other sites

Sure. Perhaps you can bug fix it too, I believe the loop gets stuck for certain high frequencies... :-D

 

Actually, I don't think lowering the base frequency increases the number of notes you can hit, but you could set up two similar routines in memory and alternate between them in order to extend the range. Too bad the generated frequency seems to differ by an unknown amount depending on how much you slow it down, so you might need two frequency tables.

Link to comment
Share on other sites

i've just released a little demo that plays a one channel tune (the "idle" music from Microprose Soccer on the C64 by Martin Galway), displays a picture converted with my own tool which is still in beta and has a line of cycling text at the top of the screen which is for greetings and so forth. It looks like this...

 

septic-a2.png

 

...and can be downloaded from the Cosine website. It really isn't anything special, but does strap a sequencer onto Carlsson's upgrade of the tone generator which started this thread and the source can be downloaded from the Github repository if anyone wants to prod around.

Edited by TMR
  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

i've just released a little demo that plays a one channel tune (the "idle" music from Microprose Soccer on the C64 by Martin Galway), displays a picture converted with my own tool which is still in beta and has a line of cycling text at the top of the screen which is for greetings and so forth. It looks like this...

 

septic-a2.png

 

...and can be downloaded from the Cosine website. It really isn't anything special, but does strap a sequencer onto Carlsson's upgrade of the tone generator which started this thread and the source can be downloaded from the Github repository if anyone wants to prod around.

That's pretty cool!

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...