Wanted: Archimedes users who've bypassed sound filter to test new software :)

discuss general risc os software applications and utilities
Related forum: adventures


Post Reply
steve3000
Posts: 2301
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by steve3000 » Sun Mar 20, 2016 10:58 pm

As in the title really.

I've written some new code over the past few weeks, which effectively expands the dynamic range of the standard Archie sound system from 8 bit log stereo, to 15 bit linear stereo (or 16 bit linear mono), without needing additional hardware. :D

More details soon, but I really need some testers who have bypassed their computer's low-pass sound filter (fairly easy on the big-box Archies, eg. A310, A4x0's, A540 and A5000) to check this works across a range of setups... [bypassing the sound filter is necessary, because the standard filter ruins any chance of experiencing the gain by muffling all the sound output].

Any Archie with ARM2 or better is fine, but you'll need at least 2mb RAM and a few mb spare on your HDD for the test files :)

The test code is almost ready to go out - and I'll be sharing this over the Easter weekend.

Anyone interested, let me know.
Cheers,
Steve

User avatar
paulv
Posts: 3854
Joined: Tue Jan 25, 2011 6:37 pm
Location: Leicestershire
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by paulv » Sun Mar 20, 2016 11:32 pm

Yet more software jiggery pokery for the VIDC chip eh? I'd love to give it a go but it's going to be a month or two yet before the machines can come out of storage. The extension is almost finished and life is slowly returning to something a bit more normal. I doubt you can wait that long though.

I've never bothered bypassing the filter but it's so easy I really should make a few backplates with phono sockets on at some point to do so.

I have read though that you really should pass the audio through some sort of noise reduction filter. that isn't as aggressive as the Acorn one. Does anyone have any suggestions for this, either pre-built or as a project?

Paul

steve3000
Posts: 2301
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by steve3000 » Mon Mar 21, 2016 12:10 am

Hi Paul
paulv wrote:Yet more software jiggery pokery for the VIDC chip eh?
Got it in one :D

No problem Paul! I'm sure I'll find enough willing testers to cover the range of different computers and monitor types, then after any tweaks, I'll release a first public version in a month or so.
paulv wrote:I have read though that you really should pass the audio through some sort of noise reduction filter. that isn't as aggressive as the Acorn one. Does anyone have any suggestions for this, either pre-built or as a project?
The filter is really there to mask aliasing effects which you get when playing poor quality samples or outputting sound at very low sample rates. In reality there are few situations you'll notice this on the Arc - in the 90's I ran my A310 for almost its entire life with no filter, and the only time I recall it being a real issue was playing 'Diggers' which uses an appallingly low quality sample output rate and sounds painful without the filter (FYI - Diggers still sounds pretty bad with the filter in place...!).

As my code outputs CD quality samples (44.1kHz) at close-to, or higher than, CD rate (31.25kHz-62.5kHz) aliasing shouldn't be a problem.

Interestingly I believe the A4 laptop had a much less aggressive filter in its output line, possibly as a result of limited PCB space(?) - I need to do a side by side comparison between an A4 and a standard Arc some time to see if the difference is significant.

I wonder what filter (if any) does the RiscPC 16bit sound board use?

Zarchos
Posts: 2355
Joined: Sun May 19, 2013 9:19 am
Location: FRANCE

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by Zarchos » Mon Mar 21, 2016 4:47 am

I'm still in for this but still need to mod one of my A4x0 with ST506 hard drive to get unfiltered sound...
The other machine I've got with filtering off is an A5000 with IDE hard drive so it's not the most interesting for testing purpose.

Zarchos
Posts: 2355
Joined: Sun May 19, 2013 9:19 am
Location: FRANCE

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by Zarchos » Mon Mar 21, 2016 4:50 am

steve3000 wrote:SNIP
I've written some new code over the past few weeks, which effectively expands the dynamic range of the standard Archie sound system from 8 bit log stereo, to 15 bit linear stereo (or 16 bit linear mono), without needing additional hardware. :D

