It is currently Tue Oct 17, 2017 2:41 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Sound Question
PostPosted: Mon Jun 06, 2005 6:01 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2126
Location: Minneapolis, Minnesota, United States
This isn't an emulation question, but I ask it here, because people only seem to be active here. But, I'm not sure about how to do sound stuff. I can make a note, but I can't make it change or anything. I know you have to do something in 4017, but what? can someone give me an example of a sound code that has changing notes and rythyms? thank you... :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 6:35 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
this really should go in nesdev for the sake or keeping the forums organized -- pretty much everyone here browses both nesdev and nesemdev so it's not like we'll miss it.

Anyway, music generation code is just different notes played over a period of time.

For example if you want to make a "Ta-da" type sound, you could do it with something like the following:

- Start to play a note
- Wait 20 or so frames
- Stop the note
- Wait 2 or so frames
- Start the note up again
- Wait 120 or so frames
- Stop the note


A game could run its music engine by keeping track of which channel is playing what note -- as well as the length of the note. Every frame, a routine would be JSRed to, which a counter for each playing channel would decrease. When that counter hits zero, the game could pull the next note to play from its note list, play the new note, and reset it's counter to represent the desired length of the note.

Any example code I could write would be very lengthy and drawn-out -- so I won't do it. Too much work for a forum paste.


edit:

also, $4017 affects APU frame IRQs and the APU frame sequencer -- this changes the timing for sound sub-systems like the Sweep Unit, Decay Counter, and other areas. It isn't really vital to play sound.

Take a detailed look at $4015, and $4000-$400F --- those are the registers to know for sound playback. $4010-$4013 as well -- but that's for the DMC (operates quite differently from the other channels)


Last edited by Disch on Mon Jun 06, 2005 6:42 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 6:40 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
Uh... time for a moderator, Disch? ;)

_________________
Zepper
RockNES developer


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 6:43 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
do these forums even have moderators? I guess memblers... =P


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group