Topic: new engine: zbmod

Already made this a couple of months ago, but didn't release it earlier because I wanted to "troll" the next best beeper compo with it first. de:coded provided the opportunity (not sure if I was successful because the results file is still not released), so here we go.

zbmod is a 3-channel mod player, meaning it plays PCM WAV samples of arbitrary length, like SampleTracker. It has a few advantages over the latter, though.

- better sound (still plenty of noise of course, but still a massive improvement over ST's replayer methinks)
- better note range
- possibility to use looped samples

On the technical side, the mixdown runs at about 9 KHz, with 21 relative volume levels. The routine uses the undocumented "OUT (C),0" instruction, so there different versions for NMOS and CMOS are required. I was too lazy to add CPU detection again, sorry wink

I also tried some things which were only moderately successful. Firstly, reloading data is done during the sound loop. This was a major p.i.t.a. to code, and ultimately didn't reduce noise as much as I had hoped, so I'm still not sure if it was worth the hassle.
Secondly, sound generation is done in a way so the beeper will always stay afloat* (ie it won't retract completely). This works reasonably well on hardware, but on emulators, a high-pitched parasite tone will be introduced. I've included a special emulator version which reduced the parasite tone somewhat, albeit at the cost of a lowered overall sound quality.


Anway, long story short, here are the usual links:
download (includes XM converter)
source
demo tune

*Ok, some words about the reasons behind this. zbmod switches the state of port #FE with 8 t-state precision. However, this is a problem if one wants the beeper to be "on" for exactly 8 t-states (= rel. volume level 1), because the fastest switch would still take 11t (out (#fe),a). The 3t difference would be neglicable, but switching after 11t would introduce a lot of noise because of IO contention. So the earliest moment to switch state would in fact be after 16t, at which point we've already reached volume level 2. How to solve this? zbmod simply pretends that 16t uptime is volume level 0. Works fine on hardware, but unfortunately it fails on emulators. I assume this is due to errors introduced by the quantization of the beeper output, so it's not something that can be easily fixed with better emulation. So this approach is ultimately a bad idea considering a lot of beeper fans don't have access to real hardware.

Re: new engine: zbmod

Wow !

Amazing work, mate smile

This really is an exciting development for ZX Beeper !

Re: new engine: zbmod

It's very impressive!
I'll show the link on my friends' forum about old computers, where they stream 1-bit music on their Thomson T07...

4 (edited by garvalf 2016-06-09 21:15:28)

Re: new engine: zbmod

it seems the tap files in the archive don't work at all with the fuse emulator (edit: I had a problem with fuse, if I use fuse-sdl it sounds ok, probably a pulsesh**t problem again). With zesarux it's better, we can recognise the music. With a ZX clone on FPGA, the sound seems to be ok, with much more depth and bass. Do you have the source for booom and for the other one?

Re: new engine: zbmod

Well, I use fuse for development, so it'd be rather odd if the taps wouldn't work (except the CMOS one, which will give no sound except on Pentagon and such). Does the NMOS version work properly on your FPGA machine, or does it have the high-pitched beep like in fuse?

Test tune XM is attached. I'd rather not publish the one for booom, but I'll mail it to you if you like.

Post's attachments

zbmod-testtune.xm 41.81 kb, 2 downloads since 2016-06-10 

You don't have the permssions to download the attachments of this post.

Re: new engine: zbmod

Hi

Just tried the demo tunes on real hardware (48k rubber keyed issue 4b)

Played well through the mic socket (on headphones) and there appeared to be silence on the silent parts (although overall volume was very low anyway) but through the ear socket there was a much more pronounced parasite whine constantly.

Is this how the engine was designed - to be output through the mic socket ?

cheers

Re: new engine: zbmod

Why of course, you should always use the mic socket wink

Yes, overall volume is quite low unfortunately. One could probably get a little more volume by properly maximizing all samples, but overall there's not much that can be done about it, I'm afraid. Still experimenting though wink

Re: new engine: zbmod

Yes I always use the mic socket when recording from real hardware but the output through the ear socket sounded similar to the output through the Spectaculator emulator.  I just wondered if emulators are usually coded to reproduce beeper output as if through the ear socket?

I also remember a thread on here a while ago discussing the volume difference between the 2 ports and how some engines back in the day tried to use this, Odin tunes?

Re: new engine: zbmod

Well, they *should* emulate the mic port. But in reality it seems the majority of emulator authors chose to emulate the beeper by ear (and I mean an actual human ear, not the socket) hmm. The ear port behaviour is actually not very well understood, and there are currently no emulators which emulate it accurately afaik. The ear port has a high latency (meaning it can take a few thousand cycles before output to the mic socket can be detected on ear), and this latency seems to vary quite a lot between models and board revisions.

There is indeed also the possibility to use the ear port directly for sound, but the results are rather unpredictable (see http://problemkaputt.de/zxdocs.htm#spectrumsound). Hence my conclusion is that it's not worth using it, except perhaps to give a little extra overall volume boost. Alone Coder does that in his engines. I usually stick to outputting 0x10 (just mic), but for example Beepertoy uses 0x18 (mic+ear) in a rather unsuccessful attempt to boost the click drum volume.

Re: new engine: zbmod

holy ... wow. This is a cool development. Well, when there's another beeper compo coming up, I'll need to remind myself of this one! May need someone with a speccy to render it though smile

11

Re: new engine: zbmod

Updated the xm2zbmod converter. Fixing the relative sample offset bug was one of the hardest things I've done in recent times, certainly more difficult than the zbmod engine itself.

The new converter brings some changes, namely:

- 16-bit samples are now supported.
- Relative sample offsets other than F-6 (+29) are correctly handled now, as long as they're positive (ie C-4 or higher).
- The note range is no longer fixed. It's still 4 octaves, but the lower and upper limits will vary slightly (at most +/- 1 octave). You can run xm2zbmod with the new option "-r" to see what the actual range for each used sample is.
- You can now supply the option "-i <filename>" to convert a module that isn't named "music.xm".

I doubt the converter will be free of bugs yet, but I'd say it's at least ready for some beta testing.
Download is at https://github.com/utz82/ZX-Spectrum-1- … p?raw=true as usual.

Re: new engine: zbmod

Hehe, you managed it then mate smile

Great news, will give it a try later.

13

Re: new engine: zbmod

Haha, words can't describe what a massive pain in the a*** this was.
I didn't follow your suggestion of including some samples/instruments after all, because hopefully it should just work with any random sample out there now. Even random MOD imports should theoretically be reasonably safe now.

Re: new engine: zbmod

That's great news.

I just thought a few included samples (bass/lead/drums) that work particularly well with the engine might speed up the creation of some new tunes?

I'll give it a test later smile

15

Re: new engine: zbmod

I'm considering putting together a seperate sample pack at some point. Though at the moment I really can't be bothered. Those endless searches through vast sample libraries is what turned me away from making (PC-based) sampled music many years ago big_smile

Re: new engine: zbmod

I remember when I used to do sample based Quartet music on the ST back in the 90s I used to export instruments from existing .mod files, usually Amiga ones that had been ported over.

Still have quite a few .mods so I'll probably look through those and test some of the instruments to see which sound OK in the engine.

17 (edited by garvalf 2016-07-29 16:08:46)

Re: new engine: zbmod

Congratulation for this work and achievement!
Now we don't need to use old spectrum software (which are quite difficult to use) for making 1-bit digit music (even though some of the pleasure to design the music can be found in using them).

I used to make some mod music, but like you because of the problem of the creation of the samples (either rip some already premade samples, or make them myself), I prefer to compose pure synthesis music (1bit, ay, sid, fm...), also I get more fun from starting it from scratch. It's also the reason why my last MOD were made using only the wave drawing feature of milkytracker.

18

Re: new engine: zbmod

For me, even having to fiddle with FM or SID is already too much. I love the sounds these things make, but every time I try to compose something on these I get lost in the endless realms of sound design hmm