SNIP
Dear me !
That's much better than the Amiga !
Poink, please come and have a look. :wink:

RobC
Posts: 3009
Joined: Sat Sep 01, 2007 10:41 pm
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by RobC » Mon Mar 21, 2016 7:34 am

Sounds like great work - I'm happy to be involved with the testing. My main Arc is an A540 but I also have various other models with the required spec.

I haven't bypassed the sound filters on any of them yet but I'm not averse to getting the soldering iron out.

steve3000
Posts: 2301
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by steve3000 » Mon Mar 21, 2016 7:42 am

Zarchos wrote:That's much better than the Amiga !
The standard Amiga can generate 14 bit stereo linear, using some software tricks not entirely dissimilar to what my code is doing, but you must bear in mind most human ears will not be able to tell the difference between 14 bit and 15 bit dynamic range.

However the sound filter makes a very noticeable difference here and the Amiga can disable this in software. Sadly the Archimedes loses out here, because without bypassing the filter there's very little point in expanding the dynamic range as the filter muffles the output. :(

steve3000
Posts: 2301
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by steve3000 » Mon Mar 21, 2016 7:45 am

RobC wrote:Sounds like great work - I'm happy to be involved with the testing. My main Arc is an A540 but I also have various other models with the required spec.
Thanks Rob, that would be great. I'll add you to my tester list :)
RobC wrote:I haven't bypassed the sound filters on any of them yet but I'm not averse to getting the soldering iron out.
No need for the soldering iron (at least not on the Archimedes), there's a connector on the pcb, you just need to run a feed from this to a 3.5mm jack, and take your sound from there :)

Edit: LK9 is the connector you need on the A540.

Zarchos
Posts: 2355
Joined: Sun May 19, 2013 9:19 am
Location: FRANCE

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by Zarchos » Mon Mar 21, 2016 8:38 am

steve3000 wrote:
RobC wrote:Sounds like great work - I'm happy to be involved with the testing. My main Arc is an A540 but I also have various other models with the required spec.
Thanks Rob, that would be great. I'll add you to my tester list :)
RobC wrote:I haven't bypassed the sound filters on any of them yet but I'm not averse to getting the soldering iron out.
No need for the soldering iron (at least not on the Archimedes), there's a connector on the pcb, you just need to run a feed from this to a 3.5mm jack, and take your sound from there :)

Edit: LK9 is the connector you need on the A540.
NOTE and possible WARNING ! : Please check but on the QUBE RISC OS projects page they say you must protect the OA chip with some caps if you do the mod to an A3000, and the unfiltered sound from the Archimedes must, I believe, also leave the OA chip unprotected !
http://qubeserver.com/Qube/projects/a30 ... tered.html

BTW I've got a little project to get even better sound on the Archimedes, it's on my 'to do' list but it's 1st in the 'hardware' section so you should read about it soon.
Title of the thread will be either:
- 'Improved sound on the Archies : how to'
or more probably
- 'Smoke coming from my 1st in-house hardware mod, what have I done wrong again ?'

:roll: #-o :lol:

steve3000
Posts: 2301
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by steve3000 » Mon Mar 21, 2016 9:03 am

Thanks for that link Zarchos.

Yes the A3000 doesn't have an unfiltered sound connector, so follow that guide and fit the required capacitors if you plan to take unfiltered sound from the A3000.

The big box Arcs have suitable capacitors already in place on the left/right feeds to their unfiltered sound connector - so no extra components needed for these. :)

User avatar
qUE
Posts: 82
Joined: Tue Dec 16, 2014 11:39 pm
Location: Bristol
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by qUE » Wed Mar 23, 2016 1:45 am

Steve, just a couple of things.

I can't see how you're getting any extra bits out of a 7 bit DAC with 1 bit sign switching, is there some mod?
And the current companded audio system achieves 14-bit output by ignoring any of the "detail" the human ear wouldn't be sensitive to (aparently only 120 levels are noticeable), so an extra bit shouldn't make a staggering difference.
This all said, when I've ramped the sample rate it's made a huge difference on the Arc., but tbh RISC OS destroys all that with it's crud audio routines "whining" from interrupt switching.

steve3000
Posts: 2301
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by steve3000 » Wed Mar 23, 2016 7:59 am

Hi, good questions, happy to provide some clarity :)
qUE wrote:I can't see how you're getting any extra bits out of a 7 bit DAC with 1 bit sign switching, is there some mod?
No hardware mod. (except bypassing the filter, which is pretty much essential to hear the increased dynamic range).
qUE wrote:And the current companded audio system achieves 14-bit output by ignoring any of the "detail" the human ear wouldn't be sensitive to (aparently only 120 levels are noticeable), so an extra bit shouldn't make a staggering difference.
VIDC1 uses an approximated mu-law logarithmic sample encoding which has the equivalent
dynamic range of 13bit signed linear sound, across 8 channels.

The VIDC 8 bit log encoding provides 8 different 'chords' (3bits), each with 16 equally spaced levels (4bits) and sign bit, for each of 8 channels. So for each channel you have:

Code: Select all

Where i=16:

chord 0 = 0-i (eg. 0-16, steps of 1)
chord 1 = i-3i (eg. 16-46, steps of 2)
chord 2 = 3i-7i (eg. 48-108, steps of 4)
chord 3 = 7i-15i (eg. 112-232, steps of 8)
chord 4 = 15i-31i (eg. 240-480, steps of 16)
chord 5 = 31i-63i (eg. 496-976, steps of 32)
chord 6 = 63i-127i (eg. 1008-1968, steps of 64)
chord 7 = 127i-247i (eg. 2032-3952, steps of 128)

+ the same values with opposite sign.
The above table details the effective dynamic range output for one individual 8 bit log channel which is 0 to +/- 3952. But the key point about the VIDC 8 bit output is that this is additive across the 8 channels.

So whereas one channel output, on its own, provides the above signed 13 bit linear dynamic range - by doubling the number of channels and encoding linear output across two channels, you can achieve an effective dynamic range 0 to +/- 7904 (effectively signed 14 bit linear); and by using 4 channels you can achieve effective dynamic range 0 to +/- 15808 (effectively signed 15 bit linear).

So by outputting sample data encoded across 4 x 8 bit log channels set to the same (full left) stereo position and across 4 channels set to full right, this provides equivalent of stereo signed 15 bit linear output.

As for the limits of human hearing - you're quite right, increasing the sample rate makes a huge difference - but actually 'hearing' the difference between even 8 bit linear and 16 bit linear needs a very good pair of ears and some decent hifi equipment. There are a number of web pages which demonstrate the challenge eg. this.

I find the easiest way to hear the difference with the expanded dynamic range is listening to the background 'hiss' between and during classical music tracks ripped direct from CD (16 bit linear, 44100Hz). With 8 bit linear output you can always hear a light 'hiss' at low volumes, but by correctly mapping each 16 bit sample to 8 bit log (13 bit signed lin. equivalent), the 'hiss' is significantly reduced, and by using the technique above to generate equivalent of 15 bit signed lin. output, the 'hiss' is further reduced - and overall sample clarity improved.

I'll be sharing my code for testing this weekend, and hoping for some careful listening and scrutiny. :)

User avatar
qUE
Posts: 82
Joined: Tue Dec 16, 2014 11:39 pm
Location: Bristol
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by qUE » Thu Mar 24, 2016 5:20 pm

Ah yeah, I see what you're doing, abusing the channel switching to dither the approximation error :). I should be careful doing this, if you look at the datasheet Acorn do mention about an introduction of distortion from the current pits between channel switching, so you might get some anomalies from that.
You may be able to get the same effect by upping the sample rate and switching for more control over that distortion.

I also tried rebuilding the log table to get it more in-line with the telephony standard (I assume G.711). But it turns out I couldn't find out what standard Acorn based theirs on and I couldn't audibly tell the difference if what I did was better or worse. And with Acorns table I have not idea how far out the error is from the approximations, I mean 120 levels in 127 values is bound to have some error :). Interestingly, the actual measurements the telephony standard is based on was done a very long time ago by cross sectioning a sample of people's hearing, so might not be particularly accurate at all :/

