Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Tomy's Sega PSG SN76489 Music + Tutorial

Reply to topic
Author Message
  • Joined: 07 Sep 2013
  • Posts: 51
  • Location: Finland
Reply with quote
Tomy's Sega PSG SN76489 Music + Tutorial
Post Posted: Sun Apr 19, 2020 11:48 am
Sega PSG SN76489 tutorial by Tomy
--- --- --- --- --- --- --- --- --- --- --- --- ---

4-channel soundchip:
CH1: 50% square, 1024 frequencies (108Hz - 110840Hz), 16 volume levels
CH2: 50% square, 1024 frequencies (108Hz - 110840Hz), 16 volume levels
CH3: 50% square, 1024 frequencies (108Hz - 110840Hz), 16 volume levels

You can use CH4 freely with the 3 preset frequencies provided:
CH4: 6.25% square / White noise, 3 frequencies (108Hz, 216Hz & 434Hz), 16 volume levels
When following CH3 frequency data it will unlock all the possible frequencies:
CH4: 6.25% square / White noise, 1024 frequencies (7Hz - 6928Hz), 16 volume levels

Note that these are all PAL values as that's what I work with. With this tutorial I want to share all the possible tricks I've found working with this soundchip. A guide to the "Tomy sound", if there is such a thing? I personally like to think of the Sega PSG as a 3 channel soundchip, sacrificing the third channel completely to make the fourth channel capable of so much more. So for me it's 2 channels of 50% squares and 1 channel of 6.25% squares / white noise without any restrictions.

Let's begin with the 50% squares, I tried to think about what I like to do with them:
- Melodic leads.
- Echo, play around with the delay and volume to get a different style of echo. Detune the echo from the main melody, I like to detune it down by 1 step. This makes it so that they never clash when playing the same note, but instead produce a soft phasing which is more pleasant.
- Snare low-end. Mix with white noise to get a fuller snare sound.
- Volume pluck. Make it louder at the very beginning of a note then quickly drop down to the desired volume to hold / decay.
- Note cut off. Have enough time before a new note is played. This is completely how you prefer it to sound, but I like the subtle staccato it creates.
- Take advantage of any silent gaps. The note cut offs and pauses in melody create silent parts. No matter if there is 1 frame or 50 frames of silence, you can make use of it. Let's say both channels are playing, if there is a silence in the first channel I will copy whatever the second channel is playing at that moment there and make sure it is detuned from anything else playing at the same time and even more quiet on volume than the echoes. This creates a tiny subtle phasing effect. The more silent gaps a melody has the more you can utilize this trick to get depth to the sound far from what a simple melody with an echo sounds.
- Variable vibrato rate. When a new note is on, I let it play for a short amount of time without vibrato then I add vibrato and the longer the note is held the faster the vibrato rate gets.
- Tremolo to fine control volume. For me when part of a melody goes higher it can easily start sounding piercing. If I reduce the volume by 1 step it can be too much, but instead I alter between that and the original volume to fake a volume between the 2 values. Remember to leave gaps for the volume value changes so as to not sound too distorted.
- Mixing the 2 channels together. You can get a different flavour to the sound playing the same note an octave apart for example. I like to play the same note and then detune the other channel by 1 or more steps. It creates a pleasing phasing effect, similar to pulse-width modulation. Alter the volume too between the channels, at the same volume the effect is the most powerful and if you reduce the volume of the other channel the effect gets more subtle.

6.25% square:
- Bassline.
- Volume pluck.
- Variable volume. I like to use octave basslines but this should work with any kind of bassline. What I do is play the low notes at a higher volume than the high notes. High 6.25% squares are not as pleasant as the lower ones for me, this way I don't have to make the whole bassline quieter, losing some of it's power.

