Page 1 of 1

Varying Tone/Timbre on AY Channel through Hardware!

Posted: Mon May 28, 2007 1:16 am
by Twilighte
I have had a bit of a brainwave.
The following idea can only be done on a Real Oric not on any emulator (because the shift register is not emulated) apart maybe from Caloric (when it is finished).


1) Set up one channel to EG Control by setting B4 in volume channel
2) Write 0 to the Envelope (EG) period
3) Set up the AY Sound Register to 13 (Cycle register)
4) Write \_ envelope waveform value to Port A ($030F)
5) Write %10000000 (Binary) to shift register
6) set CA2 low and CB2 to low
7) Write a mid-range value to T2
8 ) Set up the Shift Register to shift continuously at T2 rate

Now at a rate set by T2, the shift register will Rotate the value 10000000 with each carry being placed both on CB2 and Bit7 of the shift register again.
With CA2 low, CB2 going high will write the current value in $030F(PortA) to AY register 13. Because a write to register 13 always resets the waveform, it will produce this...

1000000010000000..
\_______\_______

By placing 11000000 in the shift register we will effectively produce the same pitch and volume but alter the tonal quality of the note.

11000000
\\______

Whilst we display the trigger as \\ the actual height will be more uniform (because even with an envelope period of 1, the Envelope will not have time to depleat before the second trigger is sent).

Now by varying T2 Latch/counter we are able to change the frequency of the note. On further reading of the 6522 spec it would seem that only the lower 8 bits of T2 are used for the rate which is even better since only the low period of T2 is latched in the 6522.

Cool huh?
It may even be possible to produce PWM samples using this technique.
Now all thats needed is someone to write this code and try it.

Posted: Wed Jun 06, 2007 6:00 pm
by carlsson
Interesting. Would this technique only be useful on the Oric, with the AY chip mapped through the VIA?

Posted: Thu Jul 05, 2007 8:11 pm
by Twilighte
Yes :/

Posted: Sat Jan 03, 2009 1:39 pm
by Twilighte
I've just updated the first message again. There were some discrepencies.
Apparently Andre is currently converting xeuphoric to C. It would be very cool if the 6522 was completely emulated. Fabrice theorised to make this so would require a pentium pc.. hmm methinks we have moved beyond those now. :)

Posted: Fri Feb 06, 2009 10:01 am
by waskol
Twilighte wrote:I've just updated the first message again. There were some discrepencies.
Apparently Andre is currently converting xeuphoric to C. It would be very cool if the 6522 was completely emulated. Fabrice theorised to make this so would require a pentium pc.. hmm methinks we have moved beyond those now. :)
If this is done, you will have an emulator for XP/VISTA/SEVEN operational very quickly since it is the only part I did not success to emulate in my emulator !

If only I could get in touch with Andre in order to work on it could be very great !

Posted: Fri Feb 19, 2010 12:59 am
by Twilighte
Well now we have Oricutron (previously Oriculator) by Xeron we have an emulator that supports the Shift Register.
There are bugs in version 0.4 regards mode 100 Shift register mode which is intended for HardSID on the Oric and at the moment these are preventing HardSID to work correctly.

To test it i have written a little utility called hs.tap
It allows control of all the parameters in the HardSID environment.
You can get it here..

http://code.google.com/p/oriculator/issues/detail?id=17

The massive advantage of HardSID is it doesn't require a fast irq to constantly run in order to generate the SID sound.
Take the Times of Lore title music for example..

It displays the natty colour title TIMES of LORE then displays the doors opening sequence then back to the title again.
If we run a fast IRQ the SID sound will be too bad if we interrupt it everytime we want to change the HIRES screen (40x120).
Conversely the HIRES screen will look ugly if we keep the irq running during its display update.
But with HardSID we can use the CPU solely for updating the screen (and music element) which will look far superior.
[/img]

Re: Varying Tone/Timbre on AY Channel through Hardware!

Posted: Thu Oct 18, 2018 1:21 pm
by waskol
There may be another usage of this technique :
using the T2 Latch, it might be worth a try to create a "hardware" enveloppe generator (controlling volume directly) instead of using the limited AY enveloppe generator.
That would permit to create some ADSR enveloppe in order to make the Oric sound more like a real piano, flute, etc...

Unfortunately, I do not have the assembler skills to try this out.

Re: Varying Tone/Timbre on AY Channel through Hardware!

Posted: Thu Oct 18, 2018 3:48 pm
by Dbug
Keep in mind that the Shift Register based tricks do not seem to work on all the Orics.