Digisound on PSG (YM2149)
Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team
Digisound on PSG (YM2149)
Hi Folks!
Shame on me - ok. I really have no idea how to play an 8bit digisound sample on the PSG. All i found on the net is to combine all 3 PSG channels to reach a better sound than 4bit digisound on 1 channel. (Because the Volume Register of any channel is 4bit)
Well, i just want to understand the basics to be able to play digisound. I know already, that a digisound is definded by its resolution in bits and the replay rate in KHz. That's clear so far. But i don't know how to interprete the values of a digisound value - means: on a 8bit sample there are values like 0 (zero) that means silence - but there are positive and negative values up to 128 - ok, a greater value is a greater sound, but what is the difference between negative and positive values ?!??
If anybody knows - how to setup the PSG - and like to share this information -- please, help me.
signed off,
mr.coke
Shame on me - ok. I really have no idea how to play an 8bit digisound sample on the PSG. All i found on the net is to combine all 3 PSG channels to reach a better sound than 4bit digisound on 1 channel. (Because the Volume Register of any channel is 4bit)
Well, i just want to understand the basics to be able to play digisound. I know already, that a digisound is definded by its resolution in bits and the replay rate in KHz. That's clear so far. But i don't know how to interprete the values of a digisound value - means: on a 8bit sample there are values like 0 (zero) that means silence - but there are positive and negative values up to 128 - ok, a greater value is a greater sound, but what is the difference between negative and positive values ?!??
If anybody knows - how to setup the PSG - and like to share this information -- please, help me.
signed off,
mr.coke
- Mug UK
- Administrator
- Posts: 11560
- Joined: Thu Apr 29, 2004 7:16 pm
- Location: Stockport (UK)
- Contact:
Re: Digisound on PSG (YM2149)
Loads of code on this thread including sample playback - http://www.atari-forum.com/viewtopic.php?f=16&t=15021
More info on this page - http://www.atari-forum.com/viewtopic.php?f=68&t=15666
More info on this page - http://www.atari-forum.com/viewtopic.php?f=68&t=15666
My main site: http://www.mug-uk.co.uk - slowly digging up the bits from my past (and re-working a few): Atari ST, Sega 8-bit (game hacks) and NDS (Music ripping guide).
I develop a free Word (for Windows) add-in that's available for Word 2007 upwards. It's a fix-it toolbox that will allow power Word users to fix document errors. You can find it at: http://www.mikestoolbox.co.uk
I develop a free Word (for Windows) add-in that's available for Word 2007 upwards. It's a fix-it toolbox that will allow power Word users to fix document errors. You can find it at: http://www.mikestoolbox.co.uk
Re: Digisound on PSG (YM2149)
Hi Muguk...Muguk wrote:Loads of code on this thread including sample playback - http://www.atari-forum.com/viewtopic.php?f=16&t=15021
More info on this page - http://www.atari-forum.com/viewtopic.php?f=68&t=15666
Thanks a lot for your reply...
The "Playing MODs and multi samples" thread i found already. This thread don't answer my questions, cause i don't want to mix multiple samples.
The "playsam.zip" source in the "Ronalds A. Sources will appear here! Alot!!" thread is still interesting for me, but this is just a code snippet -- please don't understand me ... i don't want to rip a code snippet - i simply want to understand how that stuff works.
however, thank you for the hints...
i'm just seraching...

mr.coke
- Mug UK
- Administrator
- Posts: 11560
- Joined: Thu Apr 29, 2004 7:16 pm
- Location: Stockport (UK)
- Contact:
Re: Digisound on PSG (YM2149)
No probs .. just did a quick search on 'samples' and linked to the ones I thought might be useful. There's plenty of old school coders on here who might be able to help you though 

