AYSFX files needed

Page 1/2
| 2

By ARTRAG

Enlighted (6932)

ARTRAG's picture

01-04-2014, 22:04

I'm looking for libraries of .AFX files of sfx to be used in the the excellent tool by Shiru
http://shiru.untergrund.net/files/ayfxedit04.zip

The Shiru's AYFX editor comes with a nice collection of sounds ripped from other various games
Do you know of other free files ?
In Shiru's collection there are sounds from many msx games: is there a simple way to rip sound effects in .AFX format from actual games ?

Login or register to post comments

By Maggoo

Paragon (1217)

Maggoo's picture

02-04-2014, 02:12

Did u by any chance try to contact Shiru? I am assuming the samples of MSX games sound effects come from him so he probably know how to extract them.

I personally have not found other sound effects than the samples provided with the AY editor

By hbarcellos

Hero (642)

hbarcellos's picture

02-04-2014, 03:31

Well, as a matter of fact, I did. I've spoke with Shiru about it.
He told me that, as far as he can remember, he used an openMSX script to dump the psg registers, imported into AYFX editor to split different sounds in different files.

I remembered that circa 2008 I "created" a format as simple as this one:
DB A,B,C
...
being: A = psg register to write
B = value to write on register A
C = # of interrupts to wait before executing the next step.

But, as far as I remember, files we're considerably bigger than .AFX files.

For instance, this is the CASIO logo sound from games like car fighter:

		DB 7,191,3
		DB 0,80,0
		DB 2,64,0
		DB 7,184,0
		DB 8,15,0
		DB 9,15,1
		DB 10,14,1
		DB 10,13,1
		DB 10,12,1
		DB 10,11,1
		DB 10,10,1
		DB 8,14,0
		DB 9,14,0
		DB 10,9,1
		DB 10,8,1
		DB 4,32,0
		DB 10,15,4
		DB 8,13,0
		DB 9,13,2
		DB 10,14,4
		DB 8,12,0
		DB 9,12,2
		DB 10,13,4
		DB 8,11,0
		DB 9,11,2
		DB 10,12,4
		DB 8,10,0
		DB 9,10,2
		DB 10,11,4
		DB 8,9,0
		DB 9,9,2
		DB 10,10,4
		DB 8,8,0
		DB 9,8,2
		DB 10,9,4
		DB 8,7,0
		DB 9,7,2
		DB 10,8,4
		DB 8,6,0
		DB 9,6,2
		DB 10,7,4
		DB 8,5,0
		DB 9,5,2
		DB 10,6,2
		DB 7,191,0

That would be 135 bytes.

I'll try to study a little bit more of the AFX format. The problem is that Shiru's code comments are entirely written in Russian!

By Maggoo

Paragon (1217)

Maggoo's picture

02-04-2014, 04:22

By ro

Scribe (4914)

ro's picture

02-04-2014, 08:00

Ripping SFX, I remember... While doin' SEE I wanted to have some nice SFX examples from known games. Just to show that SEE can do that. I used the konami music replayers that where around and coded a tool around it. This tool would just play one SFX, read the PSG output and write it to disk. As an SFX file for SEE. I have done MOG, MG, MG2, Nemesis, Salamander, Hinotori *(imho the best sfx ever in that game) etc.

Brutal PSG rip indeed Smile

By hbarcellos

Hero (642)

hbarcellos's picture

02-04-2014, 15:08

Maggoo, well, I see that Muffie is trying to get some help from other z80 communities! :)
Anyway, that reply from kgmcneil is marvelous and can maybe help a lot of other users around here:

Quote:

Its been awhile since I last played with AYFXEdit, but I seem to recall the ability to Import sounds (Under the Import menu, you can import "PSG for AY", "VTX" and "WAV file (volume only)")... Of the various options available, the most useful is "PSG for AY"...

If you download AYEmul player from http://bulba.untergrund.net/emulator_e.htm , (directly from http://bulba.untergrund.net/Ay_Emul29b11.7z) you can use this tool to convert AY sound effects into PSG format that can then be imported into AYFXEdit...

In the WOS games database, you will often come across AY archives that contain game music and occasionally the AY sound effects too... Using AYEmul, you can select the individual sound effects in the play list then click RIGHT mouse button to select the "Convert to" menu; from there you can select "PSG..." to then output a file that can be imported with AYFXEdit...

If you can't think of any individual games with sounds that you want to rip from the WOS archive, you can also try grabbing some sounds from the large AY archive collection found at Project AY found at http://www.worldofspectrum.org/projectay/gdmusic.htm

