English Amiga Board


Go Back   English Amiga Board > Main > Amiga scene

 
 
Thread Tools
Old 27 May 2024, 21:30   #21
saimo
Registered User
 
saimo's Avatar
 
Join Date: Aug 2010
Location: Italy
Posts: 854
Quote:
Originally Posted by pandy71 View Post
Compression is just reading from 256 word table value (but overall data to be moved reduced by half from storage device).
Ah, OK, then that might help on 68020, too.
saimo is offline  
Old 27 May 2024, 22:51   #22
Torti-the-Smurf
Registered User
 
Torti-the-Smurf's Avatar
 
Join Date: Dec 2018
Location: Earth
Posts: 1,080
Great Stereo Panning !

Very cool stuff Saimo
Torti-the-Smurf is offline  
Old 27 May 2024, 23:53   #23
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 601
Quote:
Originally Posted by saimo View Post
I can see the benefit of allowing the CPU not to care about synchronization with Paula, though. By the way, the Copper is a key part of my implementation as it is strictly required to start the playback in a way that all the channels are perfectly in sync.
Is there any chance you could elaborate on this? Thanks!
copse is offline  
Old 28 May 2024, 11:13   #24
saimo
Registered User
 
saimo's Avatar
 
Join Date: Aug 2010
Location: Italy
Posts: 854
Quote:
Originally Posted by copse View Post
Is there any chance you could elaborate on this? Thanks!
Quick answer during a break at work...
It is strictly necessary that all the channels operate in perfect sync. However, there's no way to start all of them at the same time due to the fact that they start when the AUDxDAT registers are written to, and neither the CPU, nor Copper, nor Paula itself via DMA (due to the CHIP bus slots allocation) can do that. CPU-wise things are even more complicated because the access timings vary depending on the CPU and on the expansion board.
Therefore, I resorted to the method illustrated in the code below, which is a snippet of the Copperlist that gets executed only once and when no bitplane DMA is going on.

Code:
* Set the periods to values decreasing by 4 ticks to compensate the fact that the channels are started with a difference
* of 4 color clocks by the writes to AUD*DAT below here - thanks to such periods, all the channels will end playing the
* first samples at the same time, thus synchronizing the playback of the following samples.
*
* NOTE
* a) The synchronization must be done by the Copper as tests showed that the stock Amiga and the expanded Amiga have
*    different access times to the chipset registers (i.e. the writes to AUD*DAT would happen at different and possibly
*    irregular times).
* b) The periods are such that they can be comfortably fixed later (see below).

    dc.w    RO_AUD0PER,400
    dc.w    RO_AUD1PER,396
    dc.w    RO_AUD2PER,392
    dc.w    RO_AUD3PER,388

* Wait for a color clock beyond the memory refresh slots.

    dc.w    $00e1,$80fe
    dc.w    $0011,$80fe

* Clear the AUD* interrupt requests and enable the AUD0 interrupt.

    dc.w    RO_INTREQ,$0780
    dc.w    RO_INTENA,$8080

* Start the channels with null samples.
*
* NOTE
* This causes the transition 000 -> 010. Before the samples finish playing (i.e. before the 011 -> 010 transition), the
* proper periods must be set so that: the next samples will be played at the right frequency; the channels will restart
* at the same time. Initially Paula loads the internal period counters from AUD*PER after the writes to AUD*DAT (i.e at
* transition 000 -> 010), so writing AUD*PER before the transition 011 -> 010 (when AUD*PER will be read again) has no
* no immediate effect.

    dc.w    RO_AUD0DAT,0
    dc.w    RO_AUD1DAT,0
    dc.w    RO_AUD2DAT,0
    dc.w    RO_AUD3DAT,0

* Fix the periods.

Copperlist_FP    dc.w    RO_AUD0PER,PERIOD
    dc.w    RO_AUD1PER,PERIOD
    dc.w    RO_AUD2PER,PERIOD
    dc.w    RO_AUD3PER,PERIOD
EDIT: lately the forum handling of line feeds has stopped working; I can't paste the code in a readable way, not even with quote tags.

Last edited by saimo; 10 June 2024 at 22:53. Reason: Fixed broken English.
saimo is offline  
Old 28 May 2024, 12:59   #25
hammer
Registered User
 
