Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Apple » Apple II » Effective audio range?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Effective audio range? [message #367721] Tue, 15 May 2018 13:33 Go to next message
Anonymous
Karma:
Originally posted by: thomas.harte

From a purely programmatic point of view with a completely unrolled loop you could toggle the speaker once every three cycles for an output frequency around 340kHz.

With the heavy disclaimer that I'm very poor at electronics, in practice there's what looks to be a deliberate resistor-capacitor low-pass filter in R25 and C12 on the far side of Q4, even before considering the physical realities of a speaker and the analogue parts leading up to Q4.

Is there a generally-accepted frequency range that the internal speaker can produce?

I tried just messing about with some numbers in an emulation and a low-pass anywhere between about 6kHz and 15kHz seemed to satisfy the software I had, but I don't want to trust that extremely unscientific test and my ears alone, and didn't come up with a smart way to test which of the very low frequencies might be missing.
Effective audio range? [message #367723 is a reply to message #367721] Tue, 15 May 2018 15:12 Go to previous messageGo to next message
Michael AppleWin Debu is currently offline  Michael AppleWin Debu
Messages: 1262
Registered: March 2013
Karma: 0
Senior Member
Thomas,

I'm rather curious where you get 3 clock cycles from.
I thought STA $abs takes 4 clock cycles, no?

i.e.
STA $C030
STA $C030
STA $C030

According to my calculations 4 cycles is ~127,597.275 Hz

Where on the motherboard would one hook up an oscilloscope to measure / verify this ?

Cheers
Michael
Re: Effective audio range? [message #367724 is a reply to message #367723] Tue, 15 May 2018 16:31 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: thomas.harte

Oh, you're right. I mentally counted the cycles to read the instruction and forgot about the little matter of executing it; I also conflated switching rate and output frequency when I should have halved it. So add programming and mathematics to the list of things I am not very good at, alongside electronics.

I am mainly interested in whether the analogue side of things filters the audio luckily, so my error doesn't strongly affect my question.

While still also being an electronics dunce, I guess you'd attach an oscilloscope directly prior to the speaker, then try outputting at different frequencies until you get an actual signal.

Aside: I'm sure a demo coder could come up with an even faster toggle loop by executing from the speaker zone (I think I read it's partially decoded to cover all of c03x?) and relying on vapour lock and a loop specially-crafted to survive the discontinuity in addressing at the end of each line, but as 127 kHz wouldn't be audible to even if the speaker could produce it, I'm happy not to try to figure that one out.
Re: Effective audio range? [message #367777 is a reply to message #367721] Wed, 16 May 2018 03:32 Go to previous message
Michael J. Mahon is currently offline  Michael J. Mahon
Messages: 1770
Registered: October 2012
Karma: 0
Senior Member
<thomas.harte@gmail.com> wrote:
> From a purely programmatic point of view with a completely unrolled loop
> you could toggle the speaker once every three cycles for an output frequency around 340kHz.

Fastest is one toggle per 4 cycles, not 3, and the output squarewave is
half the toggle frequency.

> With the heavy disclaimer that I'm very poor at electronics, in practice
> there's what looks to be a deliberate resistor-capacitor low-pass filter
> in R25 and C12 on the far side of Q4, even before considering the
> physical realities of a speaker and the analogue parts leading up to Q4.

I’m not looking at the schematic you are, but if you mean the 75 Ohm -
0.1uF lowpass network, it has a very high frequency cutoff. It’s purpose is
to prevent oscillation because of the inductive voicecoil load. It has no
practical effect on speaker cone response, which has a much lower cutoff
frequency.

> Is there a generally-accepted frequency range that the internal speaker can produce?

It’s just a regular 3” speaker, so a typical frequency response would be a
few hundred hertz to a few tens of thousands—say 300 to 25,000 Hz.

> I tried just messing about with some numbers in an emulation and a
> low-pass anywhere between about 6kHz and 15kHz seemed to satisfy the
> software I had, but I don't want to trust that extremely unscientific
> test and my ears alone, and didn't come up with a smart way to test which
> of the very low frequencies might be missing.

It’s hard to measure speaker loudness, particularly at frequencies near our
ears’ cutoff. ;-)

And at low frequencies, it’s important to drive the speaker with a pure
sine wave, so harmonics don’t invalidate the test.

For reasonable Apple-oriented cases, the “typical” loudspeaker response
noted above is pretty accurate.

Some young ears can hear the 22kHz pulse rate of DAC522, though I certainly
can’t. ;-) And 22kHz is the highest practical PWM frequency for an Apple.
It allows 5-bit sample precision at an 11kHz sample rate.

If a PWM rate of 11kHz is not objectionable (say, because a good multipole
lowpass is to be used), then 6-bit precision is achievable.

There are a host of trade offs involved in any software DAC, but some
things to consider are number of bits of precision (1 cycle is the shortest
difference between two pulse widths, so 2^Nth cycles of pulse width
variability is needed for N-bit precision), sample rate (maximum
reproducible frequency, source material, time available for determining
next sample value), and PWM pulse rate (audibility or “filterability” of
the output versus time required to generate pulses).

In addition, the maximum speaker volume is limited to (the number of cycles
of pulse variability) divided by (the number of cycles between the start of
pulses). For DAC522, that’s 32/46. This is not a problem if an amplifier
or headphones are used, but it’s something to consider if the speaker is
used.

--
-michael - NadaNet 3.1 and AppleCrate II: http://michaeljmahon.com
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Thunderclock software for Apple Pascal 1.3
Next Topic: My Apple 2/Mac Retro Computing Blog
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Mon May 13 12:01:14 EDT 2024

Total time taken to generate the page: 0.01675 seconds