New beeper engines: Ulasyn and PhaserF

Show us what you're working on, (preferably with screenshots).
Post Reply
User avatar
utz
Microbot
Posts: 116
Joined: Wed Nov 15, 2017 9:04 am
Contact:

New beeper engines: Ulasyn and PhaserF

Post by utz »

I recently made two new music routines for the ZX Spectrum Beeper.

Ulasyn features 2 pulse wave channels with lo-pass/hi-pass filters with variable cutoff, variable duty cycle, duty cycle sweep, noise mode, and an interrupting PWM sample channel with variable pitch and volume.



Similar to Ulasyn, PhaserF supercharges Shiru's Phaser series with lo-pass and hi-pass filters. Features 2 dual-oscillator pulse-wave channels with different mixing modes as well as interrupting PWM samples with pitch and limited volume control.



The source code for both engines is available in my ZX Spectrum 1-bit repo on Github. There is no editor support yet, though they'll probably make their way into 1tracker and/or Bintracker at some point.
User avatar
Lee Bee
Dynamite Dan
Posts: 1291
Joined: Sat Nov 16, 2019 11:01 pm
Location: Devon, England
Contact:

Re: New beeper engines: Ulasyn and PhaserF

Post by Lee Bee »

Wow! Mind blown. :o

4 questions:
1. Is special hardware required (eg Pentagon) or can these run on a regular Speccy?
2. How much RAM would the engine eat up?
3. I presume these engines are too CPU-intensive to run during a game?
4. I was blown away not long ago to see a SID chip emulator on the Speccy. This seems even more powerful than the SID. Is that correct?
User avatar
utz
Microbot
Posts: 116
Joined: Wed Nov 15, 2017 9:04 am
Contact:

Re: New beeper engines: Ulasyn and PhaserF

Post by utz »

Hehe, thanks.

1. The engines are compatible with all models. On models that don't contend I/O, sound would probably be a bit cleaner. In any case, the above renders are from a standard 48k.
2. They each take 3333 bytes when aligned to a 256-byte border. Some light-weight compression is used for the song data, though of course there are a lot of parameters that can be set, so in the worst case a row of song data will use 20 bytes (ulasyn) resp. 28 bytes (PhaserF).
3. Correct. In theory, one could run some small graphics updates between rows, but that would add some extra noise.
4. I guess they aren't really comparable, since NSID uses AY, iirc. Purely in terms of capabilities, NSID would be more powerful, though - 3 channels and more volume resolution.
ANDREWRYALS
Microbot
Posts: 106
Joined: Sat Mar 24, 2018 5:02 pm

Re: New beeper engines: Ulasyn and PhaserF

Post by ANDREWRYALS »

Very impressive. :shock:
User avatar
Lee Bee
Dynamite Dan
Posts: 1291
Joined: Sat Nov 16, 2019 11:01 pm
Location: Devon, England
Contact:

Re: New beeper engines: Ulasyn and PhaserF

Post by Lee Bee »

Thanks for the answers, utz!

This really is incredible IMHO, superb work. You've given Tim Follin a run for his money, here. And only 3333 bytes, that's fantastic - quite negligible for 128k games. :dance It may only be suitable for music during static images, but that still makes it perfect for title screens, intro text, end credits, or short tunes for messages like "Level complete" or "The door is unlocked!" etc.

As a musician, I'd love to have just ONE of these channels playing in addition to the 3 AY channels. And/or short drum samples. That could revolutionise Speccy music.

By the way, the PhaserF tune is really scary :shock: :lol: And where are all those harmonics coming from? I can hear more than 4 pitches but there are only 4 oscillators?
User avatar
utz
Microbot
Posts: 116
Joined: Wed Nov 15, 2017 9:04 am
Contact:

Re: New beeper engines: Ulasyn and PhaserF

Post by utz »

