gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Using the PSG to create music

#147595 - Lazy1 - Mon Dec 24, 2007 3:54 am

Are there any guides out there that explain everything to an audio newb like me?
I like the sounds that it can produce like the old NES games but I don't understand how various frequencies, ect. can come together to make those tunes.

#147605 - ingramb - Mon Dec 24, 2007 8:59 am

You can set the frequency of a PSG channel, which corresponds to a musical note using a chart like this: http://www.phy.mtu.edu/~suits/notefreqs.html

You can also change the duty cycle of each PSG channel, which I think will just effect the "color" of the note. You probably just need to play with this to see what sounds good.

To make an actual song, I would probably look into something like a midi or mod file, and then have a program on the PC translate it into something you can read on the ds, mapping instruments into PSG channels or noise channels with various parameters.

I've never actually done this, but hopefully this helps a bit.

#147630 - tepples - Mon Dec 24, 2007 11:17 pm

To see how frequencies become musical pitches, see Musical tuning systems on Wikipedia. The most common tuning system for Western music as of the late 20th century and early 21st century is equal temperament.

You might want to start from the source code for AXE, a short demo that I used to learn the PSG.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#147708 - eKid - Wed Dec 26, 2007 5:46 pm

I was inspired by this post so.........

http://forum.gbadev.org/viewtopic.php?t=14726

Includes messy source code with psg support :)