It is currently Sat Aug 18, 2018 1:47 pm

 All times are UTC - 7 hours

 Page 1 of 1 [ 6 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Can someone explain arpeggios?Posted: Thu Feb 02, 2017 11:16 am

Joined: Tue Nov 20, 2012 1:59 pm
Posts: 67
Now that the contest is over, I've found out that I really like coding for these old school consoles. However, a full game is a bit taxing. Long story short I'd like to get into coding demos and the likes. Some might hate them, but arpeggios play an important role in vgm history. I'm rambling on here so I'll get to the point, I'd like someone to explain from a programming stand point how to implement arpeggios into a NES music engine. I know they are usually a loop? of the base notes 3rd, and fifth. But I'm not sure how to implement that. Like do they slide or is it just three notes played at fast intervals. If so I'd also appreciate someone explaining these intervals.

Thanks, zkip.

Top

 Post subject: Re: Can someone explain arpeggios?Posted: Thu Feb 02, 2017 1:01 pm

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20415
Location: NE Indiana, USA (NTSC)
Assuming that by "arpeggio", you're referring to arpeggio effects in the pattern, not arpeggio-type envelopes on instruments.

Let's say the pattern enables the arpeggio effect 047. This means arpeggio1 = 4 and arpeggio2 = 7. The numbers represent intervals measured in semitones: 4 is a major third above the base note, and 7 is a perfect fifth above the base note. Thus 047 represents a major chord in inversion 0.

Here is pseudocode:
Code:
On note start:
Set arpeggio phase to 0
Remember the base pitch of the note
Each frame:
If arpeggio phase == 0:
Set pitch to base pitch
If arpeggio phase == 1:
Set pitch to base pitch + arpeggio1
If arpeggio phase == 2:
Set pitch to base pitch + arpeggio2
Add 1 to arpeggio phase
If arpeggio phase >= 3:
Set arpeggio phase to 0

Let me know the first line you don't understand.

This allows for no arpeggio (arpeggio1=0 and arpeggio2=0), even combinations of three notes (arpeggio1=x and arpeggio2=y), a combination of two notes with more of the base note (arpeggio1=0 and arpeggio2=x), a combination of two notes with more of the upper note (arpeggio1=x and arpeggio2=x)

One enhancement is to replace the last if-then as follows:
Code:
If arpeggio phase >= 3:
Set arpeggio phase to 0
If arpeggio2 == 0:
Set arpeggio phase to 1

This allows an additional type of arpeggio: an even combination of two notes (arpeggio1=x and arpeggio2=0).

The Pently music engine implements exactly this arpeggio algorithm. In pentlymusic.s, look around storePitchWithArpeggio.

Top

 Post subject: Re: Can someone explain arpeggios?Posted: Thu Feb 02, 2017 1:21 pm

Joined: Fri May 08, 2015 7:17 pm
Posts: 2200
Location: DIGDUG
Famitracker....instrument...arpeggio...type | 0 4 7 (must have a pipe first), or | 0 4 7 4

Also, other intervals are interesting...
0 4 11 4
0 4 12 4
0 5 12 5
0 2 7 2
0 7 14 7
etc...

EDIT - 'pipe' is slang for a vertical bar.

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

Top

 Post subject: Re: Can someone explain arpeggios?Posted: Thu Feb 02, 2017 1:31 pm

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6598
Location: Canada
I'd recommend using Famitracker and trying out the arpeggio instrument envelopes.

There's a lot more to it than just repeating 3 notes on successive frames. You could use 2 or 3 frames per note for a slower effect. You can use loops of other lengths, 2 notes or 7 notes or whatever sounds interesting/appropriate to you. It is often very effective combined with other types of envelopes (i.e. changes of volume or duty).

Maybe also consider things besides just major or minor triads, and arpeggios wider than a single octave (12 semitones). An arpeggio might sweep up and down in order of pitch, or the the order might jump up and down erratically. They don't even have to loop! There are all sorts of interesting effects to try.

There are some good examples here:
https://www.youtube.com/watch?v=4HWHneafZ8w

One way to study these things is to use this NSF Importer tool to inspect NSF files in Famitracker. It breaks down everything an NSF is doing frame by frame (each frame on a single row), showing you exactly what it's made of:
http://rainwarrior.ca/projects/nes/nsfimport.html

zkip wrote:
Like do they slide or is it just three notes played at fast intervals.

It's not a slide effect, the pitch is changed immediately on a per-frame basis.

Top

 Post subject: Re: Can someone explain arpeggios?Posted: Fri Feb 03, 2017 8:41 am

Joined: Tue Nov 20, 2012 1:59 pm
Posts: 67
Thanks guys. I understand perfectly now and it's implemented in my engine. It really is crazy all of the interesting combinations of sounds you can get with these, and I haven't even tried adding volume envelopes to them yet. My next mission is to play around with those Rob Hubbard style sawtooth DPCM tricks. Thanks again guys.

Top

 Post subject: Re: Can someone explain arpeggios?Posted: Sat Feb 04, 2017 12:04 am
 Site Admin

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3541
Location: Indianapolis
If you're looking for something fancy to put in a sound engine, I'd recommend taking a look at something blargg came up with:
http://www.slack.net/~ant/misc/nes-saw/
Such a cool trick, it's practically a crime that no one has used this in a music engine (AFAIK), other than the demos on that page. DPCM sawtooth (or other waves), with volume control..

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 6 posts ]

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: No registered users and 4 guests

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

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki
Powered by phpBB® Forum Software © phpBB Group