So, I have a crude little driver to play with.  It certainly makes noise!

Load SND3.DO and SND3.CO into M100/T102.
convert to SND3.BA
Run SND3.BA

1 REM sound3 - needs snd3.co in files.
2 REM snd3.co loads in ALTLCD
3 REM this is a demonstration program for the 3 voice audio driver
4 REM S. Adolph April 2022

SND3.CO
-------------

SND3.CO is the audio driver code, which resides in ALTLCD. Assembly
included.

11 REM enable driver - call 64704
12 REM disable driver - call 64707
13 REM tone mask timer PB2 - 0-30 @ 64710, 0=off, 30=on
14 REM direct drive timer PB5 - 0-30 @ 64711, 0=off, 30=on
15 REM tone bytes 0-255 @ 64712, 0-63 @ 64713

Three parameters control the sound you hear.

 The raw sound tone is set by two bytes stored at 64712.

PB2 controls if the sound wave is passed to the buzzer.
This driver uses a counter to decide when to toggle PB2.  Counting is done
on the timer pulse 2048 times/sec.
The counter value is set in 64710.  A value of 0 pins PB2 to off, killing
the sound wave.  A value of 30 pins PB2 to 1 enabling the sound wave.
For other values, PB2 is toggled at a rate based on 2-28,  smaller = faster.

PB5 directly drives the buzzer.
This driver uses a counter to decide when to toggle PB5.  Counting is done
on the timer pulse 2048 times/sec.
The counter value is set in 64711.  A value of 0 pins PB5 to off.  A value
of 30 pins PB5 to 1 enabling the sound wave.
For other values, PB5 is toggled at a rate based on 2-28,  smaller = faster.

When PB5 is 0, audio from the combination of PB2 and the sound wave is
passed to the buzzer.
When PB5 is 1, audio from the combination of PB2 and the sound wave not
passed to the buzzer.

So, you can make some complicated modulations that superimpose on the main
tone.

installing the driver sets up the audio, and turns up the timer to 2048hz.
de-installing the driver returns things to normal.



SND3.DO
-------------

SND3.DO is a demo that drives the audio driver.

What this demo does:

It first installs the driver.  Q exits and de-installs the driver,
returning the laptop to normal.

110 PRINT@0,"AUDIO DRIVER DEMO!!"
111 PRINT@40,"Q=quit, E/D = up down on tone"
112 PRINT@80,"U/J = up down on PB2"
113 PRINT@120,"I/K = up down on PB5"
114 PRINT@160,"ALL CAPS!!"

Then using E/D you can raise or lower the tone of the sound wave.
Using U/J you can roll the PB2 counter (delay) value through 0 (off) 2-28
or 30(on).
Using I/K you can roll the PB5 counter (delay) value through 0 (off) 2-28
or 30(on).

by playing around with these three controls you can make some novel noises
for sure.


One potential use is to have a sequence of values that get sequentially
poked into the driver to make a semi continuous variable noise with these 3
inputs.


Anyhow comments welcome! give it a try!

steve

On Wed, Apr 6, 2022 at 10:02 PM Stephen Adolph <[email protected]> wrote:

> I decided to write a driver and play around with this a bit.
> Timer can be run at 2048 hz rather than 256Hz.
> This gives a reasonable way to rapidly configure an audio driver.
>
> toying around; if I get something that works in an interesting way I will
> post it.
>
>
> On Wed, Apr 6, 2022 at 5:43 PM Daryn Hanright <[email protected]> wrote:
>
>> That's pretty cool.
>>
>> The USA guys might not be familiar with the original Sinclair ZX
>> Spectrum, but that had a 1 voice beeper, but musicians/coders did some
>> amazing things with it. This guy does a detailed analysis on what they did
>>
>>
>> https://hackaday.com/2022/01/20/when-a-single-bit-was-enough-into-the-sound-of-the-zx-spectrum/?fbclid=IwAR2-g9QsikuuFz2eGhmPVT-p1KhYFZuXLaivcnafhtW__O9Sie1qU9a5YbM
>>
>>
>>
>> On Thu, Apr 7, 2022, 9:27 AM Stephen Adolph <[email protected]> wrote:
>>
>>> When I have looked at the buzzer circuit circuit in the past, I was
>>> always wondering - could you drive 2 audio signals into the buzzer?
>>>
>>>
>>> There are 3 signals that drive the buzzer.
>>>
>>> Port BA  pin 5 - direct drive
>>> Port BA  pin 2 - on/off control for the "sound" tone
>>> Timer signal - tone generator
>>>
>>> So, you can make sound 3 ways
>>> 1) by enabling a single tone, enabling pin 2 and disabling pin 5
>>> 2) by enabling a single tone, and modulating pin 2, and disabling pin 5
>>> 3) by disabling single tone, disabling pin 2, and modulating pin 5.
>>>
>>> I ran a simple program to prove that you can generate extra sounds.
>>>
>>> 5 sound1000,1
>>> 10 out186,233
>>> 15 fori=1to1000:next
>>> 20 call30326:goto20
>>>
>>> (hit reset to get back to normal!!)
>>> line 5 sets a tone
>>> line 10 turns on pin 2; you hear the tone
>>> line 15... some delay
>>> line 20 rapidly toggles the direct drive at pin 5.  new sounds!
>>>
>>> you can distinctly hear the two separate sounds.
>>> In fact you can hear the timer interrupt as well, every second.
>>> you can also hear keyboard inputs
>>>
>>> so, this little test shows that you could separately set up a single
>>> tone, as well as driving modulated signal directly.  that's 2 sounds
>>>
>>> A third sound could be mixed in by modulating pin 2 (turning the tone on
>>> and off).
>>>
>>> I don't know of any M100 software that has taken advantage of these
>>> extra ways to make sounds.  Anyone else?
>>>
>>> Seems like an interesting area to explore.  Some supporting machine code
>>> routines would be interesting to think about.
>>>
>>> need to think of a clever way to demonstrate 3 sounds mixed.
>>>
>>> Steve
>>>
>>>

<<attachment: sound3.zip>>

Reply via email to