English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 10 February 2021, 10:53   #101
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 3,213
@meynaf: yesterday I did an edit to an answer to Don_Adan to indicate what a big problem is: http://eab.abime.net/showpost.php?p=...3&postcount=69

Even if you correct the phase 'manually', syncing the AUDxDATs writes (if and only if it is truly ascertained that it is due to that) then you cannot use anymore the DMA.
And this would be a very big limitation (especially to maintain a constant flow at high frequencies).
ross is offline  
Old 10 February 2021, 11:02   #102
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 48
Posts: 4,237
Quote:
Originally Posted by ross View Post
@meynaf: yesterday I did an edit to an answer to Don_Adan to indicate what a big problem is: http://eab.abime.net/showpost.php?p=...3&postcount=69

Even if you correct the phase 'manually', syncing the AUDxDATs writes (if and only if it is truly ascertained that it is due to that) then you cannot use anymore the DMA.
And this would be a very big limitation (especially to maintain a constant flow at high frequencies).
But if this is Agnus timings that give the phase shift, it becomes known. As data is obtained at fixed times.
And if not, then we can attempt to alter it.
So it all boils down to knowing what exactly gives said phase shift.
meynaf is offline  
Old 10 February 2021, 11:21   #103
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Quote:
Originally Posted by ross View Post
@orangespider, if you agree, we need to change the thread topic, at this point it is misleading.

At the beginning I was skeptical that it could work properly, and in fact the spikes due to the coupled additive and subtractive approach, plus the phase shifting of the channels, generates too strong distortions and noise, if done with a direct conversion.
But the method is now different and evolved.

The conversion from the 16-bit input signal to the output signal is no longer linked by a surjective function, as in the case of C = V(64) + V(1)), but is now (from the clever trick of swapping channels onward) more a black box containing real time operations and filtering.

So, what do you think of:

"Alternative approch to play 16bit audio samples with Paula quasi-14bit"

or similar?
I don't see any option to change thread name.


Quote:
Originally Posted by meynaf View Post
Of course they are both delayed.
When DMA fetches the first sample, it sends it to AUDxDAT. If this starts the counter, then all subsequent samples will also be shifted, and by the exact same amount.
So what matters is the exact time the very first sample is sent.
That is a big if imho.

Quote:
Originally Posted by meynaf View Post
But if this is Agnus timings that give the phase shift, it becomes known. As data is obtained at fixed times.
And if not, then we can attempt to alter it.
So it all boils down to knowing what exactly gives said phase shift.
The reason isn't as important (unless you want to somehow make it disappear which I am still skeptical about) as the actual timing of the shift.

I think I know how we can find out how big the shift exactly is. Since we know it is less than 0.5 because the noise is amplified if I use the LUT approach and delay the 63 values by 1 sample. So, in that case we can do this.

measurement 1:
channel 0 data: 255,-255,255,-255
channel 3 data: 0, 0, 0, 0

measurement 2:
channel 0 data: 255, -255, 255, -255
channel 3 data: -255, 255, -255, 255