White noise:
- Drums
- Attack sound for bassline. You can insert 1 frame of white noise at the beginning of a note and then immediately change it to 6.25% square. This gives basslines more presence.
- Bass drum. You can get a powerful kick with the white noise. The trick is in combining different frequencies together. Put it simply if we can afford 3 frames for the bassdrum you experiment and mix together 3 frequencies to create the sound. When you change the frequency of a sound it will continue from the old value to the new one. It doesn't reset and start over. My bass drums have the attack part in higher frequency to give it that texture and then it changes to a lower one that hits that 50Hz - 60Hz area. This was the one discovery about the Sega PSG I'm most proud of - to get actual bass drums out of it. You really need to leave some power in volume for it though, it's the only instrument in my music that is at full volume.
- Snare drum. Possible to do with white noise only. Same technique as with the bass drum. The way I do it is so that the first frame is silent, giving the sound the desired frequency I want it to start from, then change to low-end for the body and then quickly to high-end to give it that brightness.
- Hi-hat. Usually when 6.25% square is used simultaneously there is only time for 1 frame hi-hats. The noise with SMS PSG tends to have a percussive attack so these 1 frame instruments easily sound piercing. What I do is add one frame prior to that frame where you want the sound. Make that first frame a silent one and then push up the volume on the second frame. It gets rid of the percussive part of the sound. Here's something cool: Make it so that the actual sound part (second frame) is a certain frequency you want and then change the silent frame frequency, the resulting sound will vary depending on the frequency the sound will start from. As it will "blend" from the first frame to the second. This way you can get so many subtle variations to these sounds.

The Sega PSG initial frequency when powered on is the highest frequency it can produce. It means that it will be the "starting frequency" of anything that comes after it - as in the first sound any channel makes. This affects most noticeably CH4. If the first sound is a bassdrum, it won't sound like it's supposed to because the frequency has to quickly come down to where I want it to start from. It messes up the first sound in this situation. I insert a silent frame at the beginning of my track where I duplicate the first frame / frequency of the bassdrum but silenced so that the PSG can start it from the frequency it's supposed to start from.

Regarding hardware many consoles suffer from flattened volume output of the higher levels. The 3 highest volume levels are more like a duplicate of the fourth highest level. These faulty levels really hurt making music with any bass in it, you really need that maximum volume, especially for the bass drum as mentioned before.

Regarding trackers I'm surprised that for a chip seemingly so painfully simple, no tracker seems to get it just right. Mod2PSG2 messes up advanced noise drums, Deflemask is missing 6 high frequencies that are important for hi-hats and snare drums, VGM Music Maker is missing the highest 2 frequencies and has a very awkward editor for PSG, Sneventracker has all of the functionality but no proper VGM export making it not user-friendly.

--- --- --- --- --- --- --- --- --- --- --- --- ---
I've got requests to write a guide / tutorial for the Sega PSG, so here it finally is. It's done from my point of view. I use PAL timing, VGM Music Maker and record from hardware. I tried to think of every trick I use to help someone looking to make something more out of his / her PSG music. The soundchip is definitely not as bad as people claim it to be, for me it has an awesome raw ice-cold 8-bit sound. The noise channel is one of the best in my opinion, capable of so much. Please throw away those preset frequencies... ;)
  View user's profile Send private message Visit poster's website
  • Joined: 07 Sep 2013
  • Posts: 51
  • Location: Finland
Reply with quote
Post Posted: Sun Apr 19, 2020 11:53 am
I also want to share my music in this thread. I record every channel individually from hardware and make oscilloscope view videos. Here's one I just uploaded:



I was smiling like a madman when I made that part from 1:09 onwards. Not something you'd expect from Master System? :D
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2686
Reply with quote
Post Posted: Sun Apr 19, 2020 12:15 pm
PURE GOLD! Thank you so much for sharing this!
  View user's profile Send private message Visit poster's website
  • Joined: 09 Dec 2013
  • Posts: 164
  • Location: detroit
Reply with quote
Post Posted: Sun Apr 19, 2020 1:57 pm
Very nice, TomyS :) Thank you!
  View user's profile Send private message
  • Joined: 01 Feb 2014
  • Posts: 517
Reply with quote
Post Posted: Sun Apr 19, 2020 4:42 pm
Brilliant. Thank you.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13233
  • Location: London