Join Date: Aug 2020
Location: Sydney/Australia
Posts: 1,021
Quote:
Originally Posted by saimo View Post
RTG doesn't matter. The method should work on all chipsets, although as far as I know OCS and ECS output is severely muffled by the filter (I never heard a non-AGA Amiga in person, so I can't say), so that would kind of defy the trick. Another downside is that the slower CHIP bus would limit the maximum frequency when graphics are shown.
I was thinking about a high-frequency non-DMA AHI driver for non-ECS Paula with an RTG display. The CPU power is provided by Emu68.

I have both A1200 rev1d4 and A500 rev6A.

Last edited by hammer; 28 May 2024 at 13:09.
hammer is offline  
Old 28 May 2024, 13:20   #26
saimo
Registered User
 
saimo's Avatar
 
Join Date: Aug 2010
Location: Italy
Posts: 854
Regarding the bottom note in my previous post: editing the post to add that note magically fixed the code! I don't dare touching that post again.

@hammer

Quote:
Originally Posted by hammer View Post
I was thinking about a high-frequency non-DMA AHI driver for non-ECS Paula with an RTG display. The CPU power is provided by Emu68. I have both A1200 rev1d4 and A500 rev6A.
Even if emu68k would have an easier life, it still would be severely slowed down by the continuous, constant and numerous interrupts and writes to the Paula registers. An AHI driver should be possible, but its use would be limited because the CPU-driven method is inherently limited and not suitable for multitasking contexts.

Last edited by saimo; 10 June 2024 at 22:54. Reason: Fixed broken English and newlines.
saimo is offline  
Old 28 May 2024, 14:49   #27
klx300r
Registered User
 
klx300r's Avatar
 
Join Date: Oct 2007
Location: ManCave, Canada
Posts: 1,627
Thumbs up

@ saimo

sweet Demo! I can really here the quality of the music when played through my amp and 14" old school Boston Acoustics speakers
klx300r is offline  
Old 28 May 2024, 15:15   #28
saimo
Registered User
 
saimo's Avatar
 
Join Date: Aug 2010
Location: Italy
Posts: 854
@klx300r

Thank you (also for the tests on your 68060 machines)

@all

Some remarks by Gunnar in this thread on AmigaWorld made me realize a major flaw of this playback method - quoting myself:
Quote:
But I have to thank you for insisting because you opened my eyes: happy with the basic thought that the volumes would keep working as usual, I had not considered the implications relatively to the low 6 bits playback!
[Thinking aloud]
There's no problem with the high 8 bits as those are sent to the DACs continuously, but the 6 bits are supposed to be played back with a volume of 1, i.e. they should be sent to the DACs only once every 64 clocks. Paula does not reload the volume counters between the 010 and 011 transitions, so that means that the internal volume counters just loop from 63 to 0 continuously. However, for the demo the period is set to 50 clocks, so the reloading of the output buffers and the sending of their data to the DACs go out of phase! In practice, the high byte and the corresponding low byte go to the DAC in sync only partially and the rest of the time the high byte gets played in conjuction with the previous (and sometimes next-to-previous) low byte (which thus acts as a sort of random dithering)! This is bad and effectively limits the period to 64 clocks (for use with volumes less than 64, that is).
In short, for 14-bit playback the period should not be less than 64. For higher periods, it looks like noise shaping is the way to go...
Any thoughts?

EDIT: line feeds are becoming a serious problem; I'm using FireFox.

Last edited by saimo; 28 May 2024 at 15:27.
saimo is offline  
Old 28 May 2024, 15:56   #29
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,436
Quite a cool demo, thanks for sharing it
Also, that Copper-synchronisation trick is pretty cool!

May I ask how you figured out the exact values? Calculation or experimentation?
roondar is offline  
Old 28 May 2024, 16:05   #30
saimo
Registered User
 
saimo's Avatar
 
Join Date: Aug 2010
Location: Italy
Posts: 854
Quote:
Originally Posted by roondar View Post
Quite a cool demo, thanks for sharing it
My pleasure