we loop with these values forever and sample the output. then we measure the amplitude of the resulting audio and we have the phase shift. If the audio amplitude of measurement 2 is the same as measurement 1, then the phase shift is exactly 0.5, if measurement 2 results in silence, then the shift is 0 and in between the amplitude changes linearly depending on the shift.
orangespider is offline  
Old 10 February 2021, 11:34   #104
nikosidis
Registered User

 
Join Date: Jan 2020
Location: oslo/norway
Posts: 766
I got new handle for you :P
Pytagoras Orangespider
nikosidis is offline  
Old 10 February 2021, 12:38   #105
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL
Posts: 1,731
If there is any chance for using 2 audio channels with normal DMA to play samples but in interleaved way - like for example |cn| where c means Channel and n is sample e.g. 00,10,01,11,02,12,03,13 etc? If yes and samples can be interleaved then easily 8 bit but double speed audio (without productivity) can be created and this together with aggressive noise shaping should provide HQ samples - similar to 14 bit mode but without too many complications...
pandy71 is offline  
Old 10 February 2021, 12:57   #106
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 3,213
Quote:
Originally Posted by pandy71 View Post
If there is any chance for using 2 audio channels with normal DMA to play samples but in interleaved way - like for example |cn| where c means Channel and n is sample e.g. 00,10,01,11,02,12,03,13 etc? If yes and samples can be interleaved then easily 8 bit but double speed audio (without productivity) can be created and this together with aggressive noise shaping should provide HQ samples - similar to 14 bit mode but without too many complications...
Hi pandy71, with the phase shift that seems to be there, impossible in DMA mode.
In any case then you should modify the samples on both channels, as they work in hold mode (but that would be simple )
ross is offline  
Old 10 February 2021, 12:57   #107
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Quote:
Originally Posted by pandy71 View Post
If there is any chance for using 2 audio channels with normal DMA to play samples but in interleaved way - like for example |cn| where c means Channel and n is sample e.g. 00,10,01,11,02,12,03,13 etc? If yes and samples can be interleaved then easily 8 bit but double speed audio (without productivity) can be created and this together with aggressive noise shaping should provide HQ samples - similar to 14 bit mode but without too many complications...
Actually my last 2 exe files already double the playback frequency like that. It's just not 100% correct because we don't know the exact shift yet. The idea is something like this:

c0: 0000.1111.2222.3333.4444
c3: x000.0111.1222.2333.3444

So you have say 25% of 0 and 75% of 1 from c3 while c0 is holding 1. So you can then get those 2 values to compensate to 2 values from the original file. Say you wanted to play 10 and 14 during 1 frequency tick. You would have to adjust 01, 30 and 31 to produce what you want. But to get to the exact values, you need to know the exact shift.

edit: For the example above we would already have the 30 set in the previous sample, let's say it was 8. So to get 10 and 14, we would have to set 01 at 4 and 31 at 24, which would then give us for the first half of the sample:
(8 + 4*2 + 24)/4 = 10
and for the other half:
(4+24)/2 = 14

This is one of the things my program currently does, altho it does with an assumed phase shift value which is incorrect. But it also spreads the errors and has the channels set to volume 64 and 63 to be able to get a greater number of combinations.

Last edited by orangespider; 10 February 2021 at 13:08.
orangespider is offline  
Old 10 February 2021, 13:04   #108
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 3,213
Quote:
Originally Posted by orangespider View Post
Actually my last 2 exe files already double the playback frequency like that.
Well, in your case is in a software way (like an oversampling).
I think pandy71 mean an interleaved split from the original sample in high frequency, using an halved frequency.
ross is offline  
Old 10 February 2021, 13:12   #109
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 52
Posts: 1,303
Quote:
Originally Posted by ross View Post
The problem here is that it is unclear how much the phase difference is, and even if it is possible to start DMA channels with such a precise delay..