Reply with quote
Post Posted: Sun Apr 19, 2020 4:46 pm
Technically, the white noise is a random number generator but it has a fixed sequence. Every time you write to the frequency control for the noise channel, the sequence is reset - but if you are letting it follow the frequency of tone channel 3, it won’t reset when that changes. The random number sequence acts a lot like a noise sample. This sequence/sample is more percussive at the start on the Sega PSG compared to the SN76489. By using this trick to play the first frame of noise silently, you effectively are able to seek within the sequence to skip the percussive start and pick the bit you want for the following frames. Very clever!
  View user's profile Send private message Visit poster's website
  • Joined: 07 Sep 2013
  • Posts: 51
  • Location: Finland
Reply with quote
Post Posted: Sun Apr 19, 2020 5:03 pm
Maxim wrote
Technically, the white noise is a random number generator but it has a fixed sequence. Every time you write to the frequency control for the noise channel, the sequence is reset - but if you are letting it follow the frequency of tone channel 3, it won’t reset when that changes. The random number sequence acts a lot like a noise sample. This sequence/sample is more percussive at the start on the Sega PSG compared to the SN76489. By using this trick to play the first frame of noise silently, you effectively are able to seek within the sequence to skip the percussive start and pick the bit you want for the following frames. Very clever!


You said it well, this is exactly what I've found out by my own trial and error. If you have frames to spare you really can pick the exact part of the sequence you want in the following frames. I'm sure there are still surprises to be found from the Sega PSG, someone just needs to find the right frequencies. I personally searched through thousands of combinations for my drums.. it's crazy I know. I literally recorded all of them and went through them with a frequency analyzer to find the best bass drums and snare drums. I wanted to have real punch in my drums and they also needed to be "stable". Some other combinations sounded fine too but they were unstable when played together with all of the other instruments. What I have for bass drum for example now always hits 50Hz - 60Hz no matter what's happening around it.

Thank you all very much. I'm happy if anyone finds some help from my tips.
  View user's profile Send private message Visit poster's website
  • Joined: 24 Sep 2018
  • Posts: 64
Reply with quote
Post Posted: Sun Apr 19, 2020 5:51 pm
TomyS wrote
I also want to share my music in this thread. I record every channel individually from hardware and make oscilloscope view videos.


Follow-up question: how do you achieve that with an SN76489? It offers only a single pin for audio out, having already internally mixed the audio. Do you play them one at a time for video and then all together for audio?

Re: the random noise generator, the LFSR for the standard version is well known; Sega's reimplementation is similar but uses a 16-bit shifter and taps bit 4 instead of bit 1. So:

output_level = shifter & 1;
int new_bit = (shifter & 1) ^ ((shifter >> 3) & 1);
shifter = (shifter >> 1) | (new_bit << 15);
  View user's profile Send private message Visit poster's website
  • Joined: 07 Sep 2013
  • Posts: 51
  • Location: Finland
Reply with quote
Post Posted: Mon Apr 20, 2020 4:14 am
TomHarte wrote
Follow-up question: how do you achieve that with an SN76489? It offers only a single pin for audio out, having already internally mixed the audio. Do you play them one at a time for video and then all together for audio?


I prepare 3 different VGM files for the 3 channels to be played back alone and record them for the video. Then I'll mix the full recording of the track with the video.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Apr 2011
  • Posts: 240
  • Location: Netherlands
Reply with quote
Post Posted: Mon Apr 20, 2020 7:40 am
Are the default tone values good enough for the 6.25% square Bass line?
Or do you need to tune (some of) them? And does it differ between trackers?
  View user's profile Send private message
  • Joined: 07 Sep 2013
  • Posts: 51
  • Location: Finland
Reply with quote
Post Posted: Tue Apr 21, 2020 4:57 am
Zipper wrote
Are the default tone values good enough for the 6.25% square Bass line?
Or do you need to tune (some of) them? And does it differ between trackers?