Some research I found;
http://www.dspguide.com/ch22/5.htm
http://dystopiancode.blogspot.co.uk/201 ... ithms.html
http://www.opensource.apple.com/source/ ... ric/g711.c

I've also attached some VIDC code I did an age ago for early versions of AMCS, if it's any use, it certainly will be in removing the RISC OS stacking.
Attachments
sound.txt
(2.51 KiB) Downloaded 58 times

steve3000
Posts: 2301
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by steve3000 » Thu Mar 24, 2016 10:56 pm

qUE wrote:Ah yeah, I see what you're doing, abusing the channel switching to dither the approximation error :). I should be careful doing this, if you look at the datasheet Acorn do mention about an introduction of distortion from the current pits between channel switching, so you might get some anomalies from that.
:wink: Yes I was particularly aware of that - I actually wrote the original code about a month ago using Arculator as I was away from home, and although I was confident it was going to sound pretty good under software emulation, I was very dubious about whether it would sound at all reasonable on real hardware...but turns out it actually sounds pretty good, particularly at high sample rates (24-16 uS, 41666Hz-62500Hz).
qUE wrote:You may be able to get the same effect by upping the sample rate and switching for more control over that distortion.
Absolutely - it's essential.
qUE wrote:I also tried rebuilding the log table to get it more in-line with the telephony standard (I assume G.711). But it turns out I couldn't find out what standard Acorn based theirs on and I couldn't audibly tell the difference if what I did was better or worse. And with Acorns table I have not idea how far out the error is from the approximations, I mean 120 levels in 127 values is bound to have some error :). Interestingly, the actual measurements the telephony standard is based on was done a very long time ago by cross sectioning a sample of people's hearing, so might not be particularly accurate at all :/
Nice one! I did something similar - I created my own linear to u-law table years back for QTM, hoping it would sound better, I played around with it for a quite while, but in the end I wasn't convinced it was any better than Acorn's, so left Acorn's table in there in the end.
qUE wrote:Some research I found;
Cheers, I'll take a read.
qUE wrote:I've also attached some VIDC code I did an age ago for early versions of AMCS, if it's any use, it certainly will be in removing the RISC OS stacking.
Thanks, looks good, very much like a tracker sound code as you say in the comments. :) But for this I've already replaced the channel handler completely and use quite a simple and fairly efficient technique of loading the first 16 bit linear sample (right speaker), shifting to get 15bit, then looking up from a pre-calculated 128kb lookup table (eg. +/-16384 x 4 bytes), which returns a 4-byte (ie. for 4 x 8-bit log channels) value ready to store directly to the VIDC DMA buffer to cover the first 4 VIDC channels, then do the same for the second 16 bit sample (left channel) and map that to the second 4 VIDC channels. Then repeat over and over... :D

User avatar
qUE
Posts: 82
Joined: Tue Dec 16, 2014 11:39 pm
Location: Bristol
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by qUE » Fri Mar 25, 2016 1:50 am

Ah well, regarding your LUT. The next step then is probably what I was trying to do and calculate it on the fly ;)

steve3000
Posts: 2301
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by steve3000 » Tue Mar 29, 2016 11:22 pm

At last, here is the beta test version of VIDCBlaster, for 15bit Stereo sound output on standard VIDC1 Archimedes :D

VIDCBlaster v0.10 requires RISC OS 3.1, 2 mb and a hard disc with some space for CD quality WAV files (approx. 40-50mb per 3-4 minute music track).

Also, as noted above, in order to experience the best of the high sample rate and 15 bit dynamic range on offer from your VIDC1 chip using VIDCBlaster, you will need to use some external amplified speakers, and take the feed for the speakers from the 'unfiltered' line output (ie. using the internal connector, not headphones socket :)). If I get time in the next week or so I'll post up my method to connect to the internal unfiltered output.

