Jump to content
IGNORED

Making beautiful music


atari2600land

Recommended Posts

Do I really have to copy that whole program in order to play a song in my program?

 

If you want to use that example then yes, you do. There may be other methods of incorporating music into bB programs, but for now it's the only example I know of. It works really well, although I've had a hard time modifying the song in my Jumper demo game. Making something that sounds good is going to take hours of work. I've earned a great deal of respect for all the atari audio programmers out there. ;)

 

Steve

Link to comment
Share on other sites

I put the example code on that page in batari basic:

dim musicPointer=a
 dim musicTimer=b
 dim tempaudv=t

 rem VOLUME DOWN AND SET CHANNELS
 AUDV0=0
 AUDC0=6

 rem INITIALIZE POINTERS AND TIMERS
 musicPointer=$FF
 musicTimer=0

startLoop

 rem TIME TO UPDATE NOTE?
 if musicTimer = 0 then gosub changeMusicNote
 musicTimer = musicTimer - 1

 drawscreen
 goto startLoop

changeMusicNote
musicPointer = musicPointer + 1
AUDF0 = musicData[musicPointer]

tempaudv = 8
if musicData[musicPointer] = $FF then tempaudv = 0
AUDV0 = tempaudv

musicPointer = musicPointer + 1
musicTimer = musicData[musicPointer]
rem value is (2 * #_OF_NOTES) - 1
if musicPointer > 69 then musicPointer = #-1

 return

 data musicData
 24,30,27,30,30,30,27,30,24,28,-1,2,24,28,-1,2,24,60
 27,28,-1,2,27,28,-1,2,27,60,24,30,20,28,-1,2,20,60
 24,30,27,30,30,30,27,30,24,28,-1,2,24,28,-1,2,24,28,-1,2
 24,30,27,28,-1,2,27,30,24,30,27,30,30,120
end

compiled it, and it said it didn't know what musicPointer was!

Link to comment
Share on other sites

When you get this kind of error, use your editor to "find" the string in question and then see if it's there, see if it's indented properly, etc....

 

I wrote this music engine a longish while back. I think I didn't go further with it because someone pointed out that I could have saved a lot of ROM by use one byte to hold both note length and frequency, so I kind of got discouraged and didn't follow up on some of my grand ambitions for it

Link to comment
Share on other sites

Making something that sounds good is going to take hours of work. I've earned a great deal of respect for all the atari audio programmers out there. ;)

See some of the entries in my blog and Tommy's blog for some great helps.

 

And yes, it is a lot of work to get stuff that sounds good. Well, sometimes you stumble onto something simple that sounds great, but usually it takes a lot of work.

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