6Bit audio:

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: 6Bit audio:

Post by at67 »

I've been further experimenting with audio and come up with a decent way of playing back, (almost recognisable), traditional audio samples. The samples are heavily pre-processed, (using Audacity), to get the best quality possible in a 4000Hz 4bit format.

Sample playback is quite efficient in terms of vCPU cycles and memory used, so that it will be possible to include it in games or applications with onscreen pixel movement and in screen modes other than mode 3. But given that even a small sub one second sample will probably require more than 1kbytes of contiguous RAM space, 64K RAM Gigatron's are a minimum requirement.

There are two new instructions in ROMvX0 to facilitate audio samples, SMPCPY and OSCPX:
- SMPCPY replaces around ten ROMvX0 instructions in the unpacking and copying of the 4bit format into the correct area of 0x0700 wave-table memory, it's a self restarting instruction using the PREFX2 format that requires 22 + 60*16 + n*24 where n = number of retries. Best case scenario it will unpack and copy 4 samples per scanline for a total of 16 scanlines required per 64byte wave update. i.e. Best case 16 out of 521 scanlines are used for sample playback.

- OSCPX replaces around twelve ROMvX0 instructions in displaying a pixel representation of one of the four waveforms located in the 0x0700 wave-table memory. It is a PREFX3 instruction that executes in 22 + 42 + n*24 where n = number of retries.

Here's a video of these new instructions in action, (head to the two minute mark): https://www.youtube.com/watch?v=dZTAFZLg7Xs
walter
Site Admin
Posts: 160
Joined: 13 May 2018, 08:00

Re: 6Bit audio:

Post by walter »

That's pretty impressive, cool!

Brings back memories of the first 1-bit sound in MSX games :)
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: 6Bit audio:

Post by at67 »

:) Yeah, also reminds me of RealAudio on the PC, 1bit PWM over it's inbuilt speaker in the late eighties, pretty crap sounding, but very nostalgic.
Hans61
Posts: 102
Joined: 29 Dec 2020, 16:15
Location: Saxonia
Contact:

Re: 6Bit audio:

Post by Hans61 »

I am not so audio affine, but the sound and the video impress me. Since it's 4 bit we may as well refrain from expanding it.

@alastair I am an electronics engineer. I don't know much about audio technology. Impedance is the AC resistance, for resistors it is the same as ohmic resistance. If I replace the R2R network with 6 pins by the one with 10 pins, I have a resistance of 80k instead of 40k at the capacitor C43. I don't know to what extent this affects the following filter. Maybe it can be avoided by replacing it with 4.7k. But I can ask someone who knows something like that.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: 6Bit audio:

Post by at67 »

Hans61 wrote: 09 Oct 2021, 11:03 I am not so audio affine, but the sound and the video impress me. Since it's 4 bit we may as well refrain from expanding it.
If you mean expanding the hardware, then there is still a necessity to go to 6bit or preferably 8bit for the best possible quality.

Even though the samples my code is playing are 4bit, they can be mixed into a 6bit sample, (by the native code mixer), and when mixed against the other inbuilt 6bit waveforms, (i.e. sound effects, music etc), they can mix to 8bit when all 4 channels are active.

You can hear the difference in my emulator when switching the ROM between 4-6-8bit modes, hardware will be the same.
Hans61
Posts: 102
Joined: 29 Dec 2020, 16:15
Location: Saxonia
Contact:

Re: 6Bit audio:

Post by Hans61 »

@alastair Sorry, I think I have to correct myself. If I understand correctly, the low pass is mainly influenced by 2R and C43, the high pass consists of C44 and R10. So you don't have to change the filter.
Hans61
Posts: 102
Joined: 29 Dec 2020, 16:15
Location: Saxonia
Contact:

Re: 6Bit audio:

Post by Hans61 »

A circuit for a test board, with 8 bit audio, might look like this:
8Bit audio.sch.png
8Bit audio.sch.png (25.54 KiB) Viewed 5165 times
I still want to test it. If it works I will integrate it on the expansion board.
IC2 is the adapter to the Gigatron.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: 6Bit audio:

Post by at67 »

Here's your chance to really take advantage of the new 8bit output, Marcel's original passive notch filter whilst being remarkably impressive in terms of component count and taking advantage of the low audio fidelity for 4 bits of output, just won't cut it for an 8bit signal. i.e. The quantisation noise generated by the 4bit output masks the audio weakness of the following passive stages.

If I was designing this circuit I would use a good fast settling low noise 8bit DAC, (e.g. DAC0832, DIP), combined with a low noise single rail op-amp, (e.g. MCP 6022). You'll need to bias the op-amp to half-vcc, use AC coupling and probably use a potentiometer to adjust gain/volume. The use of decent DAC like the 0832 means you don't need the latch or obviously the R2R ladder.

Bonus points for choosing your op-amp's passives to enable a 20Hz to 8KHz low pass filter.

P.S. Whilst designing the PCB, I'd probably also create a separate filled analog ground plane with the analog VCC connected by a choke and small resistor as well as a local bypass cap. This should minimise digital noise from the rest of the Gigatron, (you can't completely remove digital noise unless you go to extreme lengths with separate DVCC and AVCC supplies and/or grounds on a multi layer PCB, which is obviously not worth the effort for a single 8bit audio channel).
axelb
Posts: 41
Joined: 07 Jan 2021, 06:27

Re: 6Bit audio:

Post by axelb »

Maybe something like this for the amplification / low-pass filtering. Rin = 20 kOhm, C2 = 1nF, Rg + Rf = Potentiometer 100 kOhm?
Attachments
2B768F95-BCAE-4993-9666-D78A193503D3.jpeg
2B768F95-BCAE-4993-9666-D78A193503D3.jpeg (105.01 KiB) Viewed 5108 times
Hans61
Posts: 102
Joined: 29 Dec 2020, 16:15
Location: Saxonia
Contact:

Re: 6Bit audio:

Post by Hans61 »

Thanks for the information. I will deal with it and try to realize a feasible solution for it. (the parts mentioned above don't really seem to be available). Since the audio expansion is autonomous (independent of the expansion board) I will design two separate PCB's that fit side by side and can be mechanically connected for better stability. I will also include the possibility to control the 4 LEDs from the expansion.
Post Reply