Enjoy!
Steve
VIDCBls010.zip
VIDCBlaster v0.10 beta test
(428.18 KiB) Downloaded 48 times
VIDCBlWAV1.zip
Test WAV 1
(449.07 KiB) Downloaded 57 times
VIDCBlWAV2.zip
Test WAV 2
(483.05 KiB) Downloaded 48 times

steve3000
Posts: 2301
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by steve3000 » Tue Mar 29, 2016 11:23 pm

PS. You may wonder how to get 40-50mb .wav files onto your RISC OS 3.1 hard disc? Obviously if you have a networked Archimedes connected to a linux box or to a Raspberry Pi running RISC OS, then this should be straight forward. But as not everyone has this, I've included some useful tools in the zip attachment - a custom file splitter (!Split) and file joiner (!Combine), as well as a .ogg music decompressor (!DeOgg). (FYI - Ogg vorbis is a compressed audio format similar to mp3, but higher compression ratio - you can convert CD ripped .wav files and .mp3 into .ogg using many freely available tools, eg. Audacity on Windows PCs. For transferring files to the Arc, I selected ogg format rather than mp3 because there is a complete ogg decompressor tool available on RISC OS 3.1, but as far as I know there is not an mp3 decompressor that works reliably or handles variable bit rate mp3s under RISC OS 3.1?).

So if you don't have a networked Arc, you can use the tools provided as follows: First under emulation (eg. Arculator v0.99 on the PC), split a .ogg file into a number of 710kb files using !Split. Next move them on DOS floppy disc to your Archie and rejoin them on your HDD using !Combine. Then finally decompress them into full .wav files using !DeOgg...however, be warned, the decompression takes a very long time unless you have an FPA10... so set aside an evening to leave the computer chugging through the file :)

poink
Posts: 964
Joined: Tue Mar 01, 2011 10:27 am
Contact:

Re: Wanted: Archimedes users who've bypassed sound filter to test new software :)

Post by poink » Thu Mar 31, 2016 1:12 am

Steve3000 was kind enough to mention his achievement to me via PM before making this thread, which was much appreciated - however I must apologise to Steve for not replying sooner (a lack of time, especially after losing a couple of attempted responses!) Hope it's OK just to reply here.

If I'm understanding correctly, it seems my initial guess that it's essentially a form of oversampling seems accurate - you can essentially gain an additional bit of accuracy for every doubling of sample rate. It seems similar to delta-sigma modulation - the optimisation of not carrying the error forward infinitely presumably makes a slight (reasonably likely imperceptible!) quality loss in exchange for a significant speed up.

Looking at it from the perspective of oversampling suggests that there might be a use for the additional sample rate that's available - we could probably gain an additional fraction of a bit - perhaps even a whole bit if we assumed the 32kHz rate that used to be reasonably common pre-CD[1]? (Although, at 32kHz, we couldn't as easily take advantage of any ultrasonic filter that the external audio hardware provides, and having an effective low pass by half the sample frequency is rather important if you don't want to suffer from spurious harmonics).

One 'extension' I did wonder was about using the VIDC to produce audio in centre and left+right format, where the bulk of the audio channels (and thus sample rate) is directed to the centre (where most of the energy tends to be); and lower quality residuals are played on left and right to maintain a stereo effect. That might get a step closer to the perception of 16bit linear (I've not tried it, so equally it might be really horrible). There's certainly a whole host of rather clever ways one might try to get the most perceptual quality eg., perhaps one can combine the centre/left+right with digitally cutting off the centre at 14.5kHz, and putting higher frequencies in the left and right residuals.

[1] Probably depends if you have significant hearing above the expected 14.5kHz cutoff for a 32kHz sample rate.
qUE wrote:if you look at the datasheet Acorn do mention about an introduction of distortion from the current pits between channel switching, so you might get some anomalies from that
Interestingly, this probably brings it closer to the ideal DAC response of a series of impulses; that DACs actually produce more of a zero order hold effect, causes certain aberrations in the their frequency response. (Maxim (the chip maker!) explains it better than I would!)

Post Reply

Return to “32-bit acorn software: other”