Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Re: Lance's 50khz playroutine
Posted by: ljbk Feb,28.2013-15:47 

i !

The hack is not ready yet !

Here is a bit more of the text ... Let's hope it fits ! :)

; 4 Lance's solutions to each small problem
; -----------------------------------------
; Now we will visit again each problem in the reverse order.
; The first choice is that the BPM feature is not emulated by this
; version. This means that the MOD control is done at every VBL.
; This with a replay rate of 50 KHz, this means that we have to update
; the DMA buffer with 50000 / 50 VBLs = 1000 blocks of Left and Right
; data at every VBL. For 25 KHz we would have only 500.
; The dividers for variable speed reading found in the Protacker tables
; go from 108 to 907 (mt_periodtable).
; Considering the european PAL Amiga clock rate of 7.09379 MHz (and not
; simply 7.09 MHz found in this source), this means reading from memory
; at rates from: 7093790/(2x108) = 32841.6 Hz to 7093790/(2x907) = 3910.6
; Hz. Considering the VBLs, this means reading from 32841.6 / 50 = 656.8
; bytes per VBL down to 3910.6 / 50 = 78.2 bytes per VBL for each voice.
; So we have to produce 1000 8 bit mixing values with a maximum of 657
; reads per VBL for each voice. One can see that the maximum read speed
; compared to the mixing speed is lower than 1: 657 / 1000 = 0.657
; This means that we can use the simplest addressing mode for reading:
; move.b (An)+,... or add.b (An)+,...
; This is where we have the first problem at 25 KHz. As we have only to
; produce 500 mixing results per VBL, we have 657 / 500 = 1.314 which is
; bigger than 1 but lower than 2. This means that for a part of the
; dividers one can not apply the simplest addressing mode: one has to
; read 2 times or correct the pointer: move.b (An)+,... move.b (An)+,...
; or addq #1,An move.b (An)+,... This is slower ...
; One can also limit the MOD to use dividers up to the case where we get
; to the limit: 7093790 / 500 updates / 50 VBLs / 2 = 141.9. This means
; dealing with 2.7 octaves instead of 3.
; Now back to 50 KHz replay, one has to mix two streams read at variable
; speed from memory. How to do that ?
; Lance solution is to divide the VBL in 25 parts where we produce 40
; mixing results (25 x 40 = 1000). At 25 KHz we would have to produce
; only 20 mixing results.
; For each of those 25 blocks, the program will read at two different
; speeds from two samples to mix them.
; To allow that, 23 different reading speed are allowed per block.
; As we have 2 voices mixing, this means that we have 23 possible read
; speeds for voice 0 and 23 possible read speeds for voice 1: 23 x 23 =
; 529 combinations.
; So 529 different code combinations are generated to handle each one of
; the 529 cases (mt_make_mixcode).
; But you will say, we have almost a thousand diferent reading speeds.
; That's right, but we have 25 blocks per VBL. So if we do block 0 at
; speed 13 and block 1 at speed 12 and block 2 at speed 13 and block 3 at
; speed 12 and so on we will get an average speed of 12.5 and the
; listenner will not notice it. That is a first compromise needed for
; memory space reasons: all those code combinations consume memory.
; Now to volume control ...
; Lance choosed to take advantage of the Microwire volume control.
; On STE one can set the volume of both Left and Right stereo signals in
; an independent way.
; So the idea is to volume only 1 of the 2 samples we are mixing.
; Let's do an example: voice 0 has $30 volume and voice 1 has a $20
; volume. You can set the global Microwire volume to the equivalent of
; $30 for a maximum of $40 and volume the voice 1 sample data with the
; relative volume between the two samples: $20/$30 = 0.6667 or 43 in 64.
; The important is to always volume the voice with the lowest volume.
; This is why this routine does not work on Falcon and why it is dificult
; to control the global replay volume. After you have called Lance rout,
; you can change the Microwire volume but you have to respect the set
; relationship between the values found at Left and Right volume.
; If you find 100% for Left and 50% for Right, you can change to 80//40
; or 60//30 or any other 2:1 ration values.
; This Microwire solution has another compromise: the number of volume
; levels available at the Microwire is much less than the 65 Paula levels
; and they are not linear. The converted table can be find here:
;.mt_LCM_vol_tab
; dc.w 0
; dc.w 2,5,7,8,9,10,10,11,11,12,12,13,13,13,14,14
; dc.w 14,14,15,15,15,15,16,16,16,16,16,16,17,17,17,17
; dc.w 17,17,17,18,18,18,18,18,18,18,18,18,18,19,19,19
; dc.w 19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20
; The relative volume between the two mixing samples is obtaing via a div
; table built at start (mt_make_divtab) with 64x64 = 4096 combinations.
; So Lance only has to read at 2 variable speeds from 2 sources and the
; data from 1 source is volumed (goes via a table) into another value.
; The typical worse case scenario (for time) is the following:
; move.b (a0)+,d2 voice 0 data
; move.b (a1)+,d1 voice 1 data that goes to D1
; move.l d1,a2 that points to the volume table $xxxxxx00
; add.b (a2)+,d2 mixing with volumed data
; move.b d2,(sp)+
; So here we have the remaing Lance solutions.
; Mixing is done by simple adds so 7 bit samples are used: 7bit + 7bit =
; 8 bit. The reduction to 7 bit can be found at .mt_shift_down.
; STE stereo buffer interleaving problem is solved using the 68000 SP
; protection mechanism that increments the pointer by 2 in case of byte
; access: this was unknown to me until i looked first at this routine in
; 2004 ...
; The volume table is located at a 256 byte even boundary that allows to
; get the volumed converted value in a simple and speedy way. I have a
; similar solution in Hextracker except for real 8 bit samples replay.
; the difference is taht i get a word as a result and so the sample bytes
; have bit 0 set to 0 (reduction to 7 bits) instead of a signed right
; shift like it is done here by Lance.
; For the cases where no read is required then the previous mixed value
; is sent to the buffer or only 1 read is done: this is the job of the
; generated code to take care of each of those cases (mt_make_mixcode).
; All this is compatible with 25 KHz replay except the need to insert a
; addq #1,An for steps bigger than 1 and to reduce the buffer updates to
; 20 per block instead of 40.
; The loop control is done in the general way: 640 bytes are added to
; each sample at the end with the looped sample data in case of loops
; or zeros. This is done at mtloop3 and space for that is reserved here:
;mt_data incbin "modules\*.mod"
; ds.w 31*640/2 ;These zeroes are necessary!
; This means that 640 is the maximum number of bytes that Lance expects
; to have to read per VBL. But our calculations point to 657 ...
; May be this was done before Finetune was included. If we do not
; include Finetune, the minimu divider is 113 (mt_periodtable tuning 0).
; 7093790 / (2x113) / 50 VBLs = 627.8 bytes
; The Portamento effects also limit the divider to 113.
; mt_make_tables only starts at 113 keeping the same reading pace for
; dividers below. So if a 108 divider is set by the Finetune, 113 will be
; used.
; Bug or not in the implementation of Finetune, this is not our concern
; now ...
; So we know almost everything now except the core: how is the generated
; code built ? What are the rules ?
; One that is obvious is that registers d0, d1 and d2 are used in their
; byte parts and that the rest of d1 points to the volume table generated
; by mt_make_voltab. a0 and a1 point the the sample data and are
; incremented at each needed read. a2 is used for the volume convertion
; and the data in sent to (sp)+ via a move.b from d0, d1 or d2.
; What remains is the most complex part: when do we need to read from 0,
; from 1, we can use previous data and so on ...
; This is where our analysis of:
; - mt_make_freq
; - mt_make_frame_f
[...]







