It is currently Wed Oct 18, 2017 8:03 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Envelope and sweep
PostPosted: Mon Jun 20, 2016 8:08 am 
Offline

Joined: Fri Mar 22, 2013 7:41 am
Posts: 34
So I'm making a chiptune plugin for GNU/Linux and I want to use NES APU as a reference. So far, I have implemented Pulse, Triangle and Noise and now want to implement envelope and sweep. How do they work? Does envelope change linearly? What about sweep? Does it oscillate like triangle?


Top
 Profile  
 
 Post subject: Re: Envelope and sweep
PostPosted: Mon Jun 20, 2016 8:11 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19094
Location: NE Indiana, USA (NTSC)
Did you find anything in APU Envelope and APU Sweep unclear?


Top
 Profile  
 
 Post subject: Re: Envelope and sweep
PostPosted: Mon Jun 20, 2016 8:26 am 
Offline

Joined: Fri Mar 22, 2013 7:41 am
Posts: 34
Pretty much everything. I barely understand hardware side of things.


Top
 Profile  
 
 Post subject: Re: Envelope and sweep
PostPosted: Mon Jun 20, 2016 8:46 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19094
Location: NE Indiana, USA (NTSC)
If you're just making a plug-in, and you don't expect compatibility with NES ROMs or NSF files, you can simplify the model by always using the constant volume mode. Let the instrument define the channel's output from 0 to 15 and change it 60 times a second.

Likewise you can mostly ignore the sweep units. Let controller messages (portamento, pitch bend) and your modulation LFO change the period every frame.


Top
 Profile  
 
 Post subject: Re: Envelope and sweep
PostPosted: Mon Jun 20, 2016 9:03 am 
Offline

Joined: Fri Mar 22, 2013 7:41 am
Posts: 34
tepples wrote:
If you're just making a plug-in, and you don't expect compatibility with NES ROMs or NSF files, you can simplify the model by always using the constant volume mode. Let the instrument define the channel's output from 0 to 15 and change it 60 times a second.

Likewise you can mostly ignore the sweep units. Let controller messages (portamento, pitch bend) and your modulation LFO change the period every frame.


Yes, the end result will probably be like so but I want to at least at this point make it somewhat like NES on a conceptual level. So, envelope - linear downward slope? So I can set the maximum amount and just set it to max volume at Note On MIDI message and then decrease linearly?

Sweep - triangle? So I just set the amount of vibrato and frequency and change pitch accordingly?


Top
 Profile  
 
 Post subject: Re: Envelope and sweep
PostPosted: Mon Jun 20, 2016 9:29 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19094
Location: NE Indiana, USA (NTSC)
Sweep is not a triangle. Sweep is linear, more like portamento than like vibrato. Think of Mario's jump sound.


Top
 Profile  
 
 Post subject: Re: Envelope and sweep
PostPosted: Mon Jun 20, 2016 9:34 am 
Offline

Joined: Fri Mar 22, 2013 7:41 am
Posts: 34
Ah, I get it now. So what about envelope?


Top
 Profile  
 
 Post subject: Re: Envelope and sweep
PostPosted: Mon Jun 20, 2016 9:59 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19094
Location: NE Indiana, USA (NTSC)
It's a decay, linear (saw) in amplitude space but quantized to 16 levels, from maximum amplitude to silence. The time of the decay can be controlled between 1/15 and 16/15 seconds in 1/15 second units. Whether or not the volume resets to maximum after expiring can also be controlled.

Very few games past 1983-1984 actually used the envelope outside constant volume mode.


Top
 Profile  
 
 Post subject: Re: Envelope and sweep
PostPosted: Mon Jun 20, 2016 10:04 am 
Offline

Joined: Fri Mar 22, 2013 7:41 am
Posts: 34
tepples wrote:
It's a decay, linear (saw) in amplitude space but quantized to 16 levels, from maximum amplitude to silence. The time of the decay can be controlled between 1/15 and 16/15 seconds in 1/15 second units. Whether or not the volume resets to maximum after expiring can also be controlled.

Very few games past 1983-1984 actually used the envelope outside constant volume mode.


Thanks. Now I get everything.


Top
 Profile  
 
 Post subject: Re: Envelope and sweep
PostPosted: Mon Jun 20, 2016 12:35 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1771
Location: DIGDUG
Note, triangle has no volume control. It either on or off. And my perception is that triangle is slightly quieter than the other channels (and of course, an octave lower).

Maybe you know that already. IDK.

Maybe for a chiptune tool, you can ignore all that.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
 Post subject: Re: Envelope and sweep
PostPosted: Mon Jun 20, 2016 1:21 pm 
Offline

Joined: Fri Mar 22, 2013 7:41 am
Posts: 34
dougeff wrote:
Note, triangle has no volume control. It either on or off. And my perception is that triangle is slightly quieter than the other channels (and of course, an octave lower).

Maybe you know that already. IDK.

Maybe for a chiptune tool, you can ignore all that.


Yes, I do all 128 velocity levels provided by MIDI standard. The code is here: https://gitlab.com/ftz/nes-synth
But I decided not to limit myself to NES and do a general chiptune plugin which means the project will be renamed after I do one and only "NES" release.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 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