Sound libraries, any examples.

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Sound libraries, any examples.

Post by Nomad »

At the moment I am using R-tape's example code from WOS forums, I was curious if anyone else has some sounds they would like to share?

got the sweeps and farts, but what I want to get is like air bubbles in water popping. Like when you run over a pedestrian in mailstrom. I am guessing its a white noise based sound but not sure.

The plan is to have the title/menu screen be populated with chess graphics with the 'popping' sound as they are placed on the screen.

But any interesting sounds you guys want to share would be much appreciated.
User avatar
Blerkotron
Dizzy
Posts: 90
Joined: Mon Nov 13, 2017 12:36 pm

Re: Sound libraries, any examples.

Post by Blerkotron »

I used Shiru's "BeepFX" to generate sound effects for my last couple of projects, it's great fun to play around with and makes some super beeps and farts. It even has a randomize button that you can keep hitting if you don't really know what you want. The assembly code it generates is pretty compact, too, which is extra nice.
hikoki
Manic Miner
Posts: 576
Joined: Thu Nov 16, 2017 10:54 am

Re: Sound libraries, any examples.

Post by hikoki »

I did a bit of research, see my post on this thread: https://www.worldofspectrum.org/forums/ ... ent_892041

AYFX and BeepFX are tools made by Shiru. I think the AYFX player had some issues, see on my post a link to the routine fixed by a zuno forum member.
Auto-sonics had some water drop effect in Basic. Sound Fx and Effetti Sonori allowed you to generate sounds and export them as assembler listings.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Sound libraries, any examples.

Post by Nomad »

Thanks guys theses are excellent. 8-)

On a related topic does anyone have the gasman soundtracker tutorials?
hikoki
Manic Miner
Posts: 576
Joined: Thu Nov 16, 2017 10:54 am

Re: Sound libraries, any examples.

Post by hikoki »

Nomad wrote: Thu Jan 11, 2018 2:24 am On a related topic does anyone have the gasman soundtracker tutorials?
I think it's on zxf 9 and 10
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Sound libraries, any examples.

Post by Nomad »

I was playing with soundFX and I dumped the binary data from 3000,100

(just to be sure i hoovered up the data,)

However once dissasembled and I tried to assemble it in pasmo all of the djnz's are out of range.

I tried it a few times and its the same problem with any sound.

So this is the bin, 30000,100 (it only requires 30000,50)

Code: Select all

1609 1eb1 060a c53a 485c cb3f cb3f cb3f
cbe7 d3fe 4200 0000 10fb cba7 d3fe 4300
0000 10fb 141c 001c c110 dbc9 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 
Ok so far so good

I use https://onlinedisassembler.com/odaweb/ to do the disassembly as I am to potato to figure out how to do it in fuse.

Code: Select all

org 50000
	ld d,$089
	ld e,$0b1
	ld b,$00a
	push bc
	ld a,($5C48)
	srl a
	srl a
	srl a
	set 4,a
	out(254),a
	ld b,d
	nop
	nop
	nop
	djnz $15
	res 4,a
	out(254),a
	ld b,e
	nop
	nop
	nop
	djnz $01f
	nop
	dec e
	inc d
	inc e
	pop bc
	djnz $06
	ret
end 50000
was the disassembly wrong? its using out(254) so that makes sense. That is why I thought it was ok disassembly.

djnz is making relative jumps, so I am assuming it would have gone to a label of some sort. So I guess these djnz are trying to jump to a location that is not been disassembled?

As an aside, it was not WOS where I saw the assembly beep routine it was from this website..

viewtopic.php?f=6&t=70
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Sound libraries, any examples.

Post by Nomad »

This is my annotated version of the disassembly.. my guess is that soundFX uses a template approach to generating the soundfx samples whereby each generated sample fills 50 bytes of memory. You can see this when you have a choice of generating 1-9 samples. you are told to save:

Image

30000,50 for 1
30000,100 for 2
30000,150 for 3
30000,200 for 4
30000,250 for 5
30000,300 for 6
30000,350 for 7
30000,400 for 8
30000,450 for 9

Image

Code: Select all

org 50000
	ld d,$089				; load 0x089 into register d
	ld e,$0b1				; load 0x0b1 into register e
	ld b,$00a				; load 0x00a into the accumulator
	push bc				; pushes register pair bc onto the stack
	ld a,($5C48)			; load 0x5C48 into the accumulator
	srl a					; works same as sra but 0 is loaded bit 7, shift
						; accumulator right.
	srl a					; works same as sra but 0 is loaded bit 7, shift right
						; accumulator right.
	srl a					; works same as sra but 0 is loaded bit 7, shift right
						; accumulator right. 3 times total.
	set 4,a				; sets bit 4 of the accumulator (16)
	out(254),a			; out to the speaker port.
	ld b,d				; loads register b into d
	nop					; no operation - padding routine for the relative jumps.
	nop					; no operation - padding routine for the relative jumps.
	nop					; no operation - padding routine for the relative jumps.
	djnz $15				; decrement register b, jump not zero $15
	res 4,a				; reset bit 4 of register a. 
	out(254)				,a; out to the speaker port.
	ld b,e				; load register e into b
	nop					; no operation - padding routine for the relative jumps.
	nop					; no operation - padding routine for the relative jumps.
	nop					; no operation - padding routine for the relative jumps.
	djnz $01f				; decrement register b, jump not zero $1f
	nop					; no operation - padding routine for the relative jumps.
	dec e				; decrement register e
	inc d				; increment register d
	inc e				; increment register e
	pop bc				; pop the data off the stack back to register pair bc
	djnz $06				; decrement register b, jump not zero $6
	ret					; return