My main site: http://www.mug-uk.co.uk - slowly digging up the bits from my past (and re-working a few): Atari ST, Sega 8-bit (game hacks) and NDS (Music ripping guide).
I develop a free Word (for Windows) add-in that's available for Word 2007 upwards. It's a fix-it toolbox that will allow power Word users to fix document errors. You can find it at: http://www.mikestoolbox.co.uk
I develop a free Word (for Windows) add-in that's available for Word 2007 upwards. It's a fix-it toolbox that will allow power Word users to fix document errors. You can find it at: http://www.mikestoolbox.co.uk
Re: Digisound on PSG (YM2149)
There's no real difference in signed/unsigned, it's just a convention, ultimately to be played on the PSG the value is always translated to a positive ( or 0 ) volume ( obtained by setting various combinations of the 4 bit volumes for the 3 channels ).mrcoke wrote: Well, i just want to understand the basics to be able to play digisound. I know already, that a digisound is definded by its resolution in bits and the replay rate in KHz. That's clear so far. But i don't know how to interprete the values of a digisound value - means: on a 8bit sample there are values like 0 (zero) that means silence - but there are positive and negative values up to 128 - ok, a greater value is a greater sound, but what is the difference between negative and positive values ?!??
Aside: 0 can be silence, but note, any value will be silent if it is continuous and unchanging. It's the change in volume & the frequencies that makes the sound.
Cheers,
oberje
Re: Digisound on PSG (YM2149)
Ahh - ok ?! A few a good hints - thanks very much!oberje wrote:There's no real difference in signed/unsigned, it's just a convention, ultimately to be played on the PSG the value is always translated to a positive ( or 0 ) volume ( obtained by setting various combinations of the 4 bit volumes for the 3 channels ).
Aside: 0 can be silence, but note, any value will be silent if it is continuous and unchanging. It's the change in volume & the frequencies that makes the sound.
Cheers,
oberje
I still have a problem with the volume controlling. There are 3 channels with 4 bit volume, but i guess - a volume level 123 (ABC) is as loud as 321 (ABC) - so there are only 46 different volumes combining the 3 channels? Or is the trick to mix the volume with tone and/or noise - maybe a higher tone sounds louder than a lower tone? =)
mr.coke
Re: Digisound on PSG (YM2149)
You might want to check out this link: http://map.grauw.nl/articles/psg_sample.phpmrcoke wrote:Ahh - ok ?! A few a good hints - thanks very much!
mr.coke
Cheers,
oberje
- unseenmenace
- Atari God
- Posts: 1970
- Joined: Tue Sep 21, 2004 9:33 pm
- Location: Margate, Kent, UK
- Contact:
Re: Digisound on PSG (YM2149)
Attached is a sample (unsigned I believe) to YM register lookup table and example code someone sent me, sorry I forget who 

You do not have the required permissions to view the files attached to this post.
UNSEEN MENACE
Several STFM's, 4MB STE, 2MB TT with 1.2GB Hard Drive and 14MB Falcon with 540MB Hard Drive,
Lynx 2 and Jaguar with JagCD
Member of GamebaseST and AtariLegend team
Check out my website at http://unseenmenace.110mb.com
Several STFM's, 4MB STE, 2MB TT with 1.2GB Hard Drive and 14MB Falcon with 540MB Hard Drive,
Lynx 2 and Jaguar with JagCD
Member of GamebaseST and AtariLegend team
Check out my website at http://unseenmenace.110mb.com
- bod/STAX
- Atari Super Hero
- Posts: 508
- Joined: Wed Nov 24, 2004 8:13 pm
- Location: Halesowen, West Midlands, England
Re: Digisound on PSG (YM2149)
Sorry, I can never remember which is which when it comes to signed samples and unsigned samples.
But if you have a sample that contains the values -127 to +128 then you just add 128 ($80) to all the bytes
of the sample thus giving you values from 0 to 255. These values then can be an offset into a sound table
that contains all sound that can be played through the soundchip.
Click this link and scroll down to where I've uploaded the source code to the Lost Boys Megabang demo.
You'll see that it replays samples at various speeds using the above method (the sample already has 128 ($80)
added to it).
http://atari-forum.com/viewtopic.php?f= ... ng#p127044
But if you have a sample that contains the values -127 to +128 then you just add 128 ($80) to all the bytes
of the sample thus giving you values from 0 to 255. These values then can be an offset into a sound table
that contains all sound that can be played through the soundchip.
Click this link and scroll down to where I've uploaded the source code to the Lost Boys Megabang demo.
You'll see that it replays samples at various speeds using the above method (the sample already has 128 ($80)
added to it).
http://atari-forum.com/viewtopic.php?f= ... ng#p127044
So let it be written, So let it be done. I'm sent here by the chosen one.
Re: Digisound on PSG (YM2149)
You can make signed form unsigned by flipping the MSB but you can also switch lower half and upper half from the sample look-up table converting the table from signed samples to unsigned samples and back.bod/STAX wrote:Sorry, I can never remember which is which when it comes to signed samples and unsigned samples.
But if you have a sample that contains the values -127 to +128 then you just add 128 ($80) to all the bytes
of the sample thus giving you values from 0 to 255. These values then can be an offset into a sound table
that contains all sound that can be played through the soundchip.
Click this link and scroll down to where I've uploaded the source code to the Lost Boys Megabang demo.
You'll see that it replays samples at various speeds using the above method (the sample already has 128 ($80)
added to it).
Hans Wessels