I can only talk about VGM Music Maker tracker. Starting from around note C3 (note C6 in VGMMM) I feel the frequencies start to lose their precision so I tune some of the following higher notes differently. I listened by ear what sounds best for me.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2686
Reply with quote
Post Posted: Tue Apr 21, 2020 11:31 am
TomyS wrote
I use PAL timing, VGM Music Maker and record from hardware.


Do I remember it wrong or did you use Deflemask (and NTSC timing) for Weka Invaders' music? Was is because it better exports to VGM?
  View user's profile Send private message Visit poster's website
  • Joined: 07 Sep 2013
  • Posts: 51
  • Location: Finland
Reply with quote
Post Posted: Tue Apr 21, 2020 1:15 pm
sverx wrote
Do I remember it wrong or did you use Deflemask (and NTSC timing) for Weka Invaders' music? Was is because it better exports to VGM?


I used VGM Music Maker, I've only ever tried out other trackers never finished any tracks in them. We had to work around the export problem by making the music in NTSC but exporting in PAL. VGMMM is a really powerful tracker for Sega FM + PSG, sadly there are some problems that prevent it from being perfect.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2686
Reply with quote
Post Posted: Tue Apr 21, 2020 4:30 pm
TomyS wrote
We had to work around the export problem by making the music in NTSC but exporting in PAL.


Oh right I had totally forgot that!
That's a nice workaround and -if the target is PSGlib- that will work as PSG files are frame sync'ed.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Apr 2020
  • Posts: 1
Reply with quote
Post Posted: Thu Apr 23, 2020 3:07 pm
TomyS wrote
Maxim wrote
Technically, the white noise is a random number generator but it has a fixed sequence. Every time you write to the frequency control for the noise channel, the sequence is reset - but if you are letting it follow the frequency of tone channel 3, it won’t reset when that changes. The random number sequence acts a lot like a noise sample. This sequence/sample is more percussive at the start on the Sega PSG compared to the SN76489. By using this trick to play the first frame of noise silently, you effectively are able to seek within the sequence to skip the percussive start and pick the bit you want for the following frames. Very clever!


You said it well, this is exactly what I've found out by my own trial and error. If you have frames to spare you really can pick the exact part of the sequence you want in the following frames. I'm sure there are still surprises to be found from the Sega PSG, someone just needs to find the right frequencies. I personally searched through thousands of combinations for my drums.. it's crazy I know. I literally recorded all of them and went through them with a frequency analyzer to find the best bass drums and snare drums. I wanted to have real punch in my drums and they also needed to be "stable". Some other combinations sounded fine too but they were unstable when played together with all of the other instruments. What I have for bass drum for example now always hits 50Hz - 60Hz no matter what's happening around it.

Thank you all very much. I'm happy if anyone finds some help from my tips.


Hi Tomy, Deflemask noob here, I'm finding this all very helpful! When you say 'frames', are you referring to horizontal rows within the tracker itself, or do mean individual vertical sections within the instrument design macro? Or neither?
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 2686
Reply with quote
Post Posted: Thu Apr 23, 2020 3:24 pm
aeriththeancient wrote
When you say 'frames', are you referring to horizontal rows within the tracker itself, or do mean individual vertical sections within the instrument design macro? Or neither?


A frame is a TV screen frame, 1/60th or 1/50th of a second.
One horizontal row can be any whole number of frames, you can set it freely and even change that while the tune is playing.
Vertical sections within the instrument design should be frames too, anyway.
  View user's profile Send private message Visit poster's website
  • Joined: 07 Sep 2013
  • Posts: 51
  • Location: Finland
Reply with quote
Post Posted: Thu Apr 23, 2020 3:30 pm
aeriththeancient wrote
Hi Tomy, Deflemask noob here, I'm finding this all very helpful! When you say 'frames', are you referring to horizontal rows within the tracker itself, or do mean individual vertical sections within the instrument design macro? Or neither?


I refer to the horizontal rows within the tracker at 50 / 60 frames per second tracking speed. But I think those vertical sections in Deflemask instrument design macro works just like that too. Should work the same defining a 2 frame (or vertical section) hihat instrument with the first part silent and second part audible, for example.
  View user's profile Send private message Visit poster's website
  • Joined: 07 Sep 2013
  • Posts: 51
  • Location: Finland
