Page 1 of 2

PSG make triangle wave twice as loud

Posted: Thu Aug 05, 2021 11:05 am
by kliepatsch

During experimentation with the PSG (and recently in conjunction with the YM2151) I have found that the volume of the triangle waves is annoyingly low. Often, everything else needs to be turned down in volume because the triangle wave is already at max volume but barely noticeable.

I understand that the volume of the PSG must be limited in some way to prevent digital clipping.

But I think the advantages of having a louder triangle wave would outweigh the increased clipping risk by a lot.

Therefore I suggest left shifting the triangle waveform once.

Edit: I know the design of the VERA is pretty much fixed. I am suggesting this because I think it is just a minor tweak to the overall design, and wouldn't invalidate any specifications.


PSG make triangle wave twice as loud

Posted: Thu Aug 05, 2021 3:37 pm
by ZeroByte

Well, do keep in mind that we've only got the output of an emulator to base this on. Triangles are naturally quieter than other waveforms - it's possible that the real VERA may compensate for this but the emu does not. If the emu's approach to generating the triangle wave and mixing it into the output stream is not accurate to the real HW, there's no way to know that w/o having the real McCoy in hand.

 


PSG make triangle wave twice as loud

Posted: Thu Aug 05, 2021 5:08 pm
by SlithyMatt

It may not be possible to have a louder triangle wave without clipping, and then it's not really a triangle wave. A max volume square or sawtooth wave is going to be VERY loud, so the answer may just be to ease off on the PSG volume for them. Of course, we will also have to see what this means for mixing the other sound sources.


PSG make triangle wave twice as loud

Posted: Thu Aug 05, 2021 5:12 pm
by ZeroByte

Somewhere in some post or video, Kevin made a brief allusion to what chip it is that he's using to mix the outputs. I think maybe in the video about the SAAYM card? Hmmmm.....


PSG make triangle wave twice as loud

Posted: Thu Aug 05, 2021 7:44 pm
by kliepatsch

Thank you for the thoughts on this. I would like to comment.

It is true that, since we do not know how the VERA operates internally, if it is indeed as easy as I imagine.

From what I can tell, the PSG appears overall very quiet to me, such as to have a LOT of headroom and prevent clipping. A quick test I did earlier today confirmed this, where I added 16 triangle waves all at different frequencies and max volume: no sign of clipping at all. The output wasn't even "loud". From what I can tell --- I know I might be wrong --- but it seems there is more headroom.

And if the output of the VERA has more headroom, it should not be wasted, IMHO. And a good way to put it to use is to make louder triangle waves.


PSG make triangle wave twice as loud

Posted: Thu Aug 05, 2021 7:57 pm
by kliepatsch


4 hours ago, ZeroByte said:




Well, do keep in mind that we've only got the output of an emulator to base this on. Triangles are naturally quieter than other waveforms - it's possible that the real VERA may compensate for this but the emu does not. If the emu's approach to generating the triangle wave and mixing it into the output stream is not accurate to the real HW, there's no way to know that w/o having the real McCoy in hand.



And yes, my request is based on the assumption that the relative levels between PSG waveforms are the same in the emulator as in the FPGA. Since the waveform generation is all-digital in the FPGA, I would be surprised if they were different, but of course, I would welcome any difference in that regard.

Sorry if I sound a little grumpy ... the request is just the result of a long process.


PSG make triangle wave twice as loud

Posted: Thu Aug 05, 2021 7:58 pm
by ZeroByte

Both the official emu and box16 currently use a "naive" approach to mixing audio:  Output = ( YM + PSG + PCM) / 3



That's why it's so quiet. It's essentially reduced to 1/3 volume.


PSG make triangle wave twice as loud

Posted: Thu Aug 05, 2021 8:03 pm
by kliepatsch


4 minutes ago, ZeroByte said:




Both the official emu and box16 currently use a "naive" approach to mixing audio:  Output = ( YM + PSG + PCM) / 3



That's why it's so quiet. It's essentially reduced to 1/3 volume.



Thanks, that may explain why the PSG is overall relatively quiet.


PSG make triangle wave twice as loud

Posted: Thu Aug 05, 2021 8:06 pm
by ZeroByte

I've considered making a PR to box16 with an algorithm I've seen on the web that kind of does a kind of poor man's dynamic range compression. I would also submit to official x16-emu, but that project just seems to be languishing, at least as far as publicly-visible activity is concerned. (For all we know, Steil has tons of work done behind the scenes and just hasn't pushed his changes to the repo)

In any case, this only fixes the relative levels of the 3 sound sources in the final mix. Making triangle louder relative to the other PSG waveforms would require internal changes to VERA. I strongly suspect that you're right in your guess that internally, it's just generating "PCM" from simple oscillators that are being mixed digitally. I also suspect that the PCM and PSG come out of VERA pre-mixed, and thus in reality, it's just a 2-source final mix to combine these outputs. But I haven't seen any material from Kevin or anyone on the real HW development side of things to know. It's just a guess.


PSG make triangle wave twice as loud

Posted: Fri Aug 06, 2021 11:30 pm
by Snickers11001001


On 8/5/2021 at 2:06 PM, ZeroByte said:




but that project just seems to be languishing, at least as far as publicly-visible activity is concerned. (For all we know, Steil has tons of work done behind the scenes and just hasn't pushed his changes to the repo)



One of the worst things about this cursed 'human malware' thing is that I continuously find myself actually having anxiety about whether complete strangers have become ill or worse based on a lull in their public-facing development repositories and message board posts.    Thankfully, Michael Steil has a habit of at least logging in here periodically (which you can see on his member page) which is a help and at least keeps my apparent "overconcerned grandparent" DNA in check!   

Of course everyone's got jobs and life throws things at you, so lulls in activity are common in any project.    As to X16, I would guess that's not quite what's up.  Right now, the team would not task Michael (and I doubt he would he agree) with doing a bunch of ROM/KERNAL/EMU mods while there's a new proto being wrung out.    As they fiddle with hardware and put it through its paces, its best keep the ROMs at a 'constant' just to reduce the number of 'variables' at play if something's going wonky, and only fiddle with the ROMS if process of elimination clearly sows an issue cannot be isolated to hardware and it is discovered something in the system software is causing a hang race condition or whatever.   And don't doubt it:  There are clearly _some_ troubles just from the number of bodge wires visible on the Petscii Robots Proto3 video back in July, and I think I also saw a mention by SlithyMatt about one of his programs being used in connection with chasing down some difficulties.   This is the cycle and just how it works.   I don't want anyone reading this to think "oh, woe is me"  -- just go watch some of Bill Herd's videos about last minute bodges and other extreme mods to hardware in hotel rooms the night before Consumer Electronics Show debuts of various machines he worked on at Commodore back in the day!     

So I don't worry too much about lack of activity on the repo at the moment.   Its just smart management of resources.    That said, I do wish that unless there's something particularly known that will require an enormous change in the ROMS tied to hardware stuff on Proto 3 that they would just go ahead and get R39 out there officially.   I've got a couple projects on pause waiting for that and suspect I'm not alone in that.