I actually made a combined beeper/AY engine once. The problem is that there is a strong volume imbalance between these two audio sources. And exactly how big of a difference varies wildly between models and even different board versions of the same model. On top of it, most emulators do the sensible thing and either normalize both outputs, or have user options for setting the volume. So I'm afraid it's not feasible.

The extra harmonics will partly be due to the coarse volume resolution and other imperfections. The Phaser technique itself is also strong on harmonics, especially in its traditional form, where the two oscillators are XORed.
User avatar
Lee Bee
Dynamite Dan
Posts: 1291
Joined: Sat Nov 16, 2019 11:01 pm
Location: Devon, England
Contact:

Re: New beeper engines: Ulasyn and PhaserF

Post by Lee Bee »

utz wrote: Mon Feb 12, 2024 10:07 pm I actually made a combined beeper/AY engine once. The problem is that there is a strong volume imbalance between these two audio sources. And exactly how big of a difference varies wildly between models and even different board versions of the same model. On top of it, most emulators do the sensible thing and either normalize both outputs, or have user options for setting the volume. So I'm afraid it's not feasible.
Fascinating, I had no idea about the these issues. Thanks for the info. Both Agent X II and Chase HQ combine AY and Beeper to add drums to the music. I guess this means the drums will be a different volume on different machines.
AndyC
Dynamite Dan
Posts: 1406
Joined: Mon Nov 13, 2017 5:12 am

Re: New beeper engines: Ulasyn and PhaserF

Post by AndyC »

Theoretically the beeper is supposed to be the same volume as all three AY channels playing at the same time at full volume. Is that not the case (ignore+3 machines with borked AY wiring)?

If not, is it better to just avoid using both beeper and AY?
User avatar
utz
Microbot
Posts: 116
Joined: Wed Nov 15, 2017 9:04 am
Contact:

Re: New beeper engines: Ulasyn and PhaserF

Post by utz »

From the tests Yerzmyey and me ran back then on several machines, this seems to be not the case. The combination of pin pulses on beeper + AY drums like with Follin's engine sort of works, since it doesn't matter so much how loud the drums are, as long as they're somewhat audible. Anything more complex though might not be as good of an idea as it sounds on paper.
worcestersource
Manic Miner
Posts: 524
Joined: Thu Feb 03, 2022 11:05 pm

Re: New beeper engines: Ulasyn and PhaserF

Post by worcestersource »

I absolutely love this! Wow. Sounds like an early synthesiser tune used in some epic late 70s/ early 80s sci-fi. I wrote a song once (was in a prog band) that was based around such an audible concept.
Timmy
Manic Miner
Posts: 228
Joined: Sat Apr 23, 2022 7:13 pm
Location: The Netherlands

Re: New beeper engines: Ulasyn and PhaserF

Post by Timmy »

I only see this thread. I still like beeper engines for game music!

For me, in 2024, the most important thing in a Beeper engine is:

Does the music stops if a key/fire button has pressed? Because I am not going to put any engines in my games now if they don't stop using fire.
(Or maybe I should just use AY engines instead.)
User avatar
ParadigmShifter
Manic Miner
Posts: 667
Joined: Sat Sep 09, 2023 4:55 am

Re: New beeper engines: Ulasyn and PhaserF

Post by ParadigmShifter »

If it uses an interrupt (it has drums so very very likely) it's pretty easy to check for any key being pressed or a single key being pressed (and joystick fire as well I guess) and exit from the interrupt to the stop playing routine.

