Date : Sat, 22 May 2004 13:33:31 GMT
From : "Thomas Harte " <thomasharte@...>
Subject: Re: [Electron] sound wave
--=_NextPart_Lycos_0272181085232811_ID
> The trick there, since you have no control over amplitude, is to
> understand how the waveform works. When you set it to a really high
> frequency, you have it moving so fast between off and on at equal time
> periods that it "sounds" to be exactly halfway between.
My understanding from the very low level Fourier analysis of sound waves
I've done was that what happens is
the high frequency sound wave is inaudible so the sound is simply off. But
then I guess one static position is the
same as another, right?
> To get that
> "hafl point" to move, you need to spend more time in one state than the
> other. For example, for three-quarters volume, out of you need to be
> spending three times more time in the on state than the off state. The
> equation works inversely and has a subtle offset. Since 3 quarters is 3
> times as much as one quarter, then the time period multiplier is three.
> when the two are added together it makes a whole cycle.
So you're implying that the human ear does something skin to an inverted
box sample in this scenario?
In the emulator to date I've simply been throwing away the carrier and sampling
the modulator at whatever
sampling rate the emulator finds itself running at. This I'm looking to improve.
I'm downloading "The Scientist
and Engineer's Guide to Digital Signal Processing" right now - no doubt that'll
have some answers if I can find
time to properly read it.
Back in the realm of anecdotal advice, I've been told to look at 'IIR' and
'FIR'. No doubt once I've read enough to
know what those are I'll understand more thoroughly.
> I would imagine this is how the Electron manages it, with an interrupt
> handler swapping frequencies at the precise moment to change the
> relative on/off periods. Given the timing requirements, I would suggest
> the frequency has been lowered to make the sound easier to accomplish in
> a normal 6502 timeframe.
It can't be interrupts because the Electron doesn't have any interrupting
hardware with a frequency greater
than 50Hz, and even if you take all the interrupting sources together you're
really only able to get 100Hz. But I
get the point. Exile is a RAM routine accessing the ULA, so we're talking
1Mhz execution across the board,
therefore I guess you're in the realm of, at best speedwise, something like:
lda #immediate
sta <ULA location>
loop unrolled. Which is 7 cycles - giving something just below 143 khz. But
it's five bytes so certainly isn't going
to be the rate the 1.88 second Exile loading sample is stored at. I must
get the debugger finished in my
emulator so I can find things like the actual sampling rate here quite easily.
By the way, I posted this earlier but it doesn't seem to have appeared (I
probably replyed to majordomo or
something) - I uploaded the Exile sample as output by the emulator to
http://electrem.emuunlim.com/files/exilewav.zip (it's < 2kb).
-Thomas
SIZE does matter - The UK's biggest *Free* Web based mail - 10 MB Free
mail.lycos.co.uk
--=_NextPart_Lycos_0272181085232811_ID--