![]() |
![]() |
#61 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,917
|
Quote:
Btw - i produce wav files with signed 8 bit integer - not sure how your application will deal with this but i wanted to keep it same as 8svx. |
|
![]() |
![]() |
#62 | |
Registered User
Join Date: Oct 2019
Location: USA
Posts: 47
|
Quote:
I just worry it doesn't get much used because of the high cpu demand. Do you know/considered Kippened' work used on "The Martini effect demo"? https://www.pouet.net/prod.php?post=920727 |
|
![]() |
![]() |
#63 | ||
Registered User
Join Date: Aug 2010
Location: Italy
Posts: 901
|
Quote:
Quote:
Tomorrow I'll make tests with your script. Now I have just made a few listening tests as follows: * reduced the Sony music snippet by 20 dB (just to decrease the SNR drastically); * with Reaper, I converted the waveform to various 8 and 16 bit WAVs, both with and without noise shaping and dithering; * converted them to AQAx; * listened to them on the Amiga. Result: 14 55420 [NS+D] > 8 55420 NS+D > 8 96000 NS+D > 8 96000 where: * 8 14 = bit depth * 55420 96000 = frequency * NS+D = noise shaping + dithering * > = betten than Noteworthy: * 8 55420 NS+D sound less noisy and distorted than 8 96000 NS+D! * regarding the 14 bit waveforms, I have a hard time noticing any improvement brought by the noise-shaping and dithering; * the 14 bit waveforms sound immensely better than the 8 bit ones, as I can't hear any noise. Please note that I made these tests with aching ears (using headphones has always been a pain to me), so I played the files only once or at most twice when I was in doubt; on top of that, I'm deadly tired and my head spins due to sleep deprivation. I mean, these tests are all but reliable. Here are the files for everyone to make their own tests (and possibly proper measurements): 96000 Hz 32 bit WAV (base file) 55420 Hz 16 bit WAV 55420 Hz 14 bit AQA1 55420 Hz 16 bit noise-shaped&dithered WAV 55420 Hz 14 bit noise-shaped&dithered AQA1 96000 Hz 8 bit WAV 96000 Hz 8 bit AQA0 96000 Hz 8 bit noise-shaped&dithered WAV 96000 Hz 8 bit noise-shaped&dithered AQA0 55420 Hz 8 bit noise-shaped&dithered WAV 55420 Hz 8 bit noise-shaped&dithered AQA0 Last edited by saimo; 10 June 2024 at 23:08. Reason: Fixed typo. |
||
![]() |
![]() |
#64 | |||
Registered User
Join Date: Aug 2010
Location: Italy
Posts: 901
|
Thanks!
Quote:
![]() I guess that CPU-driven playback is practically usable only for a non-multitasking player (actually an idea that preceded the demo was to make a simple and dedicated player - no DeliTracker, I mean - to play the music I made for SkillGrid, THE CURE, BOH and this demo plus another piece in "superior" quality). Quote:
Quote:
Last edited by saimo; 10 June 2024 at 23:10. Reason: Fixed typo. |
|||
![]() |
![]() |
#65 | |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,861
|
Quote:
![]() |
|
![]() |
![]() |
#66 | |
Registered User
Join Date: Aug 2010
Location: Italy
Posts: 901
|
Quote:
By the way, reading that comment made me realize that, at least numerically, it is possible to surpass the 16 bit resolution (by just a trifle) - for example, for the right side: * AUD0DAT: 8 bit data * AUD3DAT: 8 bit data (just additional bits for the same sample) * AUD0VOL: 6 bit (+1) volume * AUD3VOL: 6 bit (+1) volume The data registers provide 9 bit resolution (with a little DC offset) and the volume registers provide 7 bit (+ something) resolution, for a total of 16 bit (plus something) resolution. The downside is that, for 16 bits, 32 bits = 4 bytes are required (plus all the usual timing and phase issues). Last edited by saimo; 31 May 2024 at 21:15. Reason: Fixed typo. |
|
![]() |
![]() |
#67 | |
Registered User
Join Date: Aug 2010
Location: Italy
Posts: 901
|
Quote:
If that's the case: * contrary to what I wrote above, the upper-byte and lower-byte channels stay in sync, but a distortion happens because the volume counter never executes all the 64 cycles (the context here is 14-bit playback with period < 64); * in theory, it should be possible to compensate the distortion by scaling the lower byte value accordingly (so, going below the 6 bits precision), but I guess that it isn't a matter of just multiplying by period/64 (for the same reason that the 14-bit trick requires calibration). Even if I was pretty hopeless, as I don't have an oscilloscope or any other appropriate device, I tried to find out visually: I generated a sinus tone at 64489 Hz (= 3546895/55), played it on my A1200, sampled the output on the PC at 64489 x1/x2/x3 and checked whether the resulting waveform showed some sort of pattern that could indicate "first sample of a word OK", "second sample of a word not quite OK"; the result was instead a pretty regular sinusoid where any irregularity was due to the recording phase (there was no way to sync playback and recording start) and real world interferences. So, is it known/proven whether the volume counter resets when the second sample of a word starts? By the way, according to the sampling tests, my A1200 has a dynamic range of 117.984 dB: considering the human hearing range, that sounds plausible/correct, right? Tangentially, another thing that keeps on bugging me: given the volume counter mechanism, volume should not work fine for any period non-multiple of 64, not just for periods < 64... or am I missing something? (Please bear with me: I'm pretty sure these matters have been discussed elsewhere, but my searches here failed to provide me with the answers.) Last edited by saimo; 10 June 2024 at 23:14. Reason: Fixed broken English. |
|
![]() |
![]() |
#68 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,917
|
Quote:
Secondly i produce another wav file (ends with "_play.wav") - 24 bit 48000Hz sample rate so it can be listened on general PC to simulate how it should sounds on real Amiga HW - there is also applied inverted Amiga low pass filter. If your audio on PC sounds different then this must be something related to way how signal is processed trough signal chain in OS. Code:
@setlocal @REM Where to Find SoX @set SoX=C:\sox @set PATH=%PATH%;%SoX% @set PAL=28375160 @set NTSC=28636363 @rem lipshitz, f-weighted, modified-e-weighted, improved-e-weighted, gesemann, shibata, low-shibata, high-shibata @set noiseshp=improved-e-weighted @rem LowPassFilter F= @rem Amiga 500/2000: 4.42 kHz (100 nF, 360 ?) @rem A600: 4.42 kHz (100 nF, 360 ?)11 @rem A1200 Rev1d: 27.7 kHz (3.9 nF, 1.5 k?) @rem A1200 Rev2: 34.4 kHz (6.8 nF, 680 ?) @rem A4000: 4.52 kHz (47 nF, 750 ?) @SET LPF=4420 @SET /a CLK=%PAL%/8 @rem set Paula period (DEC) @SET PERIOD=55 @SET /a AFREQ_I = (((100*%CLK%)/(1*%PERIOD%))+1) / 100 @SET /a AFREQ_F = (((100*%CLK%)/(1*%PERIOD%))+1) %% 100 @SET AFREQ=%AFREQ_I%.%AFREQ_F% @SET /a APREC_I = (((100*%CLK%)/(8*%PERIOD%))) / 100 @SET /a APREC_F = (((100*%CLK%)/(8*%PERIOD%))) %% 100 @SET APREC=%APREC_I%.%APREC_F% @SET /a SINCU=%APREC_I% * 3 @SET file=%1 @SET fname=%~n1 @ECHO file=%file% @ECHO: @ECHO filename=%fname% @ECHO: @ECHO -------------------------- @ECHO: @ECHO Samplerate=%AFREQ%Hz @ECHO: @ECHO -------------------------- @ECHO: @ECHO Precompensation=%APREC%Hz @ECHO: @ECHO -------------------------- @ECHO: @ECHO Amiga LowPass freq=%LPF%Hz @ECHO: @ECHO -------------------------- @ECHO: @ECHO SINC Upper Freq=%SINCU%Hz @ECHO: @ECHO -------------------------- @ECHO: @pause @rem SET aproc= @rem SET aproc=sinc 16-13.85k treble +6.0206 %LPF% .5 treble +6.0206 %APREC% .5 compand 0.25,1 6:-inf,-90.1,-inf,-90,-75,-70,-70 -3.0103 -90 0.20 @rem SET aproc=sinc 16-%SINCU% treble +6.0206 %LPF% 0.1s treble +6.0206 %APREC% 0.1s gain -n -0.034129 @SET aproc=sinc 16-%SINCU% treble +20 %LPF% 0.25s treble +3.0103 %APREC% 0.25s gain -n -0.034129 @rem set clip= @rem set clip=gain -n -1.769537 @rem set clip=gain -n -2.110204 @rem set clip=gain -n -2.153742 @rem set clip=gain -n -2.197500 @set clip=gain -n -0.526579 @rem mono @rem sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V4 -D -G %file% -e float -b 32 -t f32 "%fname%.f32" remix - rate -v -s -I %AFREQ% %aproc% stats -b 8 stat @rem sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V6 -D -c 1 -r 48299 -e float -b 32 -t f32 "%fname%.f32" -c 1 -b 8 -e signed-integer -t s8 "%fname%.s8" %clip% dither -f %noiseshp% -p 8 stats -b 8 stat @rem sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V6 -D -c 1 -r %AFREQ% -b 8 -e signed-integer -t s8 "%fname%.s8" "%fname%.8svx" @rem sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V6 -D -c 1 -r %AFREQ% -b 8 -e signed-integer -t s8 "%fname%.s8" "%fname%_%noiseshp%.wav" @rem sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V6 -D -c 1 -r %AFREQ% -e float -b 32 -t f32 "%fname%.f32" -n spectrogram -z 96 -q 13 -w Kaiser -y 513 -x 496 -o "%fname%_32.png" @rem sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V6 -D -c 1 -r %AFREQ% -e signed-integer -b 8 -t s8 "%fname%.s8" -n spectrogram -z 96 -q 13 -w Kaiser -y 513 -x 496 -o "%fname%_8.png" @rem stereo @sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V4 -D -G %file% -e float -b 32 -t f32 "%fname%.f32" rate -v -s -I %AFREQ% %aproc% stats -b 8 stat @sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V6 -D -c 2 -r 48299 -e float -b 32 -t f32 "%fname%.f32" -c 2 -b 8 -e signed-integer -t s8 "%fname%.s8" %clip% dither -f %noiseshp% -p 8 stats -b 8 stat @rem sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V6 -D -c 2 -r %AFREQ% -b 8 -e signed-integer -t s8 "%fname%.s8" "%fname%.8svx" @sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V6 -D -c 2 -r %AFREQ% -b 8 -e signed-integer -t s8 "%fname%.s8" "%fname%_%noiseshp%.wav" @sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V6 -D -c 2 -r %AFREQ% -e float -b 32 -t f32 "%fname%.f32" -n remix - spectrogram -z 96 -q 13 -w Kaiser -y 513 -x 496 -o "%fname%_32.png" @sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V6 -D -c 2 -r %AFREQ% -e signed-integer -b 8 -t s8 "%fname%.s8" -n remix - spectrogram -z 96 -q 13 -w Kaiser -y 513 -x 496 -o "%fname%_8.png" @sox --multi-threaded --buffer 524288 --input-buffer 524288 -S -V4 -D -G "%fname%_%noiseshp%.wav" -e signed-integer -b 24 "%fname%_%noiseshp%_play.wav" treble -20 %LPF% 0.25s treble -3.0103 %APREC% 0.25s rate -v -s -I 48000 gain -n -0.034129 stats -b 8 stat @del -q "%fname%.f32" @del -q "%fname%.s8" @pause @endlocal Btw if someone searching for audio analyzer and audio generator i can highly recommends this piece of jewel - to be honest i never saw before such excellent tool even for big bucks: https://www.roomeqwizard.com/ Last edited by pandy71; 31 May 2024 at 21:07. Reason: Modified script slightly - result file should provide flat response - tested with multitone signal |
|
![]() |
![]() |
#69 |
Registered User
Join Date: May 2017
Location: Munich/Bavaria
Posts: 2,502
|
The way the volume reduction works on real hardware (on-off-switching), I would be suspicious about any volume below max
|
![]() |
![]() |
#70 | ||
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,917
|
Quote:
Quote:
Last edited by pandy71; 31 May 2024 at 20:17. |
||
![]() |
![]() |
#71 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,861
|
A bit off topic, are there any computationally inexpensive noise shaping that can be applied to 8 bit quantised data at more pedestrian sample rates?
|
![]() |
![]() |
#72 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,917
|
Quote:
|
|
![]() |
![]() |
#73 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,861
|
I was just curious about the general problem. Since quantisation noise is strongly correlated with the input signal, it's more conspicuous than white noise. Does a basic noise injection pre-quantisation help change the perception of the quantisation noise into something less intrusive?
|
![]() |
![]() |
#74 |
Registered User
Join Date: Aug 2010
Location: Italy
Posts: 901
|
Just for clarity: I have not tested your scripts yet and my previous report was based on processing performed with Reaper. Today I couldn't find the time to try the scripts, but I'll do that as soon as possible.
And, of course, thanks also for this alternative script! |
![]() |
![]() |
#75 | ||
Registered User
Join Date: May 2017
Location: Munich/Bavaria
Posts: 2,502
|
Quote:
![]() I guess on 28kHz or lower one could try noise shaping into the lower frequency band, like the article on Wikipedia on noise shaping shows. its essentially a low-pass filter and the quantization noise should be shifted to lower frequencies (instead of higher inaudible frequencies as usually) - and part of the noise would go below 20Hz and therefor also be inaudible. Quote:
if we set b to 0.5 we can use a shift operation and this would not very much onto a normal 16bit to 8bit conversion. Last edited by Gorf; 31 May 2024 at 21:29. |
||
![]() |
![]() |
#76 | ||
Registered User
Join Date: Aug 2010
Location: Italy
Posts: 901
|
Quote:
Quote:
Overall linear view: ![]() dB view: ![]() Linear view of snippet from the middle of the waveform: ![]() dB view of of snippet from the middle of the waveform: ![]() Measurement with two different tools: ![]() It looks like the range is 1.1144*2 = 2.2288 dB from 120 dB, i.e. 120-2.2288 = 117.7712 dB. I guess I'm doing something wrong? Remember I'm pretty ignorant ![]() Edit: ah, wait! I know now! I was considering the whole positive-negative range! In absolute, the range is 60-1.1144 = 58.8856 dB. That's it, right? Last edited by saimo; 31 May 2024 at 21:36. Reason: I had written "That it's" instead of "That's it". I really can't think straight. I'd need some 5 years of rest... |
||
![]() |
![]() |
#77 | ||
Registered User
Join Date: May 2017
Location: Munich/Bavaria
Posts: 2,502
|
Quote:
how about halve volume or minimum volume - would we see any distortions of the sine wave - probably best seen in spectrum analysis of that part. Quote:
|
||
![]() |
![]() |
#78 | |
Registered User
Join Date: Aug 2010
Location: Italy
Posts: 901
|
Quote:
If the volume counter resets also for the second sample of a word: 1. a sample starts playing and the volume counter starts from 0; 2. during the first 64 cycles, the volume counter loops once and the sample gets sent to the DAC only during the first 32 cycles (i.e. half of the time); 3. the same repeats in the next 64 cycles; 4. during the next 16 cycles the sample gets sent to the DAC all the time and then... 5. ... the period counter expires, the second sample starts playing, the volume counter restarts from 0... 6. ... and so on. The resulting on-off pattern is (digits = sample number): 00--00--011--11--122--22--2--... But, ideally, given that the volume is 32, it should have simply alternated like this: 0-1-2... Therefore, every time the period expires, there's a volume distortion. If the volume counter does not reset for the second sample of a word: 1. a sample starts playing and the volume counter starts from 0; 2. during the first 64 cycles, the volume counter loops once and the sample gets sent to the DAC only during the first 32 cycles; 3. the same repeats in the next 64 cycles; 4. during the next 16 cycles the sample gets sent to the DAC all the time and then... 5. ... the period counter expires, the second sample starts playing, the volume counter keeps on counting from 16; 6. during the first 64 cycles, the second sample gets sent to the DAC for 16 cycles (when the volume counter goes from 16 to 31), then the volume counter wraps around after 32 cycles, and the sample gets sent to the DAC for other 16 cycles; 7. the same repeats for the next 64 cycles; 8. in the next 16 cycles the sample gets sent to the DAC and then... 9. ... the period counter expires, the second sample starts playing, the volume counter restarts from 0...10. ... and so on. The resulting pattern is: 00--00--01--11--12-- There is a phase issue (which is not too bad because I have used multiples of 16, but things are not this smooth with unrelated periods and volumes). Or is there some magic just before / at the DAC stage that somehow deals with all of this? (What a pain to make these posts with line breaks not working!) Last edited by saimo; 10 June 2024 at 23:17. Reason: Fixed line breaks and broken English. |
|
![]() |
![]() |
#79 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,917
|
Quote:
|
|
![]() |
![]() |
#80 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,917
|
Quote:
|
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
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 |
|
|