EDIT: if Paula's internal counters are initialized at the first AUDxDAT write then it is useless to delay the start of the DMA, because even 'de-synced' start is fixed by Agnus' scheduler (you could delay it of a "scanline time", but it wouldn't make sense ..).
Yes, in case you could do it manually but then it would be just a proof of concept.
You like tests
For me you can choose very good quality mono 16 bit raw sample, 256KB length. Set only left channels 2 buffers, every 128KB (AudLen = $0000). And try to choose the best 64 and 63 tables for left channel. Later set right channel only and choose different (best) tables 64 and 63 tables for right channel. Fiinally you will be have 4 tables for 4 Amiga channels.
Don_Adan is offline  
Old 10 February 2021, 13:12   #110
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Quote:
Originally Posted by ross View Post
Well, in your case is in a software way (like an oversampling).
I think pandy71 mean an interleaved split from the original sample in high frequency, using an halved frequency.
No, that's not what is happening. I am actually using the phase shift to get 2 values within 1 frequency tick, that's why I need double the frequency for the source.

edit: The sample I am talking about is this one:
http://s000.tinyupload.com/index.php...43813088953288

If you listen to it you'll notice there are frequencies in there that shouldn't exist at 27710. Altho since I am using wrong shift values, the output is not good enough yet.
orangespider is offline  
Old 10 February 2021, 14:16   #111
SpeedGeek
Moderator
SpeedGeek's Avatar
 
Join Date: Dec 2010
Location: Wisconsin USA
Age: 57
Posts: 567
Quote:
Originally Posted by orangespider View Post
I don't see any option to change thread name.
The moderating staff can do this for you but you will need to make a specific request for this to happen.
SpeedGeek is offline  
Old 10 February 2021, 14:27   #112
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 3,213
Quote:
Originally Posted by Don_Adan View Post
For me you can choose very good quality mono 16 bit raw sample, 256KB length. Set only left channels 2 buffers, every 128KB (AudLen = $0000). And try to choose the best 64 and 63 tables for left channel. Later set right channel only and choose different (best) tables 64 and 63 tables for right channel. Fiinally you will be have 4 tables for 4 Amiga channels.
Hi Don , sorry, I'm not sure I understand what you mean..

Quote:
Originally Posted by orangespider View Post
No, that's not what is happening. I am actually using the phase shift to get 2 values within 1 frequency tick, that's why I need double the frequency for the source.
Ok, I saw your (two) edits with the additions only after
ross is offline  
Old 10 February 2021, 14:32   #113
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Ok, so nikosidis and I have finished the measurement process and I know the actual phase shift. It appears to be around 4 bus cycles or 1/886718.75 seconds on a PAL screen regardless of the playback frequency - which btw is the exact delay of DMA writes.

edit:
At 27710Hz this translates exactly into:
channel0 start: 0/32 samples
channel1 start: 1/32 samples
channel2 start: 2/32 samples
channel3 start: 3/32 samples

edit 2:
At any AUDxPER the delay translates into this:
channel0 start: 0/AUDxPER samples
channel1 start: 4/AUDxPER samples
channel2 start: 8/AUDxPER samples
channel3 start: 12/AUDxPER samples

Don't know about the scandoubled values though, they might or might not differ.

Last edited by orangespider; 10 February 2021 at 14:47.
orangespider is offline  
Old 10 February 2021, 14:45   #114
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 3,213
Quote:
Originally Posted by orangespider View Post
Ok, so nikosidis and I have finished the measurement process and I know the actual phase shift. It appears to be around 4 bus cycles or 1/886718.75 seconds on a PAL screen regardless of the playback frequency - which btw is the exact delay of DMA writes.
AUxDATA write by DMA is spaced 2 bus cycles, 1 bus cycle is 3546895Hz (~282ns), so is double the DMA writes.
ross is offline  
Old 10 February 2021, 15:00   #115
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Quote:
Originally Posted by ross View Post
AUxDATA write by DMA is spaced 2 bus cycles, 1 bus cycle is 3546895Hz (~282ns), so is double the DMA writes.
I wonder if the read isn't 2 cycles as well... Imagine reading volume and data and using 4 cycles for that. Could be an explanation?
orangespider is offline  
Old 10 February 2021, 15:08   #116
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 3,213
Quote:
Originally Posted by orangespider View Post
I wonder if the read isn't 2 cycles as well... Imagine reading volume and data and using 4 cycles for that. Could be an explanation?
No, in a cycle 2 samples for a channel are read, then there is an idle cycle free for those who request it (CPU/Copper/Blitter), then the next channel.
Maybe something related to DMAL?
ross is offline  
Old 10 February 2021, 15:15   #117
Gorf
Registered User

Gorf's Avatar
 
Join Date: May 2017
Location: Munich/Bavaria
Posts: 1,309
Quote:
Originally Posted by orangespider View Post
Ok, so nikosidis and I have finished the measurement process and I know the actual phase shift. It appears to be around 4 bus cycles or 1/886718.75 seconds on a PAL screen regardless of the playback frequency - which btw is the exact delay of DMA writes.

edit:
At 27710Hz this translates exactly into:
channel0 start: 0/32 samples
channel1 start: 1/32 samples
channel2 start: 2/32 samples
channel3 start: 3/32 samples

edit 2:
At any AUDxPER the delay translates into this:
channel0 start: 0/AUDxPER samples
channel1 start: 4/AUDxPER samples
channel2 start: 8/AUDxPER samples
channel3 start: 12/AUDxPER samples

Don't know about the scandoubled values though, they might or might not differ.
This delay should stay exactly the same for 31kHz screen modes.

But percentage or degree wise the influence is bigger on shorter periods (= higher playback frequency)

So 12 cycles delay are <10% for a 128 ticks period or ~33° phase for 27kHz

But for a 64 ticks period this are ~19% or 67.5° phase mismatch at 54kHz...

(that is for channel 0+3)

For channel 1+2 it is no problem at all for normal PAL and and can maybe even be neglected for 54kHz playback, or should at least be fine with your "dominance switch avoidance".

Last edited by Gorf; 10 February 2021 at 15:28.
Gorf is offline  
Old 10 February 2021, 15:47   #118
Gorf
Registered User

Gorf's Avatar
 
Join Date: May 2017
Location: Munich/Bavaria
Posts: 1,309
For the 0+3 channel @54kHz playback we could maybe take the following approach:

we would need a high quality audio sample and convert it to 5x of our target frequently - in this case 277kHz.

for every point in time a regular 54kHz playback would need we have now 4 additional points between them.
Let's call them t0, t1, t2 t3, t4
t0 is the time channel 0 starts playing - the next value comes in at t(0+5)
t1 is due to the delay of about 20% or 1/5 the time channel 3 starts playing - the next value comes in at (t1+5)

at t0 channel 0 needs to play a value that in combination with the previous value of channel 3 at time t(1-5) represents the desired "14.5bit" value at the timecode t0 of our 277kHz sample.

at t1 channel 3 needs to play a value that in combination with the value we did put in channel 0 at t0 gives us a good representation of the value at the timecode t1 of our 277kHz sample.

the values at timecode t2, t3 and t4 of our 277kHz sample are ignored and we repeat our procedure at t(0+5) ....

Last edited by Gorf; 10 February 2021 at 15:55.
Gorf is offline  
Old 10 February 2021, 15:51   #119
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 3,213
Quote:
Originally Posted by ross View Post
Maybe something related to DMAL?
Nah .. this can't be the case, deleted

Last edited by ross; 10 February 2021 at 16:09.
ross is offline  
Old 10 February 2021, 16:39   #120
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 46
Posts: 24,699
Bit late answer but I wasn't sure if this thread will become one of those threads or not..

But yes, volume counter is reset when: audio channel state transitions from 0 to 2 (=Copper/CPU AUDxDAT write) or DMA does AUDxDAT write (channel's horizontal slot position) and state is 5.

Check "volcntrld" in HRM audio state diagram.

I think it can be reset manually by doing this:
1: Make sure audio channel is idle.
2: CPU/copper write to AUDxDAT. Volume counter is reset. (Probably needs copper to guarantee correct timing?)
3: Switch DMA on. DMA mode "starts" and volume counter is not reset because state transition from 5 to 2 didn't happen.
4: Audio continues in DMA mode with original AUDxDAT position "synced" volume counter.

Step 3 needs extra care because DMA must be switched on before period has counted down. It also bypasses stages 1-5-2 which means DMA continues from previously latched position, which is not necessarily same as AUDxLC, same with AUDxLEN. To make this work, you probably need to start normal audio DMA first, wait a bit, turn off DMA. Wait until audio state is back to zero. Now AUDxLC and AUDxLEN has been "prelatched". Then continue with step 1.

This is not tested but should work
Toni Wilen is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
15 bit 44 khz audio idea. Thorham Coders. General 31 17 February 2021 08:51
24 or 32 bit audio capture within WinUAE EAUniW support.WinUAE 7 17 September 2018 22:22
Questions about 14 bit audio playback xxxxx Coders. Asm / Hardware 16 22 December 2014 19:30
High Quality reproduction of Audio on 8 bit. pandy71 Amiga scene 0 01 July 2013 15:08
Simple 14 bit audio question... Thorham Coders. General 7 06 June 2010 10:55

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 04:43.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.10715 seconds with 16 queries