It is currently Sun Dec 17, 2017 1:10 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Megaman 2
PostPosted: Sat Oct 27, 2012 5:45 am 
Offline

Joined: Thu Aug 28, 2008 1:17 am
Posts: 591
Quote:
Will the 50% duty cycle square wave get fixed?

Could you actually hear it or did you look at the apu.asm file? Yeah, I had it at 37.5% instead of 50% for some odd reason. Chris, I'll post later today in reply to you (got run for now).


Top
 Profile  
 
 Post subject: Re: Megaman 2
PostPosted: Sat Oct 27, 2012 12:03 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3969
I clearly heard it when watching the video. I didn't look at any code.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
 Post subject: Re: Megaman 2
PostPosted: Sun Oct 28, 2012 4:18 pm 
Offline

Joined: Thu Aug 28, 2008 1:17 am
Posts: 591
Quote:
I clearly heard it when watching the video. I didn't look at any code.


Good ear :D



I'm completely re-writing the audio emulation code.

ccovell wrote:
Okay, since you posted on your blog about this too, Tomaitheous: Is there any way to eliminate the nasty popping on real PCE hardware when you write new waveforms into WSG RAM? The only thing that doesn't cause popping are waveforms that are 32 bytes of value $10. Even changing the volume registers on the PCE causes popping.


Depends. There are two audible clicks. One is caused by changing of the volume of the channel. The larger the difference, the large the 'pop'. The 'direction' of the pop is directly related to the direction of the volume change, if that makes sense. On the 6280a, this pop (at full volume change) is super tiny and shouldn't be audible unless nothing was playing and all you did was volume changes to channels (and even at that, it's hard to hear). I made a test rom that used a single channel on the 6280a as a 32byte buffer, and using the 7khz timer was able to play 50+khz sample playback without artifacts. But on the original 6280 there was a horrible buzzing sound from the popping of the volume reg. IIRC, clearing both the control bits in $804 also has the same effect as writing 0 to the volume bits. But changing to 10b or 01b or 11b does *not* do this. Thus you can immediately silence a channel by ORing #$c0 with the current volume level without popping artifact (and vice versa). Most 'instruments' start off with a fairly high attack rate in PCE games, so the pop isn't as noticeable since waveform output is accompanying it at the same time.

But changing a waveform mid 'note', gives both a pop related to the volume (assuming non 6280a revision) and a click like artifact because the waveform being updated it almost always out of sync (especially if you're trying to change the timbre over time. Changing the duty cycle of a square waves seem to have the least amount of audible click, for obvious reasons).

So anyway, to get away from the annoying volume pop issue of the original 6280 output - you need a pop in the opposite direction to cancel it out. Thus use two channels. Only one plays at a time, and you always update the alternate channel non playing channel. Turning off one channel cancels out turning on the other channel, though you need to do this part fairly close to each other (even though the volume state of a channel is only updated every 7khz or so). Of course this won't help any for the waveform 'morphing' and such, and is really only practical for outputting samples. But, you can gain back that additional channel for dual channel sample playback by interleaving the sample data in the 32byte buffer (or more, if you want more channels) - but that does have the effect of halving/dividing your sample playback rate.

The SuperGrafx has the 6280a (all of them do AFAIK). And it's been reported that all Core Grafx model 1's have the 6280a as well (makes sense, they were released at the same time). But AFAIK no other models of the PCE/TG/Duo have this chip (not the original Duo nor the later model R/RX). Can't say for the different model handhelds though.


Top
 Profile  
 
 Post subject: Re: Megaman 2
PostPosted: Mon Oct 29, 2012 7:55 am 
Offline

Joined: Sun Mar 19, 2006 9:44 pm
Posts: 924
Location: Japan
Thanks for the help. I knew about these limitations already... changing the volume makes the channels pop and so does uploading the waveform... Guess there's no instant way of switching waves on a per-channel basis without some artifacts, is there?

_________________
http://www.chrismcovell.com


Top
 Profile  
 
 Post subject: Re: Megaman 2
PostPosted: Mon Oct 29, 2012 8:42 am 
Offline

Joined: Thu Aug 28, 2008 1:17 am
Posts: 591
ccovell wrote:
Thanks for the help. I knew about these limitations already... changing the volume makes the channels pop and so does uploading the waveform... Guess there's no instant way of switching waves on a per-channel basis without some artifacts, is there?


Yeah, sadly there really isn't. They were so close to having hardware support for Wavetable Synthesis (a limited version of PPG synth), if you could just read the damn waveform pointer position :/

That said, there is a few other things you can do. I did a test rom of hard sync synth effect. I used the TIMER interrupt as the frequency generator for the note, and the channel's period as the 'timbre'. I use a fixed point 16bit counter that when overflows, resets the channel's waveform pointer. The nice thing is that you can do this without any volume related pops. The downside is that 7khz is kind of a low resolution and thus you get a dirty aliasing type of output. But the effect is cool. The resource is closer to that of playing a sample, so... might as well just play samples instead and get a superior sound.

I had a few other ideas of how to make waveform/timbre changing using the 7khz timer and the work, but they have the same aliasing effects because of the low resolution divider (timer interrupt).

You can corrupt the waveform in the channel over time. A few PCE games do this. But the effect is hard to control on a note basis. That is to say, it's hard to get a consistent timbre sounding change for all range of notes. The effect works because you can write to the waveform data port while the channel is playing and it will replace that current sample being pointed to by the waveform playback pointer (it appears to be a shared pointer for writing as well). I did the opposite effect of this and used the channel to add feedback type effects when playing samples at 7khz that would normally be via DDA. I just set the frequency of the channel to something close to the 7khz range.

I did a bloodywolf waveform morph emulator (a test rom) based on what BW does for the 'yeaaahhhh' sound effect. The low frequency of the channel for that effect helps hide some of the artifacts. That and the waveforms are rather 'busy' sounding, so that also helps hide the artifacts.
Here's some examples:
http://www.pcedev.net/audio/bloodywolf/BW_test1.mp3
http://www.pcedev.net/audio/bloodywolf/BW_test2.mp3
http://www.pcedev.net/audio/bloodywolf/BW_test3.mp3

I think waveform updating (on a 60hz counter/divider) would still be decent for sound FX though (artifacts be damned).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group