PCM player using SCC (Development MSX Fora)MSX Resource Center            
            
English Nederlands Espa�ol Portugu�s Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 60 gasten en 1 MSX vriend online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Development - PCM player using SCC

Ga naar pagina ( Vorige pagina 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 Volgende pagina )
Schrijver

PCM player using SCC

NYYRIKKI
msx master
Berichten: 1525
Geplaatst: 13 Oktober 2007, 18:45   
I think it's time to go to find that SCC cartridge...
ARTRAG
msx master
Berichten: 1737
Geplaatst: 15 Oktober 2007, 16:35   
Before going to line interrupts, can I suggest an experiment ?

Assume one channel for PCM with period Ps and one channel in deformed mode as timer with period Pd;

The Sampling frequency is Fs = 3.5MHz/(Ps+1)/32
The Rotation frequency is Fd = 3.5MHz/(Pd+1)

If relation holds
32*Pd+31 = Ps

We get that each step done by the PCM channel we get an equivalent step in the counter channel

Initialize channel used as counter with numbers from 0 to 31 (put it a volume 0)

Now you can do this loop:

0) do you staff here in less than 32*125us = 4000us (if at Fs=8KHz)
1) test byte #1 of the channel used for counter
2) if it is non zero goto 1
3) LDIR the next 32 samples in the wavetable
4) goto 0

I think that this is the simplest experiment to do to try to isolate
the SCC behaviours we pointed in this tread

after getting this work, I would try to use the counter as pointer
to the PCM segment already reproduced, in order avoid to stop and
wait the end of the current chunk.

BTW 4000us is quite a nice amount of time for the branch of a the
main of a game...


PS
Put Pd = 13 and Ps = 447
this should give about 8KHz of Fs and synchronization between
PCM channel and time channel


mohai
msx lover
Berichten: 127
Geplaatst: 15 Oktober 2007, 23:40   
By the way, do you remember voices played in Pennant Race 2?
A good starting point...
ARTRAG
msx master
Berichten: 1737
Geplaatst: 16 Oktober 2007, 00:13   
I'm very rusty with SCC and mem mappers, why this code (for sjasm) does not work ?
I tried on bluemsx, that detects correctly the output as an scc rom, but do not give a sound
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------

        
        OUTPUT sccplay.rom
        org 4000h
        dw  "BA",START,0,0,0,0,0,0


Bank1   equ      05000h
Bank2   equ      07000h
Bank3   equ      09000h
Bank4   equ      0B000h
        

;-------------------------------------
; Entry point
;-------------------------------------       
START:
        ld  a,3Fh
        LD  (Bank3),A
        
        LD  A,00011111b ;Enables all SCC channels
        LD  ($988F),A

Period  equ      9

        ld  hl,Period       ; F sample ch1 = 11186Hz
        ld  (9880h),hl
        
        ld      hl,32*Period +31
        ld  (9886h),hl      ; F sample ch4 = F sample ch1/32
        
        ld  a,15
        ld  (988Ah),a   ; volume ch1

        xor a
        ld  (988Bh),a   ; volume ch2
        ld  (988Ch),a   ; volume ch3
        ld  (988Dh),a   ; volume ch4
        ld  (988Eh),a   ; volume ch5
        
        ld      de,$9800
        ld      hl,sccwaves
        ld      bc,$20*4
        ldir

        LD  A,11100000b ;Deformation only on 4&5 SCC channels (or not ?)
        ld  (98E0h),a
        
.REWIND:
        xor a
.LOOP:
        inc a
        ld  (Bank2),a

        ld  hl, SAMPLE_START

        ex   af,af'
        ld  b,0
.page:
        push    bc

        ;do your stuff here in less than 32 / F_sample ch1 seconds

