It is currently Sun Oct 22, 2017 4:08 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Tue Feb 21, 2017 8:04 am 
Offline

Joined: Fri Mar 01, 2013 4:46 am
Posts: 251
I'm working on a project, to see if I can manipulate the note being played for either the Square, Triangle, & Noise channels.

I'm reading up on nesdev wiki, but all I see are terms like envelope, sweep, length, etc. Nothing sticks out to what bits are used with the addresses as the "note" being played.

Can someone please explain what is considered the technical name for a musical note?


Top
 Profile  
 
PostPosted: Tue Feb 21, 2017 8:19 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5732
Location: Canada
If you don't like the term "note", which has a bunch of extra connotation (e.g. written music), maybe the word "tone" would do? It more simply refers to just a continuing sound, I think?


Top
 Profile  
 
PostPosted: Tue Feb 21, 2017 8:51 am 
Offline

Joined: Fri Mar 01, 2013 4:46 am
Posts: 251
I don't see "tone" within the nesdev. :-(

Here is the description of square 1 via nesdev wiki.

$4000 / $4004 DDLC VVVV Duty (D), envelope loop / length counter halt (L), constant volume (C), volume/envelope (V)

$4001 / $4005 EPPP NSSS Sweep unit: enabled (E), period (P), negate (N), shift (S)

$4002 / $4006 TTTT TTTT Timer low (T)

$4003 / $4007 LLLL LTTT Length counter load (L), timer high (T)


Top
 Profile  
 
PostPosted: Tue Feb 21, 2017 9:10 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5732
Location: Canada
I thought you were searching for an appropriate word to describe something, not trying to figure out how a particular idea is described on the wiki. I don't think the wiki says "tone".

Here are a few terms the wiki might use, and a description of how they might be components of a "note":
  • envelope / volume - controls where a note starts and stops, and how loud it is over time
  • period / frequency / pitch - controls how "high" or "low" the tone of the note is (e.g. "G-3" vs "C-2")
  • duty - controls the timbre or "texture" of the note (e.g. clarinet vs. oboe)


Top
 Profile  
 
PostPosted: Tue Feb 21, 2017 9:24 am 
Offline
User avatar

Joined: Wed Oct 16, 2013 7:55 am
Posts: 130
Do you mean frequency? That's what determines weather a note / tone is "C", "D", "E", etc. It's not exactly the same thing, but there's a direct correlation, the wiki describes the math.


Top
 Profile  
 
PostPosted: Tue Feb 21, 2017 9:27 am 
Offline

Joined: Fri Mar 01, 2013 4:46 am
Posts: 251
Yes like C, C# etc, those to me are notes. Thanks you guys for your help. :-)


Top
 Profile  
 
PostPosted: Tue Feb 21, 2017 9:29 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19115
Location: NE Indiana, USA (NTSC)
Duty: Controls the instantaneous timbre.

Timer: Controls the wave's period in units of 16 CPU cycles (pulse) or 32 CPU cycles (triangle). Lower values mean a higher pitch. The value 253, for example, means 1789773/16/(253+1) = 440.4 Hz, or the A above middle C.

To convert note names to frequencies in hertz, assuming an equal-tempered (12edo) scale with A = 440 Hz, use Piano key frequencies. To convert those to period values, use this formula:
Code:
period = round(1789773/16/frequency) - 1


If you just want a lookup table from a semitone number to the values that need to be written to $4002, $4003, $4006, $4007, $400A, and $400B, see APU period table.


Top
 Profile  
 
PostPosted: Tue Feb 21, 2017 2:17 pm 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7234
Location: Chexbres, VD, Switzerland
Quote:
period = round(1789773/16/frequency) - 1

Actually, rounding is not always the best way. In my music engine I used high pitched triangle notes and those sounded incredigly wrong, it was really disturbing. So instead of trying to use the NES to play real world musical frequencies based on A=440Hz, I use the natural tones of the NES and use it for the music. Basically, I compute the detune value for a high pitched octave using NES. Then I compute the average of all detune values, and center all my notes arround this detune value. This makes notes less detuned in average, and made high pitched triangle sounds a lot better.

I don't know whether I still have the calc spreadsheet where I did all those calculations but I'd recommand doing those again anyway just to be sure. Basically by lowering the pitch a bit, playing a A would be frequencies $1ff, $ff, $7f, $3f, $1f, etc... and it sounded much better, if you do it on raw calculation based on A=440Hz you get $fd instead.

On the other hand if you are into deep vibratoes and not into high pitched triangle, it would be a good idea to detune your music up, so that the A notes are further away from the MSB period changes which triggers horrible snaps and pops in the sound.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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