The archive can be downloaded directly from http://projectay.dl.spilsby.net/ProjectAY.zip ...Its about 4 megabytes and most of the AY files in there only contain music and jingles... There are a few however (under spectrum games) that contain some sound effects however, so it might be worth checking out as a source for sound effects... To be honest however, I doubt you'll find a better source than the archive that already comes with the AYFXEdit tool though... I think Shiru did a pretty good job at converting most of what is commonly found from the classic games available on the Spectrum and CPC for that collection...

The best way to generate new sounds I find it to load up one of the example AFX files from that collection and just play randomly with it, to edit it further until it no longer resembles the original sound effect... You'll get more success doing that than creating a sound from scratch, especially if the sound you are after is already close to one that can already be found in that collection...

Another trick is to look through some of the more modern Demo PT3 music archives and listen to some of them (eg: http://bulba.untergrund.net/Tr_Songs.7z)... Many of the newer songs are very sound effect orientated rather than melody driven, relying more on percussion.. Some of the percussion riffs often make good sound effects... By loading them into Vortex Tracker (http://bulba.untergrund.net/VT1.0beta19.7z), and stripping them down to only the patterns and notes that you want to hear then resaving them, you can then load them into AYEmul and convert them to PSG to then be loaded into AYFXEdit in the same way as you would convert the AY sounds...

If your going to work extensively with AYFXEdit, you will probably also want to associate .AFX sound files with ayfxedit.exe... Normally, ayfxedit.exe won't allow you to load things on a commandline, not allowing such associations... To get round this, I wrote a small AutoIT script that allows you to load and play .AFX files directly by double clicking on them from the browser... Im using Windows XP so I don't know if it will work for your system, but you can try it if you like...

Download the following executable... (Its packed with AutoIT's UPX compression system, so Im hoping it doesn't give you any false positives when downloading) from my dropbox account: http://dl.dropboxusercontent.com/u/3...4/ayfxPlay.zip

Now dump the executable (called "ayfxPlay.exe") in the same directory as ayfxedit.exe... Now double click on any .AFX, and when Windows asks you what you would like to associate the .AFX file with, use the Browse button to search for the ayfxPlay.exe program... If you associate your .AFX files with ayfxPlay, it will then automatically (assuming its in the same directory) load ayfxEdit, open the file browser, load your .AFX file then play it x3 times... If you want it to stop playing, simply move the mouse around (up and down, I think - its been a while since I wrote it, and I normally just circle the mouse a bit), and then it will stop playing after the first time... Even better, if you associate ayfxPlay with a sound bank file (.AFB), it will play each consecutive sound effect within that sound bank until you move the mouse around... Its not perfect, but it might help if your loading and trying lots of individual sound files... Maybe if Shiru updates this wonderful utility (ayfxEdit), he might design it so it can accept commandlines or be associated with such files natively... [hint, hint... ]

*PS* What about the fair in Atlanta? The land of Coca-Cola! LOL!

By Maggoo

Paragon (1217)

Maggoo's picture

02-04-2014, 17:56

hbarcellos wrote:

*PS* What about the fair in Atlanta? The land of Coca-Cola! LOL!

It's happening in exactly a months now ! Lots of prep work still to do :-)

By anonymous

incognito ergo sum (116)

anonymous's picture

06-04-2014, 00:01

It seems that the afx replayer by Shiru that comes with his editor is buggy. Shiru himself has also released a patched version of his afx replayer integrated to the a pt3 player. I've been fiddling with his code to try to get an independent player able to play up to 3 sound effects without any music in background. I know z80st's work, but Shiru's one was shorter as due to the fact it does not support variable volumes.
This is the result, but I think that the 3 sound effects mix only at first execution....
Sorry for strange comments, but they were in Russian, Google translate did miracles.


TonA	EQU 0
TonB	EQU 2
TonC	EQU 4
Noise	EQU 6
Mixer	EQU 7
AmplA	EQU 8
AmplB	EQU 9
AmplC	EQU 10


; ------------------------------------------------- ------------- ;
; Initialization player effects. ;
; Turns off all channels , sets variables . ;
; Login : DE = address of the bank with the effects ;
; NB: banks of effect are .afb files 
; ------------------------------------------------- ------------- ;

AFXINIT
	ex de, hl
	inc hl
	ld (afxBnkAdr), hl; reserve table address offsets

	xor a
	ld (afxNoisePeriod), a

	ld hl, afxChData; mark all channels as empty
	ld de, #00ff
	ld b, 3
afxInit0
	ld (hl), d
	inc hl
	ld (hl), d
	inc hl
	ld (hl), e
	inc hl
	ld (hl), e
	inc hl
	ld (hl), d
	inc hl
	ld (hl), e
	inc hl
	ld (hl), d
	inc hl
	ld (hl), d
	inc hl
	djnz afxInit0
	
	ret
	

; ------------------------------------------------- ------------- ;
; Playback of the current frame . ;
; With no parameters . ;
; ------------------------------------------------- ------------- ;

AFXFRAME
	ld ix, afxChData
	ld b, 3
afxFrameLoop
	ld a, (ix +1)		; significant byte addresses effect
	or a				; if 0, the channel is not active
	jr z, afxFrameChSkip
	ld h, a
	ld l, (ix +0)		; low byte address effect

	ld a, (hl)			; read information bytes
	inc hl

	ld c, a
	ld (ix +5), a		; remember bits mixer
	and 15
	ld (ix +4), a		; remember volume

	bit 5 , c			; changing pitch period
	jr z, afxFrameNoTone

	ld a, (hl)			; remember period
	inc hl
	ld (ix +6), a
	ld a, (hl)
	inc hl
	ld (ix +7), a

afxFrameNoTone
	bit 6 , c			; period change noise
	jr z, afxFrameNoNoise
	ld a, (hl)			; period obtain
	cp #20 				; if it is more than 31 , the effect is over
	jr c, afxFrameNoise

	xor a				; vanishes high byte address and the volume
	ld (ix +1), a
	ld (ix +4), a
	jr afxFrameChSkip

afxFrameNoise
	inc hl				; remember period noise
	ld (afxNoisePeriod), a

afxFrameNoNoise

	ld (ix +0), l		; remember address
	ld (ix +1), h

	inc (ix +2)			; increment the playing time
	jr nz, afxFrameChSkip
	inc (ix +3)

afxFrameChSkip
	ld de, 8			; the next channel
	add ix, de
	djnz afxFrameLoop

	; ld a, (AYREGS + AmplA)
	; ld c, a
	ld a, (afxChData +0 * 8 +4)
	; cp c
	; jr c, afxSkipCh0
	ld (AYREGS + AmplA), a
	ld a, (afxChData +0 * 8 + 6 )
	ld (AYREGS + TonA +0), a
	ld a, (afxChData +0 * 8 +7 )
	ld (AYREGS + TonA +1), a

	ld a, (AYREGS + Mixer)
	and %11110110
	ld c, a
	ld a, (afxChData +0 * 8 + 5 )
	rra
	rra
	rra
	rra
	and %00001001
	or c
	ld (AYREGS + Mixer), a

afxSkipCh0

	; ld a, (AYREGS + AmplB)
	; ld c, a
	ld a, (afxChData +1 * 8 +4)
	; cp c
	; jr c, afxSkipCh1
	ld (AYREGS + AmplB), a
	ld a, (afxChData +1 * 8 + 6 )
	ld (AYREGS + TonB +0), a
	ld a, (afxChData +1 * 8 +7 )
	ld (AYREGS + TonB +1), a

	ld a, (AYREGS + Mixer)
	and %11101101
	ld c, a
	ld a, (afxChData +1 * 8 + 5 )
	rra
	rra
	rra
	and %00010010
	or c
	ld (AYREGS + Mixer), a

afxSkipCh1

	; ld a, (AYREGS + AmplC)
	; ld c, a
	ld a, (afxChData +2 * 8 +4)
	; cp c
	; jr c, afxSkipCh2
	ld (AYREGS + AmplC), a
	ld a, (afxChData +2 * 8 + 6 )
	ld (AYREGS + TonC +0), a
	ld a, (afxChData +2 * 8 +7 )
	ld (AYREGS + TonC +1), a

	ld a, (AYREGS + Mixer)
	and %11011011
	ld c, a
	ld a, (afxChData +2 * 8 + 5 )
	rra
	rra
	and %00100100
	or c
	ld (AYREGS + Mixer), a

afxSkipCh2

	ld ix, afxChData
	ld a, (ix +0 * 8 +5)
	and (ix +1 * 8 +5)
	and (ix +2 * 8 +5)
	rla
	jr c, afxNoNoise
	ld a, (afxNoisePeriod)
	ld (AYREGS + Noise), a
afxNoNoise

	ret

; ------------------------------------------------- ------------- ;
; Running effect on the free channel. In the absence ;
; free channels selects the most long -sounding . ;
; Input : A = number of effect 0 .. 255 ;
; ------------------------------------------------- ------------- ;
AFXPLAY
SFX
	ex af,af'

	ld hl, afxChData	; empty channel search
	ld de, 0 			; in de most time when searching
	ld b, 3
afxPlay0
	inc hl
	inc hl
	ld a, (hl)			; compare time channel with the highest
	inc hl
	cp e
	jr c, afxPlay1
	ld c, a
	ld a, (hl)
	cp d
	jr c, afxPlay1
	ld e, c				; remember the longest time
	ld d, a
	push hl				; remember the address of the channel + 3 in ix
	pop ix
afxPlay1
	inc hl
	inc hl
	inc hl
	inc hl
	inc hl
	djnz afxPlay0
						; expect to address the effect
	ex af,af' 			
	ld h, b
	ld l, a
	add hl, hl
	ld bc, (afxBnkAdr)	; address offset table effects
	add hl, bc
	ld c, (hl)
	inc hl
	ld b, (hl)
	add hl, bc			; effect address obtained in hl

	ld (ix- 3 ), l		; record in the channel descriptor
	ld (ix- 2 ), h
	ld (ix- 1 ), b		; vanishes Time
	ld (ix- 0 ), b
	ret

PT3_ROUT:
		push	af
		
		call AFXFRAME
		xor A
	
ROUT_A0:	; --- FIXES BITS 6 AND 7 OF MIXER ---
		LD	HL,AYREGS+Mixer
		set	7,( hl)
		res	6,( hl)

		LD C,0xA1
		LD HL,AYREGS
1:		OUT (0xA0),A
		INC A
		OUTI 
		CP 13
		JR NZ,1b
		pop	af
		RET

	
	code @ 0C000h
ram_data

; ------------------------------------------------- ------------- ;
; a modified version of the player based effects 0.16
; ------------------------------------------------- ------------- ;

afxNoisePeriod	ds  1
afxBnkAdr		ds	2
AYREGS:     	ds	14


; descriptors channels 5+2 bytes to the channel:
; 0 (2) the current address ( the channel is clear , if the high byte = # 00 )
; 2 (2) Time effect
; 4 (1) the volume
; 5 (1) bits of the mixer
; 6 (2) pitch period

afxChData ds 3 * 8

ram_data_end

BTW In case I do not find why also this version does not manage correctly overlapping sound effects, does anyone knows some aysfx player that works without music and can play up to 3 sfx at the same time ?
The other main requirement is the size of the code: the smaller the better.

By hbarcellos

Hero (642)

hbarcellos's picture

05-04-2014, 22:49

AR, it's missing a POP HL @ AFXINIT.
But the sounds don't seem to be playing in parallel. Anyway, I think this was not the error we're looking.

Rgds,

By ARTRAG

Enlighted (6932)

ARTRAG's picture

05-04-2014, 23:16

I asked admins to remove the push hl, it is the same
but the error in the channel usage has to be in AFXPLAY

By ARTRAG

Enlighted (6932)

ARTRAG's picture

06-04-2014, 00:49

OK the bug was that Shuru's code does not look really for empty channels, only for the channel that was playing longer
This can be solved changing AFXPLAY in this way


; ------------------------------------------------- ------------- ;
; Running effect on the free channel. In the absence ;
; free channels selects the most long -sounding . ;
; Input : A = number of effect 0 .. 255 ;
; ------------------------------------------------- ------------- ;
AFXPLAY
SFX
	ex af,af'

	ld ix, afxChData	; empty channel search
	ld	de,8
	ld	b,3
1:	ld	a,(ix +1)
	or	a
	jr	z,freechan
	add	ix,de
	djnz	1b
		
						; no free channels
	ld iy, afxChData	; search the channel that plays from more time 
	ld de, 0 			; in de most time when searching
	ld a, 3
afxPlay0
	ld l, (iy+2)		; compare time channel with the highest
	ld h, (iy+3)
	and	a
	sbc	hl,de
	jr c, afxPlay1
	add	hl,de			; remember the longest time
	ex	de,hl
	push iy				; remember the address of the channel in ix
	pop ix
afxPlay1
	ld	bc,8
	add	iy,bc
	dec	a
	jr	nz,afxPlay0
						; expect to address the effect
freechan
	ld h, a
	ex af,af' 			
	ld l, a
	add hl, hl
	ld bc, (afxBnkAdr)	; address offset table effects
	add hl, bc
	ld c, (hl)
	inc hl
	ld b, (hl)
	add hl, bc			; effect address obtained in hl

	ld (ix+0), l		; record in the channel descriptor
	ld (ix+1), h
	ld (ix+2), 0		; reset execution Time
	ld (ix+3), 0
	ret

with this, the sfx player can execute up to 3 sfx at time and, in case of need, it will kill the one that was lasting more in order to play a new sfx

Page 1/2
| 2