Quote:
Also, that Copper-synchronisation trick is pretty cool! May I ask how you figured out the exact values? Calculation or experimentation?
The absolute values don't really matter, as long as the Copper subsequently has enough time to set the correct ones. It's sufficient that they're spaced by 4 cycles, i.e. the time that the Copper needs to perform each write (and, as you can see, I've been extremely generous).
saimo is offline  
Old 28 May 2024, 16:51   #31
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,436
Quote:
Originally Posted by saimo View Post
My pleasure The absolute values don't really matter, as long as the Copper subsequently has enough time to set the correct ones. It's sufficient that they're spaced by 4 cycles, i.e. the time that the Copper needs to perform each write (and, as you can see, I've been extremely generous).
Ahhh, I see. I misread the Copperlist's comments and your explanation. The first 4 writes to AUDxPER you do aren't actually the period values you need, they just need to be high enough and have at least a difference of 4 each.

Then, the synchronisation happens and lastly the desired actual period values get written.

Thanks for explaining it
roondar is offline  
Old 28 May 2024, 19:17   #32
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,872
Quote:
Originally Posted by saimo View Post
@allSome remarks by Gunnar in this thread on AmigaWorld made me realize a major flaw of this playback method - quoting myself: In short, for 14-bit playback the period should not be less than 64. For higher periods, it looks like noise shaping is the way to go...Any thoughts?EDIT: line feeds are becoming a serious problem; I'm using FireFox.
So it was my 3rd question about 14 bit mode and how you implemented it if audio period is shorter than 64 clocks. Signal need to be averaged over time so in theory sample period should be at least 64 or better 128 (Nyquist rate).Yep, there is some issue with linefeed on forum - CR/LF is removed by forum engine.
pandy71 is offline  
Old 28 May 2024, 19:38   #33
saimo
Registered User
 
saimo's Avatar
 
Join Date: Aug 2010
Location: Italy
Posts: 854
Quote:
Originally Posted by pandy71 View Post
So it was my 3rd question about 14 bit mode and how you implemented it if audio period is shorter than 64 clocks.
I see. I had not connected your question to the volume issue (because I had not yet thought about the volume!)