.wait:
        ld      a,(9860h)
        or  a
        jr  nz,.wait        ; wait for a complete rotation in ch 4

        ld      de,$9800
        ld      bc,$20
        ldir
        
        pop bc
        djnz    .page
        ex   af,af'
        
        cp  (SAMPLE_END - SAMPLE_START + #1FFF)/#2000
        jr  nz,.LOOP
        jr  .REWIND
        ret

        
sccwaves:
        db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,27,28,29,30,31
        db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,27,28,29,30,31
        db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,27,28,29,30,31
        db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,27,28,29,30,31                        
;-------------------------------------
; Padding for rom player
;-------------------------------------
        DS (#6000 - $)


;-------------------------------------
; Sample data
;-------------------------------------
SAMPLE_START:
        incbin "handel3.wav"
SAMPLE_END:


;-------------------------------------
; Padding, align rom image to a power of two.
;-------------------------------------
        
SAMPLE_LENGTH   equ SAMPLE_END - SAMPLE_START

        IF (SAMPLE_LENGTH <= #6000)
        DS (#6000 - SAMPLE_LENGTH)
        ELSE
        IF (SAMPLE_LENGTH <= #E000)
        DS (#E000 - SAMPLE_LENGTH)
        ELSE
        IF (SAMPLE_LENGTH <= #1E000)
        DS (#1E000 - SAMPLE_LENGTH)
        ELSE
        IF (SAMPLE_LENGTH <= #3E000)
        DS (#3E000 - SAMPLE_LENGTH)
        ELSE
        IF (SAMPLE_LENGTH <= #7E000)
        DS (#7E000 - SAMPLE_LENGTH)
        ELSE
        DS (#FE000 - SAMPLE_LENGTH)
        ENDIF
        ENDIF
        ENDIF
        ENDIF
        ENDIF
        


FINISH:

NYYRIKKI
msx master
Berichten: 1525
Geplaatst: 16 Oktober 2007, 06:54   
As your START address points to #4010 I think that you need to select correct slot first to area #8000-#BFFF
(IIRC there is copy/paste ready code in MSX2 technical handbook)
ARTRAG
msx master
Berichten: 1737
Geplaatst: 16 Oktober 2007, 10:01   
Done !
Does the power-up code solve the issue ?

;----------------------------------------------------------------------------
;----------------------------------------------------------------------------


        OUTPUT sccplay.rom
        org 4000h
        dw  "BA",START,0,0,0,0,0,0


Bank1   equ      05000h
Bank2   equ      07000h
Bank3   equ      09000h
Bank4   equ      0B000h


;-------------------------------------
; Entry point
;-------------------------------------
START:
        call powerup

        ld  a,3Fh
        LD  (Bank3),A

        LD  A,00011111b ;Enables all SCC channels
        LD  ($988F),A

Period  equ      9

        ld  hl,Period       ; F sample ch1 = 11186Hz
        ld  (9880h),hl

        ld      hl,32*Period +31
        ld  (9886h),hl      ; F sample ch4 = F sample ch1/32

        ld  a,15
        ld  (988Ah),a   ; volume ch1

        xor a
        ld  (988Bh),a   ; volume ch2
        ld  (988Ch),a   ; volume ch3
        ld  (988Dh),a   ; volume ch4
        ld  (988Eh),a   ; volume ch5

        ld      de,$9800
        ld      hl,sccwaves
        ld      bc,$20*4
        ldir

        LD  A,11100000b ;Deformation only on 4&5 SCC channels (or not ?)
        ld  (98E0h),a

.REWIND:
        xor a
.LOOP:
        inc a
        ld  (Bank2),a

        ld  hl, SAMPLE_START

        ex   af,af'
        ld  b,0
.page:
        push    bc

        ;do your stuff here in less than 32 / F_sample ch1 seconds

.wait:
        ld      a,(9860h)
        or  a
        jr  nz,.wait        ; wait for a complete rotation in ch 4

        ld      de,$9800
        ld      bc,$20
        ldir

        pop bc
        djnz    .page
        ex   af,af'

        cp  (SAMPLE_END - SAMPLE_START + #1FFF)/#2000
        jr  nz,.LOOP
        jr  .REWIND
        ret


sccwaves:
        db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,27,28,29,30,31
        db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,27,28,29,30,31
        db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,27,28,29,30,31
        db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,27,28,29,30,31


;-------------------------------------
;   Powerup routine for small model, non-Z180 code.
;   set pages and subslot
;-------------------------------------
powerup:
        call    0x138
        rrca
        rrca
        and     0x03
        ld      c,a
        ld      b,0
        ld      hl,0xfcc1
        add     hl,bc
        or      (hl)
        ld      b,a
        inc     hl
        inc     hl
        inc     hl
        inc     hl
        ld      a,(hl)
        and     0x0c
        or      b

        ld      h,0x80
        call    0x24

        ret



;-------------------------------------
; Padding for rom player
;-------------------------------------
        DS (#6000 - $)


;-------------------------------------
; Sample data
;-------------------------------------
SAMPLE_START:
        incbin "handel3.wav"
SAMPLE_END:


;-------------------------------------
; Padding, align rom image to a power of two.
;-------------------------------------

SAMPLE_LENGTH   equ SAMPLE_END - SAMPLE_START

        IF (SAMPLE_LENGTH <= #6000)
        DS (#6000 - SAMPLE_LENGTH)
        ELSE
        IF (SAMPLE_LENGTH <= #E000)
        DS (#E000 - SAMPLE_LENGTH)
        ELSE
        IF (SAMPLE_LENGTH <= #1E000)
        DS (#1E000 - SAMPLE_LENGTH)
        ELSE
        IF (SAMPLE_LENGTH <= #3E000)
        DS (#3E000 - SAMPLE_LENGTH)
        ELSE
        IF (SAMPLE_LENGTH <= #7E000)
        DS (#7E000 - SAMPLE_LENGTH)
        ELSE
        DS (#FE000 - SAMPLE_LENGTH)
        ENDIF
        ENDIF
        ENDIF
        ENDIF
        ENDIF



FINISH:

mohai
msx lover
Berichten: 127
Geplaatst: 16 Oktober 2007, 13:35   
This line should say "AB" instead of "BA". Doesn't it?

dw "BA",START,0,0,0,0,0,0

NYYRIKKI
msx master
Berichten: 1525
Geplaatst: 16 Oktober 2007, 13:37   
@ARTRAG: I think it should...
@mohai: No
ARTRAG
msx master
Berichten: 1737
Geplaatst: 16 Oktober 2007, 13:45   
In bluemsx, I get no sound as well.
I think that the issue is due to the lock on the waveforms
(provided that the real HW does this even if bit 7 in def. register
is set).
I tried to reset the deformation reg before dumping the 32 samples
and now I can head some noise now...

ARTRAG
msx master
Berichten: 1737
Geplaatst: 16 Oktober 2007, 19:06   
I tried to use ch1 as counter and ch4 as player...
noise again.
Nevertheless openmsx and bluemsx sound VERY different.
I think that the deformation register is implemented in
different ways.
(BIFI at http://bifi.msxnet.org/msxnet/tech/scc.html reports
that bit 6 and 7 are used to produce noise. This is
not correct, and maybe one of the two emulators
produces noise instead of the rotating waveforms....)


;----------------------------------------------------------------------------
;----------------------------------------------------------------------------


        OUTPUT sccplay.rom
        org 4000h
        dw  "BA",START,0,0,0,0,0,0


Bank1   equ      05000h
Bank2   equ      07000h
Bank3   equ      09000h
Bank4   equ      0B000h


;-------------------------------------
; Entry point
;-------------------------------------
START:
        call powerup

        ld  a,3Fh
        LD  (Bank3),A

        LD  A,00001000b ;Enables all SCC channels
        LD  ($988F),A

Period  equ      9

        ld  hl,Period       ; F sample ch4 = 11186Hz
        ld  (9886h),hl
        ld  (9888h),hl

        ld  hl,32*Period +31
        ld  (9880h),hl      ; F sample ch1 = F sample ch1/32
        ld  (9882h),hl      ; F sample ch2 = F sample ch1/32
        ld  (9884h),hl      ; F sample ch2 = F sample ch1/32

        xor a
        ld  (988Ah),a   ; volume ch1
        ld  (988Bh),a   ; volume ch2
        ld  (988Ch),a   ; volume ch3

        ld  a,7
        ld  (988Dh),a   ; volume ch4
        xor a
        ld  (988Eh),a   ; volume ch5

        ld      de,$9800
        ld      hl,sccwaves
        ld      bc,$20*4
        ldir

        LD  A,11000000b ; WAVEFORM only on 4&5 SCC channels (or not ??)
        ld  (98E0h),a

.REWIND:
        xor a
.LOOP:
        inc a
        ld  (Bank2),a

        ld  hl, SAMPLE_START

        ex   af,af'
        ld  b,0
.page:
        push    bc

        ;;;;;;;;;;;
        ;do your stuff here in less than 32 / F_sample ch1 seconds

        ld  b,50
.inner
        ld a,r
        out(99h),a
        ld a,128+7
        out(99h),a
        djnz      .inner
        xor a
        out(99h),a
        ld a,128+7
        out(99h),a

        ;;;;;;;;;;;

.wait:
        ld      a,(9800h)
        or  a
        jr  nz,.wait        ; wait for a complete rotation in ch 1

        ld  (98E0h),a       ; No deformation (unlock waveforms)

        ld      de,9860h
        ld      bc,$20
        ldir

        LD  A,11000000b ; WAVEFORM only on 4&5 SCC channels (or not ??)
        ld  (98E0h),a

        pop bc
        djnz    .page
        ex   af,af'

        cp  (SAMPLE_END - SAMPLE_START + #1FFF)/#2000
        jr  nz,.LOOP
        jr  .REWIND
        ret


sccwaves:
        db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,27,28,29,30,31
        db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,27,28,29,30,31
        db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,27,28,29,30,31
        db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,27,28,29,30,31


;-------------------------------------
;   Powerup routine for small model, non-Z180 code.
;   set pages and subslot
;-------------------------------------
powerup:
        call    0x138
        rrca
        rrca
        and     0x03
        ld      c,a
        ld      b,0
        ld      hl,0xfcc1
        add     hl,bc
        or      (hl)
        ld      b,a
        inc     hl
        inc     hl
        inc     hl
        inc     hl
        ld      a,(hl)
        and     0x0c
        or      b

        ld      h,0x80
        call    0x24

        ret



;-------------------------------------
; Padding for rom player
;-------------------------------------
        DS (#6000 - $)


;-------------------------------------
; Sample data
;-------------------------------------
SAMPLE_START:
        incbin "handel3.wav"
SAMPLE_END:


;-------------------------------------
; Padding, align rom image to a power of two.
;-------------------------------------

SAMPLE_LENGTH   equ SAMPLE_END - SAMPLE_START

        IF (SAMPLE_LENGTH <= #6000)
        DS (#6000 - SAMPLE_LENGTH)
        ELSE
        IF (SAMPLE_LENGTH <= #E000)
        DS (#E000 - SAMPLE_LENGTH)
        ELSE
        IF (SAMPLE_LENGTH <= #1E000)
        DS (#1E000 - SAMPLE_LENGTH)
        ELSE
        IF (SAMPLE_LENGTH <= #3E000)
        DS (#3E000 - SAMPLE_LENGTH)
        ELSE
        IF (SAMPLE_LENGTH <= #7E000)
        DS (#7E000 - SAMPLE_LENGTH)
        ELSE
        DS (#FE000 - SAMPLE_LENGTH)
        ENDIF
        ENDIF
        ENDIF
        ENDIF
        ENDIF



FINISH:


manuel
msx guru
Berichten: 3531
Geplaatst: 16 Oktober 2007, 22:18   
ARTRAG, you could also just look at the source code of those emulators and find out what exactly the code is doing
ARTRAG
msx master
Berichten: 1737
Geplaatst: 17 Oktober 2007, 08:43   
!!!
in the emulators it seems that even setting bit 7 in 98E0h, ALL the channels continue their rotation
This makes all the channels not useful for playing PCM samples.
If this detail reflects the real HW and correctly implemented by emulators,
SCC cannot be used in this way for PCM audio.


BTW if emulation is incorrect I cannot go further, as I do not have any real HW.

I give up, anyone with real HW willing to try? I can send him my files

The ideal HW for test is a flash cartridge with SCC and konami mem mapper.
Can anyone tell me if such an HW exist and is sold somewhere ?


Huey
msx professional
Berichten: 630
Geplaatst: 17 Oktober 2007, 08:56   
Google is your friend

linky
nikodr
msx addict
Berichten: 491
Geplaatst: 17 Oktober 2007, 11:12   
Artrag i have a flash cartridge with scc and konami memory mapper (manuel Pazos's Megaflash),if you want any help my email is mperdemas at yahoo dot gr

manuel
msx guru
Berichten: 3531
Geplaatst: 17 Oktober 2007, 12:19   
 
Ga naar pagina ( Vorige pagina 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 Volgende pagina )
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.