end 50000
hikoki wrote: Thu Jan 11, 2018 3:18 am
Nomad wrote: Thu Jan 11, 2018 2:24 am On a related topic does anyone have the gasman soundtracker tutorials?
I think it's on zxf 9 and 10
Thanks that was what I was looking for, zxf8, zxf9, zxf10.
User avatar
R-Tape
Site Admin
Posts: 6353
Joined: Thu Nov 09, 2017 11:46 am

Re: Sound libraries, any examples.

Post by R-Tape »

The djnz are trying to jump to absolute memory addresses like 06, which from org 50000 is a long way away! Djnz only does 256 byte jumps max.

The code is assuming org 0, so djnz 06 jumps to the first PUSH BC. You'll have to count through and add your own labels.

I do this kind of thing in ZXSPIN , if you copy straight from the debugger it brings the asm and labels with it.

Excellent. I've been looking for that sound tracker tutorial for ages.
Hikaru
Microbot
Posts: 100
Joined: Mon Nov 13, 2017 1:42 pm
Location: Russia
Contact:

Re: Sound libraries, any examples.

Post by Hikaru »

hikoki wrote: Thu Jan 11, 2018 12:38 am AYFX and BeepFX are tools made by Shiru. I think the AYFX player had some issues, see on my post a link to the routine fixed by a zuno forum member.
I made something called mFX last year, specifically with Cgonzalez's Gandalf game in mind. It's a system for combining AY effects+music in the best way that produces the least amount of artifacts. It consists of a new AYFX-format effect player, and a specification for the 'data exchange format' that in theory allows it to be used alongside most AY music players, with a small bit of modification to the latter of course. It already includes a version of the Vortex Tracker II player that supports this. For now, you can check out this if you're interested. Proper release has to wait as it needs a detailed readme due to a number of quirks that are necessary to be explained (some are detailed inside mfx.asm).
Inactive account
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Sound libraries, any examples.

Post by Nomad »

R-Tape wrote: Thu Jan 11, 2018 7:00 am The djnz are trying to jump to absolute memory addresses like 06, which from org 50000 is a long way away! Djnz only does 256 byte jumps max.

The code is assuming org 0, so djnz 06 jumps to the first PUSH BC. You'll have to count through and add your own labels.

I do this kind of thing in ZXSPIN , if you copy straight from the debugger it brings the asm and labels with it
Ah I understand so I just add my org to the djnz number. Great everything works. :lol:

For people reading this thread, wondering where the working example is... I adapted it for library use in my project so I put it in the showcase thread.
User avatar
Seven.FFF
Manic Miner
Posts: 735
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: Sound libraries, any examples.

Post by Seven.FFF »

hikoki wrote: Thu Jan 11, 2018 12:38 am AYFX and BeepFX are tools made by Shiru. I think the AYFX player had some issues, see on my post a link to the routine fixed by a zuno forum member.
BTW I modded the AYFX player to play sounds on specific channels instead of the first free channel, and added a simple sustain loop so I could have continuous sounds with an attack and release. The latter feature needs improvement because it's a pain to calculate the sustain and release offsets manually, and they change every time you edit the soundbank. Eventually I want to mod the editor to let you set the sustain and release points graphically. I also got the editor building on the latest free version of C++Builder (RADStudio 10.2).

https://github.com/Threetwosevensixseve ... t-improved

I had problems with AYFX too. I get weird bursts of noise or quiet volume the first effect I play after AY music had been played. I talked to Shiru about it briefly but I never managed to get to the bottom of it. It's entirely possibly I broke it with my mods, but I'm buggered if I can see what the problem is.

I didn't know about the haplo fix, thanks! I will incorporate that to see if it helps.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
hikoki
Manic Miner
Posts: 576
Joined: Thu Nov 16, 2017 10:54 am

Re: Sound libraries, any examples.

Post by hikoki »

^^^
Cheers Robin. I didn't know about your AYFX fork. A Sustain loop and porting Shiru's sources to a free C++ IDE are interesting additions. Let us know if the Haplo fix works for you. Take care of you migraines! (Tip: cycling 40 Km once every 10 days or so and a basketball toy on your door may be of help)
User avatar
RMartins
Manic Miner
Posts: 776
Joined: Thu Nov 16, 2017 3:26 pm

Re: Sound libraries, any examples.

Post by RMartins »

R-Tape wrote: Thu Jan 11, 2018 7:00 am The djnz are trying to jump to absolute memory addresses like 06, which from org 50000 is a long way away! Djnz only does 256 byte jumps max.
...
Not quite.

Yes it uses only 1 byte (256 combinations), but it's signed, so we would expect something like -128 to 127, but in fact it's –126 to +129, due to the length of the instruction (2 bytes), and its relative to the instruction opcode address (first instruction byte).

NOTE: what you write on your ASM code, and what is encoded into the instruction, are different things. The Assembler does some simple math magic (addr-2), to account for the instruction offset.
C.Born
Manic Miner
Posts: 202
Joined: Sat Dec 09, 2017 4:09 pm

Re: Sound libraries, any examples.

Post by C.Born »

Post Reply