User port sound

Modding and Technical Issues

Moderator: Moderators

User avatar
R'zo
Vic 20 Nerd
Posts: 514
Joined: Fri Jan 16, 2015 11:48 pm

Re: User port sound

Post by R'zo »

Wow! Thanks you every one from the input. Very appreciated. It will take me a few days to sort through this.

Since I've posted this I've had a few different ideas from simply installing a 1/4inch jack wired internally to attaching a guitar neck to my Vic, feeding the strings through piazzo pickups and using the user 0ort connection to amplidy/modulate the signal.

All this info opens up quit a few doors of possibilities. After I sort through all the data provided I'll settle on a direction for the project.
R'zo
I do not believe in obsolete...
User avatar
eslapion
ultimate expander
Posts: 5458
Joined: Fri Jun 23, 2006 7:50 pm
Location: Canada
Occupation: 8bit addict

Re: User port sound

Post by eslapion »

Mike wrote: Fri Apr 24, 2020 11:35 am Not as asymmetric in the given case as you might think - this is from page 3 of the 6522 datasheet:
...
But in general, you are right regarding NMOS and TTL outputs: they can hardly source current (rule of thumb, not much more than around 40 µA at high level) but rather easily sink current (at least 1.6 mA at low level). That's why I first came up with the current sinking version. :)
The high side MOSFET drive considerably less current than the low side one, something you don't see on the datasheet. I have measured similar figures as the ones you are giving here.

When doing the project suggested in the PRG, it is suggested to connect the user port line directly to an audio amplifier which doesn't have a very high input impedance and this strongly affect the rise/fall time. When you do, assuming you check it with a scope, you'll notice the rise time of the resulting wave is easily 10 times greater than the fall time as the amplifier's impedance affect them.

To get good results, I suspect it would be a good idea to amplify what comes out of the MOS 6522 using an op-amp that uses FET technology as to have the highest possible input impedance. An inexpensive op-amp like the TLC071, which has both a very high input impedance and happens to work fine with 5Vdc would do the trick.
groepaz wrote: Sat Apr 25, 2020 3:52 am so who provides the VICE patch? :=P
Sacrilege! This is a project exclusively reserved to an actual VIC-20.

Unless, perhaps, somebody finds a way to emulate a 6522 in real time with something attached to a USB port.
Be normal.
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: User port sound

Post by groepaz »

This possibly only gets urgent if any of the designated audio replay programs ever pop up
well, or if someone wants to write (non trivial) software for it, perhaps :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: User port sound

Post by Mike »

eslapion wrote:The high side MOSFET drive considerably less current than the low side one, something you don't see on the datasheet. I have measured similar figures as the ones you are giving here.
Still, the port B outputs, CB1 and CB2 are not just source followers (between +5V and output) connected to their own sources. There is an extra parallel FET which drives more current when the 'high' output is at 1.5 V - the datasheet also gives those values (see page 21): Output high current (sourcing) @V_OH = 1.5 V, PB0 - PB7, CB1, CB2: min: -3.0 mA, typ. -5.0 mA (the negative sign by convention), especially designed to drive Darlingtons directly. The latter which is done on the VIC-20 mainboard to control the tape motor. And it's still around -100 µA (min.) to -1000 µA (typ.) for 2.4 V - more than the rough estimate of (-)40 µA I gave in my earlier post.

The port A output and CA2 indeed only have the current limiting source follower connected to the +5V rail.
When doing the project suggested in the PRG, it is suggested to connect the user port line directly to an audio amplifier which doesn't have a very high input impedance and this strongly affect the rise/fall time. When you do, assuming you check it with a scope, you'll notice the rise time of the resulting wave is easily 10 times greater than the fall time as the amplifier's impedance affect them.
That mainly confirms that the 'lower' FETs can sink a lot more current than what is 'guaranteed' by the data sheet (it just states a minimum of 1.6 mA @ 0.4 V and no 'typical' value ...) and this again is a good hint as to why I first posted a current sinking version of the D/A converter.

I'd refrain from connecting CB2 directly to an audio amplifier though, as suggested by the PRG. I don't want transients to fry the VIA. The minimum protection being a capacitive coupling as done with the electrolytic in the D/A converter, or ...
To get good results, I suspect it would be a good idea to amplify what comes out of the MOS 6522 using an op-amp that uses FET technology as to have the highest possible input impedance. An inexpensive op-amp like the TLC071, which has both a very high input impedance and happens to work fine with 5Vdc would do the trick.
... slightly more elaborate like this. :mrgreen:
User avatar
Noizer
Vic 20 Devotee
Posts: 297
Joined: Tue May 15, 2018 12:00 pm
Location: Europa

Re: User port sound

Post by Noizer »

groepaz wrote: Sun Apr 26, 2020 7:31 am
This possibly only gets urgent if any of the designated audio replay programs ever pop up
well, or if someone wants to write (non trivial) software for it, perhaps :)
Mike wrote: Fri Apr 24, 2020 8:36 amNo big issue when the sample output is done in an interrupt routine (for example NMI from a VIA timer).
Not fast enough if one would reach at least about 16KHz tone quality = 30 cyles pro sample byte.
What I meant with driver was simply the stable playback routine. Trivial or not.

In the meanwhile I found back the note with the hand-written scheme; the choice of my values for the resistors was simply to meet the condition that Rout << Rbit3 and all other resistors in something always double the resistance before that, starting from Rbit3 were.
Original resistor values I got from an lost ancient german book of electronics were:
for the four resistors 19K2, 9K6, 4K8, 2K4, for the output resistor 1K. So I modified to the half all values, as i had only the odd values disponible.
For the condensators i guessed the value to 1microF, because there was no evidence in the book.
The diodes used are type 1N4148.

