Poster | Thread |
saimo
| |
Hertz Overload - new AGA demo Posted on 26-May-2024 17:14:37
| | [ #1 ] |
|
|
|
Elite Member |
Joined: 11-Mar-2003 Posts: 2467
From: Unknown | | |
|
| Just a quick heads-up to let you know that I have just released a new demo for AGA Amigas. This one focuses on delivering very high quality music also on base machines equipped with just a mass storage device (which is needed to stream the huge amount of audio data). "Very high quality translates" to: 2 true stereo channels, 14 bit resolution and 70937.9 Hz sample rate.
Download: https://www.retream.com/Hertz_Overload / https://retream.itch.io/hertz-overload
Those who can't (bother to) run the demo on an actual Amiga can see it in this video (beware: due to technical reasons, the audio of the video has a sample of rate of just 44100 Hz): https://www.youtube.com/watch?v=9zDJEW_2qT0 Last edited by saimo on 26-May-2024 at 05:26 PM. Last edited by saimo on 26-May-2024 at 05:20 PM. Last edited by saimo on 26-May-2024 at 05:18 PM.
_________________ RETREAM - retro dreams for Amiga, Commodore 64 and PC |
|
Status: Offline |
|
|
Gunnar
| |
Re: Hertz Overload - new AGA demo Posted on 26-May-2024 18:24:34
| | [ #2 ] |
|
|
|
Cult Member |
Joined: 25-Sep-2022 Posts: 512
From: Unknown | | |
|
| Hello @saimo
Can you tell us what screenmode you are setting for playing this sample rate?
Cheers |
|
Status: Offline |
|
|
saimo
| |
Re: Hertz Overload - new AGA demo Posted on 26-May-2024 18:40:43
| | [ #3 ] |
|
|
|
Elite Member |
Joined: 11-Mar-2003 Posts: 2467
From: Unknown | | |
|
| @Gunnar
It's just PAL. I don't use DMA. _________________ RETREAM - retro dreams for Amiga, Commodore 64 and PC |
|
Status: Offline |
|
|
Gunnar
| |
Re: Hertz Overload - new AGA demo Posted on 27-May-2024 14:13:52
| | [ #4 ] |
|
|
|
Cult Member |
Joined: 25-Sep-2022 Posts: 512
From: Unknown | | |
|
| @saimo
Quote:
It's just PAL. I don't use DMA. |
Do you like to explain us a little more how this works?
We know that DMA on OCS Amiga can do 31Khz samples - while DMA on ECA and AGA Amiga can do 62khz samples.
These samples are theoretical which can not fully use.
The reason is how PAULA creates the volume.
The PAULA Amiga chip runs at ~3.5 MHz. Paula support 0-64 Volume. Paule creates the Volume by giving out the tone 64 times ... or not giving the tone out - for lower volume. This means to create the volume Paula needs 64 clock cycles.
I always though that this means you have in practice a maximum sample rate of 3.5 MHz/64 ~ 55Khz Because of the Volume generation of PAULA.
Maybe you can explain us how you solved this?
Cheers
|
|
Status: Offline |
|
|
saimo
| |
Re: Hertz Overload - new AGA demo Posted on 27-May-2024 21:16:23
| | [ #5 ] |
|
|
|
Elite Member |
Joined: 11-Mar-2003 Posts: 2467
From: Unknown | | |
|
| @Gunnar
The volume counter does not affect the sample rate. The key parameter for the sample rate is the period. In DMA mode, also the CHIP bus slots and, as the Amiga Hardware Reference Manual puts it, also [internal] buffers matter. The demo doesn't use the DMA, so all that matters is that the CPU clears INTREQ.AUDx and writes to AUDxDAT before the period counter expires when Paula is in state 011 (see the audio state diagram on the Amiga Hardware Reference Manual). _________________ RETREAM - retro dreams for Amiga, Commodore 64 and PC |
|
Status: Offline |
|
|
Birbo
| |
Re: Hertz Overload - new AGA demo Posted on 28-May-2024 7:56:08
| | [ #6 ] |
|
|
|
Cult Member |
Joined: 5-Apr-2007 Posts: 602
From: Zurich, Switzerland | | |
|
| @saimo
This demo is incredible. Thank you very much for publishing it.
To your explaination how you achieved the quality: Hats off, this is a truly ingenious solution. _________________ Sometimes we give people a lot of credit just because they're writing nice sentences even if it isn't adding up to much. |
|
Status: Offline |
|
|
Gunnar
| |
Re: Hertz Overload - new AGA demo Posted on 28-May-2024 7:58:39
| | [ #7 ] |
|
|
|
Cult Member |
Joined: 25-Sep-2022 Posts: 512
From: Unknown | | |
|
| @saimo
Quote:
The volume counter does not affect the sample rate. |
I was thinking that how PAULA does Digital to Analog conversion is affecting this.
If you play max volume =64 then PAULA will drive the output with the sample as it. This means with 8bit sample and max volume you can basically reach any sample rate you want.
But if use the volume selection as you need for creating a 14bit effect, don't you then need to give PAULA the time to create the volume for each sample?
If you have less volume than 64 then PAULA will drive the output with a pattern of ON/OFF of the sample, which means that giving out this pattern will need 64 PAULA cycle. PAULA clocks with 3.5 MHz so 64 cycle mean 55KHz maximum that PAULA can do with volume creation.
Does this make sense to you?
|
|
Status: Offline |
|
|
Gunnar
| |
Re: Hertz Overload - new AGA demo Posted on 28-May-2024 12:09:22
| | [ #8 ] |
|
|
|
Cult Member |
Joined: 25-Sep-2022 Posts: 512
From: Unknown | | |
|
| Maybe what I was asking or explaining will become more clear if I reword it.
AMIGA PAULA chip will for VOLUME control resample the Audio at 55kHz. So even if you Poke with CPU the samples in 200kHz ... PAULA will internally resample them to 55kHz for Volume creation.
|
|
Status: Offline |
|
|
Birbo
| |
Re: Hertz Overload - new AGA demo Posted on 28-May-2024 12:18:23
| | [ #9 ] |
|
|
|
Cult Member |
Joined: 5-Apr-2007 Posts: 602
From: Zurich, Switzerland | | |
|
| @Gunnar
Is this the case, if it is a non DMA-driven operation?
(I'm just asking out of interest) _________________ Sometimes we give people a lot of credit just because they're writing nice sentences even if it isn't adding up to much. |
|
Status: Offline |
|
|
klx300r
| |
Re: Hertz Overload - new AGA demo Posted on 28-May-2024 13:51:38
| | [ #10 ] |
|
|
|
Elite Member |
Joined: 4-Mar-2008 Posts: 3843
From: Toronto, Canada | | |
|
| @ saimo
sweet Demo! I can really here the quality of the music when played through my amp and 14" old school Boston Acoustics speakers
_________________ ____________________________ c64-2sids, A1000, A1200T-060@50(finally working!),A4000-CSMKIII ! My Master Miggies- Amiga 1000 & AmigaOne X1000 ! mancave-ramblings X1000 I BELIEVE |
|
Status: Offline |
|
|
saimo
| |
Re: Hertz Overload - new AGA demo Posted on 28-May-2024 14:02:53
| | [ #11 ] |
|
|
|
Elite Member |
Joined: 11-Mar-2003 Posts: 2467
From: Unknown | | |
|
| @Birbo
Thank you :) If you're referring to the idea of using the CPU instead of the DMA, that isn't mine: it's even in the Amiga Hardware Reference Manual ;) I just wrong an efficient implementation of the method. _________________ RETREAM - retro dreams for Amiga, Commodore 64 and PC |
|
Status: Offline |
|
|
saimo
| |
Re: Hertz Overload - new AGA demo Posted on 28-May-2024 14:03:33
| | [ #12 ] |
|
|
|
Elite Member |
Joined: 11-Mar-2003 Posts: 2467
From: Unknown | | |
|
| @klx300r
(I wish I had such good equipment!) Last edited by saimo on 28-May-2024 at 02:08 PM.
_________________ RETREAM - retro dreams for Amiga, Commodore 64 and PC |
|
Status: Offline |
|
|
saimo
| |
Re: Hertz Overload - new AGA demo Posted on 28-May-2024 14:08:09
| | [ #13 ] |
|
|
|
Elite Member |
Joined: 11-Mar-2003 Posts: 2467
From: Unknown | | |
|
| @Gunnar
According to the AHRM Paula performs no resampling whatsoever: it just reloads the output buffer registers whenever the period counters expire and there is no hardware limit to the periods.
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 only 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).
Edit: I made a couple of tests and it turned out that Paula does reload the volume counters also when it's the CPU writes to AUDxDAT; due to that, a volume of 1 should never cause any output when the period is less than 64, but the same tests proved that there's a difference between a volume of 1 and a volume of 0, so I can't quite understand what's happening; maybe Paula scales the volume counter according to the period when the latter is less than 64? Last edited by saimo on 28-May-2024 at 10:58 PM. Last edited by saimo on 28-May-2024 at 02:28 PM. Last edited by saimo on 28-May-2024 at 02:28 PM.
_________________ RETREAM - retro dreams for Amiga, Commodore 64 and PC |
|
Status: Offline |
|
|
saimo
| |
Re: Hertz Overload - new AGA demo Posted on 10-Jun-2024 18:55:49
| | [ #14 ] |
|
|
|
Elite Member |
Joined: 11-Mar-2003 Posts: 2467
From: Unknown | | |
|
| @Gunnar
Quote:
According to the AHRM Paula performs no resampling whatsoever: it just reloads the output buffer registers whenever the period counters expire and there is no hardware limit to the periods. |
While discussing the audio matters we dealt with here plus other ones in the demo thread at EAB, I learned that you were right: as it's been discovered by others, Paula does perform resampling (at the DAC stage). I did a lot of testing (despite my limited equipment and knowledge) to try and see what happens with periods less than 64 (I'd widen the range of troublesome periods to all those that are non-multiple of 64), relatively to volume. Well, it turns out that Paula regulates the volume quite well (although not perfectly) even at small periods (click to see in full size):
In particular, at period 50 (the one used by the demo), volume 1 is handled (almost?) perfectly, so the demo sounds pretty well, without audible distortions (if it hadn't been so, I wouldn't have released the demo in first place, after all).Last edited by saimo on 10-Jun-2024 at 10:55 PM.
_________________ RETREAM - retro dreams for Amiga, Commodore 64 and PC |
|
Status: Offline |
|
|
saimo
| |
Re: Hertz Overload - new AGA demo Posted on 10-Jun-2024 18:56:12
| | [ #15 ] |
|
|
|
Elite Member |
Joined: 11-Mar-2003 Posts: 2467
From: Unknown | | |
|
| @all
I justed released an update that features even higher quality music - which is quite relevant for a music-centric demo ;)
CHANGELOG
v1.2 (10.6.2024) * Improved streamed music: made arpeggio and strumming guitars stronger in the mix; managed to eliminate some more peaks, thus exploiting more the resolution and increasing the overall quality; made an overlapping solo guitar enter from the middle-left and then move to the center gradually; converted data with an updated and more precise custom converter. * Increased the volume level of the arpeggio guitar in the tracked music. * Improved a few pixels. * Extended and fixed manual.
https://www.retream.com/Hertz_Overload / https://retream.itch.io/hertz-overload
https://www.youtube.com/watch?v=5mkJDGtZdr8 _________________ RETREAM - retro dreams for Amiga, Commodore 64 and PC |
|
Status: Offline |
|
|
Gunnar
| |
Re: Hertz Overload - new AGA demo Posted on 10-Jun-2024 19:23:57
| | [ #16 ] |
|
|
|
Cult Member |
Joined: 25-Sep-2022 Posts: 512
From: Unknown | | |
|
| @saimo
GUNNAR Quote:
According to the AHRM Paula performs no resampling whatsoever: it just reloads the output buffer registers whenever the period counters expire and there is no hardware limit to the periods. |
SAIMO: Quote:
I learned that you were right |
As I did re-build the chipset therefore I know a little how it works.
Quote:
Well, it turns out that Paula regulates the volume quite well (although not perfectly) even at small periods (click to see in full size): |
If you want to measure, then I would suggest to measure Volume 1/2/3 at the oversample rate - to see if this affects volume 1 maybe to sound like volume 2 or 3...
Which would change the 14bit music to 13bit ...
|
|
Status: Offline |
|
|
saimo
| |
Re: Hertz Overload - new AGA demo Posted on 10-Jun-2024 21:38:06
| | [ #17 ] |
|
|
|
Elite Member |
Joined: 11-Mar-2003 Posts: 2467
From: Unknown | | |
|
| @Gunnar
Quote:
As I did re-build the chipset therefore I know a little how it works. |
I don't mean to take away anything from your achievements neither to belittle your knowledge, but, generally speaking, reimplemening something according to whatever knowledge doesn't mean that such knowledge is perfect. In fact, in this specific case, you thought (according to the common knowledge) that volume wouldn't work with periods smaller than 64 - these are your own words from the previous posts:
The PAULA Amiga chip runs at ~3.5 MHz. Paula support 0-64 Volume. Paule creates the Volume by giving out the tone 64 times ... or not giving the tone out - for lower volume. This means to create the volume Paula needs 64 clock cycles.
I always though that this means you have in practice a maximum sample rate of 3.5 MHz/64 ~ 55Khz Because of the Volume generation of PAULA.
Maybe you can explain us how you solved this?
But if use the volume selection as you need for creating a 14bit effect, don't you then need to give PAULA the time to create the volume for each sample?
If you have less volume than 64 then PAULA will drive the output with a pattern of ON/OFF of the sample, which means that giving out this pattern will need 64 PAULA cycle. PAULA clocks with 3.5 MHz so 64 cycle mean 55KHz maximum that PAULA can do with volume creation.
However, it turned out that volumes work decently also with periods below 64. If volume regulation boiled down to just the counter mechanism, we wouldn't get those neat waveforms shown in the picture I posted (just to pick an easy example: a volume of 32 at period 32 or less would mean full volume all the time).
It looks like nobody fully knows yet how Paula manages the volume.
For the demo, I didn't have to solve anything, as the volume works quite fine by itself. And that was a key factor that contributed to my ignoring the volume completely during my experiments (the other factors were that: I was totally focused on reaching higher and higher frequencies while streaming, also on a stock Amiga 1200; I trusted these words of the AHRM in the "Using Direct (Non-DMA) Audio Output section: "The volume and period registers are set as usual"; above all, the output always sounded just fine regardless of the periods I was testing).
Quote:
If you want to measure, then I would suggest to measure Volume 1/2/3 at the oversample rate - to see if this affects volume 1 maybe to sound like volume 2 or 3... |
The point is that volume 1 at period 50 is almost identical to when the period is 64 (see the middle section of the picture). In fact, the demo music is played back without audible distortions (and, having written, arranged, played and mixed that music, believe me, I know quite well how it's supposed to sound like). If volume 1 sounded like volume 2 there would be a ~6 dB (i.e. huge) difference that would screw everything up. Maybe volume 2 sounds like volume 1? Well, I leave that to others (with better equipment than a cheap cable and an underpowered PC with an on-board audio chip) to find out. The tests I reported point in the direction that Paula adapts (with varying but acceptable degrees of success) to all the situations. Also, I can't take anymore of testing and I'm just happy that, as the ears initially indicated, the demo music sounds fine.Last edited by saimo on 10-Jun-2024 at 10:57 PM. Last edited by saimo on 10-Jun-2024 at 10:57 PM.
_________________ RETREAM - retro dreams for Amiga, Commodore 64 and PC |
|
Status: Offline |
|
|
Birbo
| |
Re: Hertz Overload - new AGA demo Posted on 11-Jun-2024 13:42:08
| | [ #18 ] |
|
|
|
Cult Member |
Joined: 5-Apr-2007 Posts: 602
From: Zurich, Switzerland | | |
|
| @saimo
Thank you very much for the detailed explanation! _________________ Sometimes we give people a lot of credit just because they're writing nice sentences even if it isn't adding up to much. |
|
Status: Offline |
|
|
saimo
| |
Re: Hertz Overload - new AGA demo Posted on 11-Jun-2024 22:40:26
| | [ #19 ] |
|
|
|
Elite Member |
Joined: 11-Mar-2003 Posts: 2467
From: Unknown | | |
|
| @Birbo
My pleasure! Today I made more tests and got more interesting results, which I'll share as soon as I manage to write the post.
@all
In the afternoon I discovered that the new music was way too noisy, so I realized that something must have gone wrong. It turned out that the last-minute changes to the custom converter were totally ill-advised and also buggy, so the converted music was affected by a horrible noise! I have uploaded the fixed version now - download from the usual place: https://retream.itch.io/hertz-overload _________________ RETREAM - retro dreams for Amiga, Commodore 64 and PC |
|
Status: Offline |
|
|
saimo
| |
Re: Hertz Overload - new AGA demo Posted on 12-Jun-2024 14:32:04
| | [ #20 ] |
|
|
|
Elite Member |
Joined: 11-Mar-2003 Posts: 2467
From: Unknown | | |
|
| Latest findings...
A few days ago I had measured a volume discrepancy of -37.035+37.130 = 0.095 dB when playing a full-amplitude sine tone at volume 1 and periods 64 and 50, with the latter giving a louder output (click the pictures for full size):
I couldn't scratch that difference off my mind, so I thought that maybe I should change the converter to take that into consideration when converting to 14 bits. First, I asked myself, which virtual volume in the Paula linear scale would give a difference of 0.095 dB against the volume produced by AUDxVOL set to 1, without distortions caused by the period? Unfortunately the AHRM, at page 163, just provides a table that lists all the <volume, dB> couples. From those numbers, I derived the formula
20*log(AUDxVOL/64)
(with the convention that log(0) = -infinity). I don't know for sure if it's correct, but it provides values that, when rounded, match exactly those in the AHRM. The question could thus be formulated as follows:
[dB given by the virtual volume x] minus [dB given by volume 1]
i.e.
20*log(x/64) - 20*log(1/64) = 0.095
Doing the maths leads to
x = 10^(0.095/20) = 1.0109973098876536037870941273379.
Let's counter-check:
20*log(1.0109973098876536037870941273379/64) - 20*log(1/64) = -36.028599479677743425648667366939 + 36.123599479677743425648667366939 = 0.095
OK, it works.
Therefore, in theory, the low 6 bits of samples should be somehow scaled down according to a factor of 1.0109973098876536037870941273379. Uhm... I smell precision issues. Also, which is the relationship between volume (AUDxVOL) and amplitude (AUDxDAT)? It is known that, at least in practice, it is not linear (hence the need to calibrate the 14 bit playback). I've been pondering a little bit on it and came up with 20*log(abs(AUDxDAT/128)*(AUDxVOL/64)) (about whose correctness I'm all but sure), but before diving deeper I thought I'd better make more precise tests.
Given that the sampled sine tone suffered from a little volume loss in general, I decided to go back to a square tone (as I had intended to anyway):
And here's the same tone sampled from the Amiga:
The last step was to sample the tone playing it at volume 1 with periods 64 and 50. However, this time I put extra care in removing those weird peaks shown in the first picture (they are not really peaks: periodically Paula introduces a little DC offset, and does so for many - if not all - combinations of volume and period). After removing them from a 5 seconds sample, the result was:
I was utterly (and of course pleasantly) surprised that the volumes matched perfectly.
Conclusion: Paula handles the volume regulation surprisingly well (although, as already said, not perfectly) and, at least for the specific case of Hertz Overload, I must no longer worry about the extra distortion introduced by period 50.
Side note: I've been plugging and unplugging the cable into the PC line-in so many times these days that the jack is becoming a bit loose; I intended to sample also the noise floor of my machine, but I'll refrain from doing that.
EDIT: fixed issue with < and >. Last edited by saimo on 17-Jun-2024 at 12:32 PM. Last edited by saimo on 17-Jun-2024 at 12:31 PM. Last edited by saimo on 12-Jun-2024 at 03:27 PM.
_________________ RETREAM - retro dreams for Amiga, Commodore 64 and PC |
|
Status: Offline |
|
|