DZ-Jay Posted January 7, 2017 Author Share Posted January 7, 2017 Another issue that affects the phase: volumes in the AY8910 are positive, but the coefficients from the above algorithm can be negative. This corresponds to the fact that the channel with negative coefficient has to be delayed of half period. Aha! So if we can't get control over the phases, that is pretty much out the window. Gotcha. Quote Link to comment Share on other sites More sharing options...
artrag Posted January 7, 2017 Share Posted January 7, 2017 (edited) Well my voice encoder works fine even without phase control on ay8910, so maybe you can get something acceptable for music also with this restriction. Just use the absolute values of the coefficients as I do for voice. The result on ay8910 is this Edited January 7, 2017 by artrag Quote Link to comment Share on other sites More sharing options...
DZ-Jay Posted January 7, 2017 Author Share Posted January 7, 2017 Well my voice encoder works fine even without phase control on ay8910, so maybe you can get something acceptable for music also with this restriction. Just use the absolute values of the coefficients as I do for voice. The result on ay8910 is this Hmm... sounds very interesting as a sound effect, but unfortunately it's not very intelligible. If the words weren't written in the video description or you hadn't told me to expect voice, I wouldn't have realized what it was. But that's when playing concurrent with music and other sound effects. Perhaps on its own it'll be better, though it needs some additional cues to be understandable. -dZ. Quote Link to comment Share on other sites More sharing options...
artrag Posted January 7, 2017 Share Posted January 7, 2017 (edited) More than phase, it counts the number of channels used This other test uses psg+scc = 3+5 channels Actually the scc channels are producing pure tones, but the psg is playing the 3 strongest frequencies This is a later and sligthly improved version of the PSG only Edited January 7, 2017 by artrag 1 Quote Link to comment Share on other sites More sharing options...
DZ-Jay Posted January 8, 2017 Author Share Posted January 8, 2017 More than phase, it counts the number of channels used This other test uses psg+scc = 3+5 channels Actually the scc channels are producing pure tones, but the psg is playing the 3 strongest frequencies This is a later and sligthly improved version of the PSG only The first on sounds fantastic! Very well done. The second one is sort of muddled and hard to tell there are samples. I think it's because the strange texture of the samples mixes a bit with the sound effects and music and makes it less intelligible. Anyway, that's great work. Quote Link to comment Share on other sites More sharing options...
+nanochess Posted January 8, 2017 Share Posted January 8, 2017 Aha! So if we can't get control over the phases, that is pretty much out the window. Gotcha. I've been thinking that I can get control of the phases of the PSG, my trick would be to setup a very high frequency like (thinking in IntyBASIC): SOUND 0,1,0 SOUND 1,1,0 SOUND 2.1,0 WAIT Now the phases should be synchronized. Then the experiment would be mostly empiric. SOUND 0,256,15 SOUND 1,255,15 SOUND 2,254,15 This sounds different when in phase or not in phase? Nothing tested, just ideas in the air Quote Link to comment Share on other sites More sharing options...
DZ-Jay Posted January 8, 2017 Author Share Posted January 8, 2017 I've been thinking that I can get control of the phases of the PSG, my trick would be to setup a very high frequency like (thinking in IntyBASIC): SOUND 0,1,0 SOUND 1,1,0 SOUND 2.1,0 WAIT Now the phases should be synchronized. Then the experiment would be mostly empiric. SOUND 0,256,15 SOUND 1,255,15 SOUND 2,254,15 This sounds different when in phase or not in phase? Nothing tested, just ideas in the air That's like what we were talking about, setting the division counters. However, setting them to the same value may not work because you cannot do so on a single clock transition. -dZ. Quote Link to comment Share on other sites More sharing options...
artrag Posted January 8, 2017 Share Posted January 8, 2017 @nanochess I've been trying to understand how phase works in the AY8910 from the implementation in various emulators to get an idea of the real thing. It seems (to me) that openmsx resets the inner counter of each channel if the period is set to 0 or 1 and locks the output to 0. Bluemsx does not reset the phase under the same conditions. I do not have access to sources of Meisei, so I cannot tell what it does. I'm trying to do some test code in assembler and see the result in Audacity, but for now, I do not get useful results. The idea should be something like this: SOUND 0,1,0 SOUND 1,1,0 SOUND 0,256,15 wait exactly 256/2/223.721,56 seconds SOUND 1,256,15 If the phase is reset, now the two square waves should be in perfect opposition and should cancel each other. If the phase is not affected the two waves will add randomly. 1 Quote Link to comment Share on other sites More sharing options...
+nanochess Posted January 8, 2017 Share Posted January 8, 2017 That's a better experiment. We would need to test in real hardware and with an oscilloscope in order to make emulators more perfect. BTW, there are volume tables for Atari ST or Amstrad (I don't remember right now) that show how volumes add when enabling more than 1 channel. Quote Link to comment Share on other sites More sharing options...
artrag Posted January 8, 2017 Share Posted January 8, 2017 (edited) Sure, volumes of the channels add, it is used also on msx for playing pcm samples http://map.grauw.nl/articles/psg_sample.php but in that case, the period is set to 0/1 and the volumes are set by the cpu at the sampling rate of the pcm signal. Here, if the phase of the square waves could be controlled, one could approximate a generic wave using additive synthesis leaving the cpu (almost) free . Edited January 8, 2017 by artrag Quote Link to comment Share on other sites More sharing options...
artrag Posted January 12, 2017 Share Posted January 12, 2017 Errata corrige. The trick above works only setting off the tone in r7. Period=0/1 does not stop the output that simply appears muted because out of audible band. It seems that there is no way to control phases. Quote Link to comment Share on other sites More sharing options...
DZ-Jay Posted January 13, 2017 Author Share Posted January 13, 2017 Here's a response to the question of controlling the channel phases from Joe Z. on the INVPROG mailing list: Hi, there, There's a discussion going on in the AtariAge Intellivision Programming forum on how to manipulate the PSG to produce different sound waves. One outstanding question is whether there is a way to synchronize the phases of the PSG channels. If perhaps not synchronize, is there at least a way to control the phase of each channel? Regards, -dZ. Yes and no. Mostly no. It appears there are two different PSG flavors out there. One is a down-count and reload variant (the older one), and the other is an up-count-and-compare variant. That impacts what I'm about to describe. I'm pretty certain there is some hidden state (a toggle) that is neither visible to nor accessible by the programmer. The first step is to get the counters for the channels aligned. If you set the channels to a really short period such as '1', eventually all of the counters will expire and start going 0, 1, 0, 1. How quickly this happens depends on whether the PSG is down-count-reload or up-count-compare. Down-count-reload needs to wait for the current counts to expire. Up-count-compare will flip immediately. Either way, they should all end up being within a count of 1 from each other. The next step is more problematic: You don't know if the output from each channel is binary 0 or 1. So far as I can tell, each time the count expires, it toggles the output between 0 and 1. So once you get your counts aligned, you can control whether the channels toggle together. You can't really control whether they're in phase or 180 degrees out of phase with register writes, if I'm not mistaken. 1 Quote Link to comment Share on other sites More sharing options...
artrag Posted January 13, 2017 Share Posted January 13, 2017 It seems that with period=0/1 the psg keeps toggling at 110Hz (if the input is 220KHz), so there's no way to control the phase Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.