[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
Lance's 50khz playroutine Bod/STAX Feb,18.2013-17:35
  Re: Lance's 50khz playroutine gwEm Feb,18.2013-20:42
  Re: Lance's 50khz playroutine ggn Feb,18.2013-20:53
    Re: Lance's 50khz playroutine Bod/STAX Feb,18.2013-21:28
      Re: Lance's 50khz playroutine gwEm Feb,18.2013-23:05
        Re: Lance's 50khz playroutine gwEm Feb,18.2013-23:16
          Re: Lance's 50khz playroutine gwEm Feb,19.2013-02:21
            Re: Lance's 50khz playroutine Bod/STAX Feb,22.2013-17:08
              Re: Lance's 50khz playroutine gwEm Feb,25.2013-20:36
                Re: Lance's 50khz playroutine ljbk Feb,25.2013-23:54
                  Re: Lance's 50khz playroutine Bod/STAX Feb,26.2013-11:23
                    Re: Lance's 50khz playroutine evil Feb,26.2013-12:04
                      Re: Lance's 50khz playroutine ljbk Feb,26.2013-14:45
                        Re: Lance's 50khz playroutine ljbk Feb,26.2013-21:46
                          Re: Lance's 50khz playroutine evil Feb,27.2013-17:01
                            Re: Lance's 50khz playroutine ljbk Feb,28.2013-13:24
                              Re: Lance's 50khz playroutine ljbk Feb,28.2013-13:28
                                Re: Lance's 50khz playroutine gwEm Feb,28.2013-14:07
                                  Re: Lance's 50khz playroutine Bod/STAX Feb,28.2013-21:41
                                    Re: Lance's 50khz playroutine ljbk Feb,28.2013-22:42
                                      Sem assunto ljbk Mar,01.2013-13:27
                                        Lance's 50 KHz playroutine ljbk Mar,01.2013-15:49
                                          Re: Lance's 50 KHz playroutine ljbk Mar,01.2013-17:34
                                            Re: Lance's 50 KHz playroutine ljbk Mar,01.2013-17:36
                                              Re: Lance's 50 KHz playroutine evil Mar,01.2013-19:03
                                                Re: Lance's 50 KHz playroutine ljbk Mar,02.2013-00:18
                                                  Re: Lance's 50 KHz playroutine ljbk Mar,04.2013-17:39
                                                    Re: Lance's 50 KHz playroutine ljbk Mar,06.2013-02:21
                                                      Re: Lance's 50 KHz playroutine gwEm Mar,06.2013-13:23
                                                        Re: Lance's 50 KHz playroutine ljbk Mar,06.2013-15:57
                                                          Re: Lance's 50 KHz playroutine evil Mar,06.2013-16:48
                                                            Re: Lance's 50 KHz playroutine ggn Mar,06.2013-17:31
                                                              Re: Lance's 50 KHz playroutine evil Mar,06.2013-17:48
                                                                Re: Lance's 50 KHz playroutine ggn Mar,06.2013-23:54
                                                            Re: Lance's 50 KHz playroutine ljbk Mar,06.2013-18:18
                                                              Re: Lance's 50 KHz playroutine ljbk Mar,06.2013-21:51
                                                              Re: Lance's 50 KHz playroutine ggn Mar,06.2013-23:59
                                                                Re: Lance's 50 KHz playroutine ljbk Mar,07.2013-02:31
                                                                  Re: Lance's 50 KHz playroutine ggn Mar,07.2013-12:34
                                                                    Re: Lance's 50 KHz playroutine ljbk Mar,07.2013-14:00
                                                                      Re: Lance's 50 KHz playroutine gwEm Mar,07.2013-18:00
                                                                        Re: Lance's 50 KHz playroutine ljbk Mar,07.2013-18:51
                                                                          Re: Lance's 50 KHz playroutine ljbk Mar,08.2013-02:10
                                                                            Re: Lance's 50 KHz playroutine ljbk Mar,08.2013-13:12
                                                                              Re: Lance's 50 KHz playroutine ljbk Mar,09.2013-00:17
                                                            Re: Lance's 50 KHz playroutine ljbk Mar,06.2013-19:28
                              Re: Lance's 50khz playroutine ljbk Feb,28.2013-15:47
                                Re: Lance's 50khz playroutine ljbk Feb,28.2013-15:51
                                  Re: Lance's 50khz playroutine ljbk Feb,28.2013-18:56
                                    Re: Lance's 50khz playroutine nativ Mar,24.2013-00:07
                                      Re: Lance's 50khz playroutine ljbk Apr,13.2013-01:21
                                        Re: Lance's 50khz playroutine ljbk Apr,16.2013-16:12
                                          Re: Lance's 50khz playroutine ljbk Apr,19.2013-12:14
                                            Re: Lance's 50khz playroutine ljbk Apr,22.2013-14:54
                                              Re: Lance's 50khz playroutine ljbk Apr,25.2013-19:03
                                                Re: Lance's 50khz playroutine ggn Apr,25.2013-21:03
                                                  Re: Lance's 50khz playroutine ljbk Apr,26.2013-09:18
                                                    Re: Lance's 50khz playroutine ggn Apr,26.2013-11:28
                                                      Re: Lance's 50khz playroutine ljbk Apr,26.2013-12:13
  Re: Lance's 50khz playroutine ljbk May,01.2013-22:30
    Re: Lance's 50khz playroutine evil May,02.2013-14:46
      Re: Lance's 50khz playroutine gwEm May,02.2013-20:00
        Re: Lance's 50khz playroutine Damo May,02.2013-21:00
          Re: Lance's 50khz playroutine evil May,03.2013-13:00
      Re: Lance's 50khz playroutine ljbk May,08.2013-17:50
        Re: Lance's 50khz playroutine Cyprian May,10.2013-13:01
          Re: Lance's 50khz playroutine ljbk May,11.2013-00:22
          Re: Lance's 50khz playroutine ljbk May,11.2013-08:54
            Re: Lance's 50khz playroutine Cyprian May,11.2013-15:18
              Re: Lance's 50khz playroutine ljbk May,11.2013-15:35
                Re: Lance's 50khz playroutine Lance May,23.2013-00:02
                  Re: Lance's 50khz playroutine ljbk May,23.2013-14:44
  Re: Lance's 50khz playroutine Bod/STAX Jun,06.2013-20:32
    Re: Lance's 50khz playroutine Bod/STAX Jun,06.2013-20:39
      Re: Lance's 50khz playroutine ljbk Jun,07.2013-00:09
        Re: Lance's 50khz playroutine Bod/STAX Jun,07.2013-18:38
          Re: Lance's 50khz playroutine ljbk Jun,07.2013-21:46


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson