Voice synthesis on ISR

Page 20/28
13 | 14 | 15 | 16 | 17 | 18 | 19 | | 21 | 22 | 23 | 24 | 25

By ARTRAG

Enlighted (6276)

ARTRAG's picture

14-10-2016, 22:42

ps
the encoder is an exe included in the package
you need to install a (huge but free) matlab library before running it
once installed, you can encode your wavs yourself

By Alcoholics_Anonymous

Resident (39)

Alcoholics_Anonymous's picture

14-10-2016, 23:40

Yup, I've already been doing my own conversions. The sound effects came out close enough to the original wavs that they may be used mostly unchanged. I'm running on the spectrum not the msx Smile

I'll grab the newer versions and see if results are any better later this evening.

By ARTRAG

Enlighted (6276)

ARTRAG's picture

15-10-2016, 08:35

It integrates SCC too, you could simply the player if you use only the psg
Let me know how it goes on speccy

By ARTRAG

Enlighted (6276)

ARTRAG's picture

15-10-2016, 11:58

Simply = simplify
Sorry for the typo

By Alcoholics_Anonymous

Resident (39)

Alcoholics_Anonymous's picture

19-10-2016, 17:39

Everything works really well. The 20 sound effects we converted from wav occupy just 6-7k and can be used almost unmodified. I'm using the compact psg data so no scc data and just six bytes per ay write. (The 6-7k includes players and two separately generated midi songs).

This tool saved a great deal of time and is going to be really useful for sound effects in games not just speech data. I'm sure it will see a lot more attention in the zx scene at least after this game comes out Smile

Here's the spectrum player used to play the effects:

; Bank 06 variables

SECTION BANK_06

BANK06_ay_reg : defs 14

; Bank 06 functions

PUBLIC BANK06_ay_fx_play_isr

BANK06_ay_fx_play_isr:

   ; enter : hl = void *position
   ;
   ; exit  : hl = void *position
   ;
   ; uses  : af, bc, de, hl
   
   ld a,h
   or l
   ret z

fx_repeat_loop:
   
   ld a,(hl)

   cp $ff
   jr nz, fx_playing

   inc hl
   
   cp (hl)
   jp z, BANK06_ay_reset
   
   dec a
   
   cp (hl)
   jr z, fx_repeat
   
   dec hl
   
fx_playing:

   ld de,BANK06_ay_reg
   ld bc,$03ff

fx_loop:

   ldi 
   
   ld a,(hl)
   inc hl
   
   push af
   and $0f
   
   ld (de),a
   inc de
   
   djnz fx_loop
   
   ld de,BANK06_ay_reg + 10
   ld b,3
   
logvol_loop:

   pop af
   
   rlca
   rlca
   rlca
   rlca
   
   and $0f
   ld (de),a
   
   dec de
   djnz logvol_loop

   push hl
   
   call BANK06_ay_rout
   
   pop hl
   ret

fx_repeat:

   inc hl
   
   ld a,(hl)
   inc hl
   ld h,(hl)
   ld l,a
   
   jr fx_repeat_loop
   
;
   
BANK06_ay_rout:

   xor a
   ld c,$fd
   ld hl,BANK06_ay_reg
   
rout_loop:

   ld b,$ff
   out (c),a
   
   ld e,(hl)
   inc hl
   
   ld b,$bf
   out (c),e
   
   inc a
   
   cp 11
   jr nz, rout_loop
   
   ret  

The main change, aside from port assignment, is an addition to optionally repeat a sound effect. This is used for walking and a countdown timer so that a very short repeatable sequence can be played repeatedly by the player. The player is also changed a little bit to return effect position rather than write it directly to memory. This allows the effects and player to exist in another memory bank while the effect position is kept in the main bank so that changes to that can be made in the main program without disabling interrupts.

Code $ffff is used to terminate the effect as before and $fffe / effect_address is used to repeat the effect.

These are just small changes to make the player more suitable for use in games.

By ARTRAG

Enlighted (6276)

ARTRAG's picture

19-10-2016, 23:22

Nice! I eager to see a video of your game

By Alcoholics_Anonymous

Resident (39)

Alcoholics_Anonymous's picture

25-12-2016, 19:28

ARTRAG wrote:

Nice! I eager to see a video of your game

A first video has appeared:
https://www.youtube.com/watch?v=swZzgu9MIDA

The music is converted from midi but all the sound effects are done with your 50Hz sample engine. They turned out very well.

The game is written by Cristian Gonzalez; I'm only responsible for getting the sound effects in there and helping out with the tools.

By hit9918

Prophet (2868)

hit9918's picture

26-12-2016, 19:33

did I get this right, the effects are sampled from a wav of another 8bit. a NES?
another nice application. get a precise port by simply slamming the wav into the tool.
this kind-of-mp3 method keeps being intriguing.

By Alcoholics_Anonymous

Resident (39)

Alcoholics_Anonymous's picture

27-12-2016, 04:36

hit9918 wrote:

did I get this right, the effects are sampled from a wav of another 8bit. a NES?

Yes that's right. All the sound effects are sampled from wavs recorded from the NES. Each played sample involves all 3 voices on the AY chip so only one sample can play at a time but even with that restriction the results are pretty good.

By ARTRAG

Enlighted (6276)

ARTRAG's picture

27-12-2016, 08:23

Very nice! Greetings!

Page 20/28
13 | 14 | 15 | 16 | 17 | 18 | 19 | | 21 | 22 | 23 | 24 | 25