I tried to modify the ISR of the SpecialFX beeper engine so it took a mask of allowable keys to check (which was pretty efficient the way I did it I think) but unfortunately I could hear a (noticeably small, but I wrote the tune 35 years ago so I knew how it should sound very well) difference in how the tune sounded after that so I got rid of it :( I guess it's VERY sensitive to length of the ISR routine. EDIT: Use case: I wanted the tune to stop only if you pressed a key which was relevant on the menu it was displaying. In the end I had to go with only play tune on main menu, and any key pressed kills the tune :/

Main thing for me (apart from a way to stop the tune of course) would be a way to stop the music and resume it from the same place if you wanted... I couldn't get that to work with SpecialFX but it was all self-modifying code and not really documented (RIP Joffa) so I gave up in the limited time I had available.

I'd also like better tools to produce the notes for each channel. I used the original key of my tune but discovered I couldn't add a low E to the bass line since that was out of the range for the engine... really wished for a transpose key function at that point ;)

I'd also like a way to input the notes on the tools using a guitar fretboard instead of a keyboard since guitars are easy for me, keyboards a pain in the arse - especially when transposing by hand on a keyboard :( I wouldn't need a transpose function with a guitar fret input system (but a capo tool would be good as well).

Beeopola is excellent though (could do with more documentation and the community to better comment the source code it produces of course).

So I'd want Beepola support for any new engine as well if poss.

EDIT: This new engine sounds very impressive though! Thumbs up
Timmy
Manic Miner
Posts: 228
Joined: Sat Apr 23, 2022 7:13 pm
Location: The Netherlands

Re: New beeper engines: Ulasyn and PhaserF

Post by Timmy »

ParadigmShifter wrote: Sat Feb 24, 2024 2:19 am If it uses an interrupt (it has drums so very very likely) it's pretty easy to check for any key being pressed or a single key being pressed (and joystick fire as well I guess) and exit from the interrupt to the stop playing routine.
Well, (almost) all beeper engines in this century are not interrupted at all. So don't worry about it. ;)

AY-engines can usually be interrupted, fortunately.

But they are usually used differently, beeper engines are used mainly on the main menu screen, where key pressed and fire buttons are crucial. While AY engines are used for continuous playing, and interrupts, start, stop, restart and change song is important.
User avatar
ParadigmShifter
Manic Miner
Posts: 667
Joined: Sat Sep 09, 2023 4:55 am

Re: New beeper engines: Ulasyn and PhaserF

Post by ParadigmShifter »

That's a shame. I thought most engines using drums played notes at max speed and had an interrupt to sync very short drum sfx, if that's outdated now then oh well.

No ISR means no good as a background tune on a menu then I guess unless they check every so often if a key is pressed (again, a mask of keys pressed would be preferable). I know engines have to have precise T state timing between OUT instructions though so that may be quite hard.
Timmy
Manic Miner
Posts: 228
Joined: Sat Apr 23, 2022 7:13 pm
Location: The Netherlands

Re: New beeper engines: Ulasyn and PhaserF

Post by Timmy »

ParadigmShifter wrote: Sat Feb 24, 2024 2:40 am No ISR means no good as a background tune on a menu then I guess unless they check every so often if a key is pressed (again, a mask of keys pressed would be preferable). I know engines have to have precise T state timing between OUT instructions though so that may be quite hard.
Some of my games used a beeper engine that stops at keypresses but not kempston. So I might have to strip the music in the near future to let people playing it using joystick only.

Complicated beeper engine nowadays are very timing sensitive so having kempston checking is crucial.

Perhaps I could replace the music with an attract mode, so that I can let kids play them with kempston only. Keyboard is still too complicated to set up for them.
User avatar
utz
Microbot
Posts: 116
Joined: Wed Nov 15, 2017 9:04 am
Contact:

Re: New beeper engines: Ulasyn and PhaserF

Post by utz »

Timmy wrote: Sat Feb 24, 2024 1:58 am Does the music stops if a key/fire button has pressed? Because I am not going to put any engines in my games now if they don't stop using fire.
(Or maybe I should just use AY engines instead.)
Yes, both engines check for Kempston and will exit on any key and fire. However, keyboard checks are only performed between rows, so it might feel a bit sluggish. This is necessary to avoid generating a rumbling noise at the internal update rate of ~35.6 Hz.
Post Reply