CompuServe Thread

#Audio.device

7 messages in this thread
#65408From: Richard Rae/SYSOPSep 11, 1989 11:38 PM
55 hertz sounds suspicious; wait a second… <figuring madly>… okay, maybe I have it. To control the pitch of the output signal, you change the value in the period register for the channel you're using. The range is from 124 to 65535, and the resulting period is period_register/3579545. Plugging in the largest possible value gives us 0.0183, which translates to "54.6 Hz". Is this the 55 Hz you're coming up with? What you have to remember is that this is the period BETWEEN TWO SAMPLES, and that multiple samples are required to define a cycle. For example, if the simplest waveform you can create (in this context) is a square wave: one point high, one point low. This takes TWO samples to define one cycle, which means TWO periods, or 27.3 Hz with a period_register of 65535. More typically, you'd have a larger power of two in your wave table; for example, if you had a sine wave define by 16 points, your minimum frequency would be 3.4 Hz! Be aware, however, that the audio output of the Amiga is NOT DC coupled, and therefore IS limited as to the lowest frequency you can reproduce. The amplitude will start rolling off as you approach the lower limit; I don't know if this is important to your application or not. You might want to check the Hardware Reference Manual for a more detailed explanation; pages 140-143 contain the meat of this discussion. And, of course, you're welcome to ask for further clarification here. Writing a sweep generator to verify your speaker response graphs, are you?
#65473From: Sylvain DufordSep 12, 1989 11:00 AM
Thanks a lot Richard, this cleared things up quite a bit. You are right, I was coming up with that 54.6 Hertz, not taking the sample length into account. However, doing it with a 2 point didn't sound like 27 Hz to me, but I may be wrong, I'll try again with a longer sample. You almost guessed right, the 'find parameters' section of my program requires the user to have a frequency generator, and not every hobbyist has one of those, so I tought the Amiga could replace one…
#65699From: Richard Rae/SYSOPSep 13, 1989 10:28 PM
I expect the Amiga can do an excellent job of replacing a chirp generator as long as a pure signal isn't needed; for approximate frequency response plotting, it should work fine. I needed some gross thumbnail response graphs a few months ago and hacked up a quick BASIC program to generate a frequency sweep and a synchronizing signal. It was slow as molassas, but it worked just fine. Your two point waveform probably didn't sound like 27 Hz because you weren't HEARING 27 Hz. Remember, as I mentioned, that the Amiga's outputs are not DC coupled, so the fundamental of your waveform might have been rolled off a bit. A two-point waveform is a square wave by definition, so the next harmonic would be the third, at about 82 Hz. If this (and the higher) harmonic is at approximately the same level, or higher, than the fundamental, your ear can be fooled into hearing a harmonic as the fundamental. If you can get your hands on a scope, try the experiment again and see what the period of that two-point waveform is. If you find out the resulting frequency ISN'T 27 Hzish, please let me know, as I'd like to keep on top of this… and certainly don't want to be giving out false information. Good luck with the project! Yell if I can help with anything; your speaker tool is an excellent piece of work, and I'd be honored to assist. Rick
#65737From: Sylvain DufordSep 14, 1989 12:05 AM
Thanks Richard, I appreciate your comments/help. I'll experiment a little more and let you know if I find anything weird. I just ordered a ROM Kernel reference and a Hardware Reference manuals, hopefully these will help me in my constant quest for Amiga Knowledge! *** SLY *** Edmonton, Alberta
#65474From: Sylvain DufordSep 12, 1989 11:00 AM
Well, I just tried it Richard, and it works! Thanks a lot. Now for the next problem, how can I turn off the low pass filter for better high frequencies like the LED program does?
#65700From: Richard Rae/SYSOPSep 13, 1989 10:28 PM
Easy as pie, Sylvain. If you have, or can get your hands on, a copy of Amazing Computing V3N3, you'll find a simple C program in my column which does just that. If you need verbatim code, let me know. Basically, the only thing you need to do is flip the state of the LED bit in the ciaa. In C systems, all the equates one needs are in the cia.h include file. The way I did it was to grab the state of ciaa.ciaddra (the DDR status), OR ciaa.ciaddra with CIAF_LED bit (which makes the LED pin an output; it should already be one, but just in case…), XOR ciaa.ciapra with CIAF_LED (which flips the state of the LED pin), then restore the saved ciaa.ciaddra value. I expect you should be able to find these or similar equates in your compiler's files. Remember, though, that switching out the reconstruction filter like this opens you up to problems with aliasing, which could be particularly nasty in a sweep generator. Be sure to have as many sample points as possible per waveform cycle; this will move the aliased frequencies farther away from the point of interest. Rick
#65738From: Sylvain DufordSep 14, 1989 12:05 AM
Thanks again Rick, gee I didn't realise you actually WROTE LED!!! I do have a copy of AC V3N3, so I'll look it up. I realise that turning the filter off will cause other problems but it shouldn't be too bad for my application. Thanks again! (I love CIS) *** SLY *** Edmonton, Alberta