To your effort, I really must admire your all knowledge. Well done on reversing the scheme of the user port DAC. :mrgreen:

I' m playing currently with that idea of combining the vic sound with the sample output, connected over 3 separated channel to an mixer.
This would certanily allow to boost considerably the possibilities of music creation on vic (with an trivial user port dongle :mrgreen:), because the volume of the samples and from the vic native sound now could be controlled separately. Often I hear nice chiptunes, but the lack of volume regulation for each voice leads to unlucky results.
It's normal that high pitched sounds doesn't have to be as loud as low pitches tones when mixed together.

Dear all, bye for now
Valid rule today as earlier: 1 Byte = 8 Bits
-._/classes instead of masses\_.-
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: User port sound

Post by groepaz »

8khz should be more than enough though (and that is doable in interrupt) :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
Noizer
Vic 20 Devotee
Posts: 297
Joined: Tue May 15, 2018 12:00 pm
Location: Europa

Re: User port sound

Post by Noizer »

So I'm trying at time to reanimate operation for the 4 bit audio stereo DAC interface and my first impressions are more than good.

- Quality streaming trough $9110 almost the same as using $900E, but much more louder :)
May solve some past troubles you had with weak sample volume - no more VizNut hacks necessary.
- The said limits of "trivial bad tube sound" couldn't be verified.
- Even though it's an user output port, it can be handled such as register $900E.
- Connecting an audio mixer gives two independent tracks, 1 stereo track $9110, 1 mono track as usual for vic synthy tones $900A-$900E. More sound for so less.
- Replay code frequency $9110 at least 15 Khz, due some nice features. More "Khz" still possible :mrgreen:
No time left, bye for now.

Edit:
I forget in my last hurry to indicate that the digital noise disturbance knowed on $900E audio output is on $9110 audio not recognisable anymore - I wondered too :shock:
Last edited by Noizer on Fri Jun 12, 2020 8:13 pm, edited 1 time in total.
Valid rule today as earlier: 1 Byte = 8 Bits
-._/classes instead of masses\_.-
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: User port sound

Post by Mike »

Noizer wrote:May solve some past troubles you had with weak sample volume - no more VizNut hacks necessary.
If anything, Viznut pioneered those alternate waveforms done by quickly switching voices on/off to put a non-square-wave pattern into the LFSR.

But these waveforms are unrelated to the sample amplifying method, that pixel and I investigated, which uses two voices with 180° phase difference to improve the bias point of the VIC audio output for $900E samples. There, the gain was around 2 dB, not really worth further pursuing the matter.
User avatar
Noizer
Vic 20 Devotee
Posts: 297
Joined: Tue May 15, 2018 12:00 pm
Location: Europa

Re: User port sound

Post by Noizer »

Yes Mike, you are at 100% right, as usual. 8)
I referenced to the old VizNut hack, as a trick to toggling fast (4 clock cycles) the „test bit 7“ from any voice (my own understanding of things) to modify the phase start of an waveform. Your both approach based IMHO on that knowledge.
Valid rule today as earlier: 1 Byte = 8 Bits
-._/classes instead of masses\_.-
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: User port sound

Post by Mike »

Noizer wrote:I referenced to the old VizNut hack, as a trick to toggling fast (4 clock cycles) the „test bit 7“ from any voice (my own understanding of things) to modify the phase start of an waveform. Your both approach based IMHO on that knowledge.
Well, bit 7 is used to enable each of the voices, that could be counted as common, yet probably only implicit knowledge:

The enable bit works by either forcing the generator output to 0 (and continuously loading the 8-bit LFSR with 0), or inverting the shifted out bit, and putting the bit back into the LFSR again, as well as making it the generator output. In the normal course of things, this results in a steady stream of eight 1's and eight 0's from the LFSR - the 'normal' square-wave pattern.

Again, the amplifying method that pixel and I investigated does not make use of that detailed mechanism, and would even work if these "Viznut waveforms" did not exist.

In short: Viznut had nothing to do with it.
User avatar
Noizer
Vic 20 Devotee
Posts: 297
Joined: Tue May 15, 2018 12:00 pm
Location: Europa

Re: User port sound

Post by Noizer »

Right Mike, I wanted to thematize VizNut only to point on that no more demos like Datapop were relasead and could exploit and explain at an practice level that phenomena for a timed toggling of bit 7 for an arbitrary vic voice, instead always composing headaches chip tunes. Bit 7 has more weight at all as you may expect.
BTW the old topic from nippur72 about the work of vic sound voices shift registers is great but definitively too heavy for me to follow and therefore deduce a practical implementation of it.
Coming back ASAP to you
Valid rule today as earlier: 1 Byte = 8 Bits
-._/classes instead of masses\_.-
User avatar
Noizer
Vic 20 Devotee
Posts: 297
Joined: Tue May 15, 2018 12:00 pm
Location: Europa

Re: User port sound

Post by Noizer »

groepaz wrote: Fri Apr 24, 2020 3:45 am ... I'd go for 8bit mono instead of 4bit stereo, as more bits greatly improve the quality
Since there have been no replies to the CA2 thing lately, I think this topic can be split up into another new topic. But I do not know how. Maybe our guru and guardian Mike?
I'm currently stuck on the 4-bit stereo DAC audio interface, not because I'm getting stuck coding this thing, in fact I've coded so much on it (sorry, the codes will show up as soon as possible) and finally I guess have found a way to play 8Bit raw unsigned samples on it!

So my questions is (may be strange to understand for those unrelated to matter):
Is it true that
4-bit sample channel high nibble (track volume high on mixer device)
mixed with
4-bit sample channel low nibble (track volume is lower than channel high on mixer)
result in an 8Bit mono signal output?
Valid rule today as earlier: 1 Byte = 8 Bits
-._/classes instead of masses\_.-
Post Reply