Due to this last realization, I've spent the afternoon looking into dithering and noise shaping. I have downloaded a number of tools and made a few tests (I've just finished) by reducing the original 32-bit float waveform to 8 bits, keeping the 192 kHz rate. These are the results, quantization noise-wise:
* Audacity, with all its dithering methods (including shaping): very audible;
* foobar2000 (https://www.foobar2000.org), which offers a SSRC resampler: very audible;
* Acoustica (https://acondigital.com/products/acoustica), with the 8 bit aggressive noise shaping (the others are worse): better than the ones above, but still distinctly audible;
* Reaper (https://www.reaper.fm) - barely audible at 176400 Hz; beyond my (poor ears) perception at 192000 Hz.

Apart from the very last case, none of the other tests comes even close to the (albeit flawed) 14-bit playback (at the much lower rate of about 70938 Hz) as regards quality. Of course I'm a total noob, so somebody with experience and proper tools might achieve better results, but, on the other hand, only Acoustica provides configuration options, so... maybe there's only so much that can be done with 8 bits? Make no mistake, I'm impressed that 8 bits can sound so good at 192 kHz, but that's too taxing for a poor stock A1200.
saimo is offline  
Old 28 May 2024, 21:47   #34
Karlos
Alien Bleed
 
Karlos's Avatar
 
Join Date: Aug 2022
Location: UK
Posts: 4,419
Is it possible to use the CPU to drive the volume control in tandem with an 8 bit stream? Maybe a volume modulated, preprocessed 8 bit stream could sound better than a vanilla 8-bit one at fixed volume. This is a variation on an idea I had a long time ago that was to be based on channel modulation.
Karlos is online now  
Old 28 May 2024, 22:26   #35
saimo
Registered User
 
saimo's Avatar
 
Join Date: Aug 2010
Location: Italy
Posts: 854
Quote:
Originally Posted by Karlos View Post
Is it possible to use the CPU to drive the volume control in tandem with an 8 bit stream? Maybe a volume modulated, preprocessed 8 bit stream could sound better than a vanilla 8-bit one at fixed volume. This is a variation on an idea I had a long time ago that was to be based on channel modulation.
Ah, yes, I remember when you first mentioned this (I think it was on Amigaworld)! And the idea did cross my mind briefly while making this stuff, but I decided to go the easiest route as I just did not think about the implications relative to the volume counters.
That said, I'm not sure that your idea is feasible: according to the audio state diagram on the AHRM, the volume counter does not get reloaded when it's the CPU that writes to AUDxDAT - and that sounds plausible, otherwise, at volume 1, the low 6 bits would never be heard and the demo music wouldn't sound so good (especially the coda, where the signal is so weak that it would drown in the 8 bit quantization noise); on the other hand, in DMA mode, the volume counters do get reloaded, so it would be natural and much cheaper to keep the same behaviour... I don't know, but I'll make a few tests right away and see what the actual behaviour is.

Edit: given the result of the tests, your idea should be definitely doable and should work great at 3546895/64 = 55420 Hz also, it just occurred to me that I implemented the same concept to remove the noise at the end of the music of my other demo THE CURE: the music there is just 8-bit and its clean guitar arpeggio at the end would be totally noisy without volume control (but the solution there is really basic and rough: from a certain point on to the very end, I amplified linearly the waveform from 100% to the maximum and then the code performs the fade-out by decreasing AUDxVOL).

Last edited by saimo; 28 May 2024 at 23:52.
saimo is offline  
Old 28 May 2024, 22:49   #36
saimo
Registered User
 
saimo's Avatar
 
Join Date: Aug 2010
Location: Italy
Posts: 854
@Karlos

I just did a couple of quick tests:
1. writing to AUDxVOL the low 6 bits (which is basically what the player based on your idea would do): the sound was totally distorted, which proves that the volume counters do get reloaded also in non-DMA mode;
2. setting AUDxVOL to 0 for the low 6 bits channels: even my poor ears could hear the quantization noise!

What gives?!?

Edit: could it be that Paula scales the internal volume counters to the period value, when the latter is less than 64? how can the fact that a volume of 1 works (or at least has a certain effect) when the period is less than 64?

Last edited by saimo; 28 May 2024 at 23:55.
saimo is offline  
Old 28 May 2024, 22:56   #37
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,872
Quote:
Originally Posted by saimo View Post
I see. I had not connected your question to the volume issue (because I had not yet thought about the volume!) Due to this last realization, I've spent the afternoon looking into dithering and noise shaping. I have downloaded a number of tools and made a few tests (I've just finished) by reducing the original 32-bit float waveform to 8 bits, keeping the 192 kHz rate. These are the results, quantization noise-wise: * Audacity, with all its dithering methods (including shaping): very audible; * foobar2000 (https://www.foobar2000.org), which offers a SSRC resampler: very audible; * Acoustica (https://acondigital.com/products/acoustica), with the 8 bit aggressive noise shaping (the others are worse): better than the ones above, but still distinctly audible; * Reaper (https://www.reaper.fm) - barely audible at 176400 Hz; beyond my (poor ears) perception at 192000 Hz.Apart from the very last case, none of the other tests comes even close to the (albeit flawed) 14-bit playback (at the much lower rate of about 70938 Hz) as regards quality. Of course I'm a total noob, so somebody with experience and proper tools might achieve better results, but, on the other hand, only Acoustica provides configuration options, so... maybe there's only so much that can be done with 8 bits? Make no mistake, I'm impressed that 8 bits can sound so good at 192 kHz, but that's too taxing for a poor stock A1200.
In free time i will try to prepare samples for you to test various approaches.8 bit at 176kHz should deliver 120dB dynamics range - of course Paula itself will be limitation (PCB layout, internal IC layout, I/V converter can be probably to slow so some distortions related to PWM VOL control are probably also key to distortions we observing now).I will also apply some premhpasis to deal with internal Amiga analog signal path problems (low pass filters).It is important to lowpass signal beyond audible range as high level of noise shaping (aggressive noise shaping) may produce some sonic distortions (also there is a chance to ruin tweeters if they are forced to work with high power - normally such high level of signal is not present in natural audio). I strongly recommends to reduce trebles especially for better amplifiers and better speakers. And this is normal for all high sample rate signals - they can produce sonic distortions if not properly bandlimited.

I will try to use 64489Hz sample rate (close to two times oversampled 32kHz) - personally not hear anything above 15kHz.
pandy71 is offline  
Old 28 May 2024, 23:05   #38
saimo
Registered User
 
saimo's Avatar
 
Join Date: Aug 2010
Location: Italy
Posts: 854
Quote:
Originally Posted by pandy71 View Post
In free time i will try to prepare samples for you to test various approaches.8 bit at 176kHz should deliver 120dB dynamics range - of course Paula itself will be limitation (PCB layout, internal IC layout, I/V converter can be probably to slow so some distortions related to PWM VOL control are probably also key to distortions we observing now).I will also apply some premhpasis to deal with internal Amiga analog signal path problems (low pass filters).It is important to lowpass signal beyond audible range as high level of noise shaping (aggressive noise shaping) may produce some sonic distortions (also there is a chance to ruin tweeters if they are forced to work with high power - normally such high level of signal is not present in natural audio). I strongly recommends to reduce trebles especially for better amplifiers and better speakers. And this is normal for all high sample rate signals - they can produce sonic distortions if not properly bandlimited.
I will try to use 64489Hz sample rate (close to two times oversampled 32kHz) - personally not hear anything above 15kHz.
That would be great
In turn, tomorrow I'll prepare a modifed version of the playback tool that simply plays 8 bit data, so that anybody can make tests.

Edit: relatively to the dither + noise shaping tests, I forgot to mention that I listened to the resulting waveforms directly on the PC where the processing was done, not on the Amiga (so the results were not affected by the Amiga's hardware).

Last edited by saimo; 28 May 2024 at 23:14.
saimo is offline  
Old 29 May 2024, 06:59   #39
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 601
Quote:
Originally Posted by saimo View Post
It is strictly necessary that all the channel operate in perfect sync. However, there's no way to start all of them at the same time due to the fact that they start when the AUDxDAT registers are written to, and neither the CPU, nor Copper, nor Paula itself via DMA (due to the CHIP bus slots allocation) can do that. CPU-wise things are even more complicated because the access timings vary depending on the CPU and on the expansion board.
As a noob it makes me wonder how do all the other music playing routines on the Amiga deal with this? Is it not relevant for them for some reason? Or is this something that becomes obvious to the ear when dealing with your higher resolution data?
copse is offline  
Old 29 May 2024, 09:31   #40
Karlos
Alien Bleed
 
Karlos's Avatar
 
Join Date: Aug 2022
Location: UK
Posts: 4,419
Big grin

Quote:
Originally Posted by saimo View Post
@Karlos

I just did a couple of quick tests:
1. writing to AUDxVOL the low 6 bits (which is basically what the player based on your idea would do): the sound was totally distorted, which proves that the volume counters do get reloaded also in non-DMA mode;
2. setting AUDxVOL to 0 for the low 6 bits channels: even my poor ears could hear the quantization noise!

What gives?!?

Edit: could it be that Paula scales the internal volume counters to the period value, when the latter is less than 64? how can the fact that a volume of 1 works (or at least has a certain effect) when the period is less than 64?
That doesn't seem likely. Surely, when the volume is set to zero, there shouldn't be any sound to hear at all?

I'm not sure if the concept is still clear, so just to recap, the original idea was that your source 16 bit audio (for example) would be preprocessed into a set of frames (minimum size of 2 samples) of 8 bit that have been scaled so that it can be played back at a particular volume to re-approximate what the 16 bit sample levels would be. This 2:1 sample to volume data rate was a side effect of how channel modulation works and the fact that Paula DMA fetches 16 bits. My original experiments were all in pure software and used a bigger ratio, e.g 16:1 as this reduces the stream size quite a bit and didn't degrade the output too much.

Paraj (or another gentleman of quality) did implement the proposed HW playback mechanism in a prototype, which sounded pretty good to me, but unfortunately, that was all under emulation as my real HW is not currently in a working state.
Karlos is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
ArtPazz - New game for AGA Amigas [WIP] saimo Amiga scene 38 07 June 2023 15:08
RNOPDF for ECS/AGA Amigas released jPV News 5 10 July 2020 07:57
Recommend a good Hertz switcher? lordofchaos request.Apps 5 28 June 2013 04:55
How does a 50 Hertz image get displayed? Richardcavell Coders. Asm / Hardware 14 15 March 2013 13:59
AGA Amigas Kitty Retrogaming General Discussion 25 13 October 2009 12:56

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:54.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10956 seconds with 14 queries