Reply with quote
Post Posted: Tue Apr 28, 2020 10:44 am
Meidän Pieni Salaisuus (Our Little Secret). A slower moody piece.


Fallopian Tubes. Super hihat action.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13233
  • Location: London
Reply with quote
Post Posted: Tue Apr 28, 2020 10:50 am
Out of slightly biased interest, what software are you using for the oscilloscope view videos? It seems to desync a bit on the low notes. Also, the sound capture seems very clean - how are you achieving that? (Having said that, I only ever captured over RF back in the day - which may explain a lot.) Are you also avoiding the volume level squashing?
  View user's profile Send private message Visit poster's website
  • Joined: 07 Sep 2013
  • Posts: 51
  • Location: Finland
Reply with quote
Post Posted: Tue Apr 28, 2020 11:28 am
Maxim wrote
Out of slightly biased interest, what software are you using for the oscilloscope view videos? It seems to desync a bit on the low notes. Also, the sound capture seems very clean - how are you achieving that? (Having said that, I only ever captured over RF back in the day - which may explain a lot.) Are you also avoiding the volume level squashing?


I believe it's your program I'm using, SidWizPlus, hope it's OK?

You're right seems to be little bit of desync on low notes, but it's not too bad. Some of the "wandering" notes are because I use quick white noise to make a percussive start on all bass notes.

I record straight from the A/V Out using RCA cables. That's one thing people rarely mention, that the Master System has brilliant sound quality out of the box. It's crystal clear. Not like Mega Drive where the sound is so badly filtered that I can't believe it.

Not sure if you mean the faulty volume levels on some SMS models or the clipping of the sound waves due to too high volume levels? I can answer both. I use an old model 1 Master System which has the correct volume levels and make full use of the sound capabilities. On faulty systems the bassdrum, snare and some of the bassline wouldn't be as audible. You'd lose the power of the drums / bass.
Of course I also always take care that my recordings do not clip the waves.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13233
  • Location: London
Reply with quote
Post Posted: Tue Apr 28, 2020 12:53 pm
Happy my program is in use :) for the low frequency periodic noise you can increase the look ahead on the noise channel, you especially need this when frequencies go below the frame rate. This has the downside that it will show audio one frame early sometimes, but aesthetically I think it’s preferable.

I was referring to the system’s own clipping. I think especially when you have notes starting loud with a mid level sustain, you need the headroom, also as you say to boost the noise volume.
  View user's profile Send private message Visit poster's website
  • Joined: 07 Sep 2013
  • Posts: 51
  • Location: Finland
Reply with quote
Post Posted: Tue Apr 28, 2020 3:29 pm
Maxim wrote
Happy my program is in use :) for the low frequency periodic noise you can increase the look ahead on the noise channel, you especially need this when frequencies go below the frame rate.


Thanks Maxim! I uploaded another video with increased look ahead on the noise channel and it's great now.
  View user's profile Send private message Visit poster's website
  • Joined: 07 Sep 2013
  • Posts: 51
  • Location: Finland
Reply with quote
Post Posted: Sat May 16, 2020 7:32 pm
First Kiss. This is it. I gave everything I had on this track. There's so many different things going on at the same time that if I look at the tracker data I don't know what is what anymore.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Apr 2015
  • Posts: 65
Reply with quote
Post Posted: Thu May 21, 2020 4:53 pm
Wow, I'm listening to these on my nice 2.1 speakers and I can't believe the kick drums have so much thump! *holds my SMS on my shoulder like a boombox* Awesome work!
  View user's profile Send private message
  • Joined: 07 Sep 2013
  • Posts: 51
  • Location: Finland
Reply with quote
Post Posted: Fri May 22, 2020 3:57 am
Centrale wrote
*holds my SMS on my shoulder like a boombox*


Thanks Centrale, I love that. :)

Uploaded a new one, Ice-Cool Hero. Relentlessly happy and fast.
You might recognize this one from the Weka Invaders homebrew game.
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!