Beeper music during gameplay/action

General software. From trouble with the Banyan Tree to OCP Art Studio, post any general software chat here. Could include game challenges...
AndyC
Dynamite Dan
Posts: 1408
Joined: Mon Nov 13, 2017 5:12 am

Re: Beeper music during gameplay/action

Post by AndyC »

Sparky wrote: Wed Apr 28, 2021 2:46 pm I don't know why some of you think beeper music slows down games? They are loaded into memory using machine code, and made to repeat. Then, the game executes and plays. The effect of this is probably less than 5% of the overall speed.

P.S. I am talking about music, not sound effects.
Decent beeper music requires fairly precise timing, which makes playing it while doing other things (which can take a variable amount of time) tricky. You tend to have to do a bit at the start of each frame and just accept that it will distort somewhat. And that's using up a fair whack of the best time to be drawing to the screen, so it's not ideal.
toot_toot
Manic Miner
Posts: 678
Joined: Thu Nov 29, 2018 7:17 pm

Re: Beeper music during gameplay/action

Post by toot_toot »

Nobody mentioned Ghostbusters yet?!?!
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2641
Joined: Mon Nov 13, 2017 3:16 pm

Re: Beeper music during gameplay/action

Post by Ast A. Moore »

Stefan wrote: Wed Apr 28, 2021 10:55 pm The menu only consists of a three level parallax star field and an attribute flash of the selected control method.
That still takes up quite a lot of the CPU cycles (considering how many are needed to play the multichannel sound). The player and the animation must be decently optimized.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
Einar Saukas
Bugaboo
Posts: 3145
Joined: Wed Nov 15, 2017 2:48 pm

Re: Beeper music during gameplay/action

Post by Einar Saukas »

Ast A. Moore wrote: Wed Apr 28, 2021 10:18 pm Dark Fusion pulls off some pretty amazing stuff in the animated menu with multichannel beeper music.
That's a weird game... I can imagine a conversation like this:

AUTHOR: "We just finished developing our new shoot-em-up!"
PUBLISHER: "Sorry, we are only interested in platform games now."
AUTHOR: "Hold on..."
User avatar
Turrican
Microbot
Posts: 187
Joined: Thu Apr 12, 2018 5:48 pm
Location: Brazil

Re: Beeper music during gameplay/action

Post by Turrican »

The Goonies!!!
User avatar
zxbruno
Manic Miner
Posts: 214
Joined: Sun Mar 04, 2018 6:13 am

Re: Beeper music during gameplay/action

Post by zxbruno »

I just wanted to add that about a year or two ago someone made a demo in 100% Sinclair Basic which featured Beeper music during the whole demo. It's a bit off-topic but I thought it was worth mentioning because it was impressive to see (and hear). Can't remember the name of the demo though.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2641
Joined: Mon Nov 13, 2017 3:16 pm

Re: Beeper music during gameplay/action

Post by Ast A. Moore »

Einar Saukas wrote: Thu Apr 29, 2021 1:04 am
Ast A. Moore wrote: Wed Apr 28, 2021 10:18 pm Dark Fusion pulls off some pretty amazing stuff in the animated menu with multichannel beeper music.
That's a weird game...
It is weird.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Art
Manic Miner
Posts: 206
Joined: Fri Jul 17, 2020 7:21 pm

Re: Beeper music during gameplay/action

Post by Art »

Moon Patrol from Atarisoft. A nice conversion with parallax scrolling and music during gameplay, but unfortunately slow.
User avatar
Manu128k
Dizzy
Posts: 83
Joined: Tue Aug 13, 2019 9:45 pm
Location: Spain
Contact:

Re: Beeper music during gameplay/action

Post by Manu128k »

User avatar
Turtle_Quality
Manic Miner
Posts: 506
Joined: Fri Dec 07, 2018 10:19 pm

Re: Beeper music during gameplay/action

Post by Turtle_Quality »

Sparky wrote: Wed Apr 28, 2021 2:46 pm I don't know why some of you think beeper music slows down games? They are loaded into memory using machine code, and made to repeat. Then, the game executes and plays. The effect of this is probably less than 5% of the overall speed.

P.S. I am talking about music, not sound effects.
The easiest way to make music with the beeper is to disable interrupts and have a timer loop before every click, like the rom routine. But that means nothing else is happening. Or you compromise by playing short beeps then some action happening. But the beeps can't be too short or they won't be recognisable beeps, just clicks. The shorter the beeps the less musical they are, the longer they are the less time for action, the slower the game

Much, much more difficult is to try to weave your music, display and logic code so that the clicks arrive at the right time, the graphics aren't chopped by the raster and there's time to get everything done at an action speed. There's no way to tell the exact time apart from a frame counter which is too low res or the R register which is too hi res. By the way I'm going to make a feeble attempt at this in my game (for sound affects) and almost certainly fail

And once the 128K was on the market it was way easier just to put the in game music in the 128K version, let the AY chip do the work for you
Definition of loop : see loop
Sparky
Manic Miner
Posts: 611
Joined: Tue Dec 15, 2020 9:42 pm

Re: Beeper music during gameplay/action

Post by Sparky »

If you just load it on a high memory location, and have it repeat (all in machine language), without any special timings, it will barely make a difference.
Alex
AndyC
Dynamite Dan
Posts: 1408
Joined: Mon Nov 13, 2017 5:12 am

Re: Beeper music during gameplay/action

Post by AndyC »

Sparky wrote: Thu Apr 29, 2021 2:52 pm If you just load it on a high memory location, and have it repeat (all in machine language), without any special timings, it will barely make a difference.
It doesn't work like that. You can't just tell the CPU to run this bit on repeat. You have to do all the necessary scheduling yourself and, as mentioned by [mention]Turtle_Quality[/mention] , you don't have the luxury of ideal timers. You can call an interrupt routine once every 1/50th of a second (not often enough) or attempt to manually time it using the R register (difficult and rolls over too often). So pretty much every way of doing it is a bit nasty.
User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

Re: Beeper music during gameplay/action

Post by Stefan »

Sparky wrote: Thu Apr 29, 2021 2:52 pm If you just load it on a high memory location, and have it repeat (all in machine language), without any special timings, it will barely make a difference.
Machine language <> Magic.

To produce a middle A note (440Hz) you need to be toggling the speaker 440 times a second, with 50 frames a second, that requires 8 changes per 50 Hz frame.

Easy? Without any hardware timers or interrupts as already mentioned, no.
+3code

Re: Beeper music during gameplay/action

Post by +3code »

I dont know if it's a good idea but perhaps can be added "In-game music" as "Feature" in the search form.
User avatar
Ersh
Manic Miner
Posts: 480
Joined: Mon Nov 13, 2017 1:06 pm

Re: Beeper music during gameplay/action

Post by Ersh »

Stefan wrote: Thu Apr 29, 2021 4:40 pm To produce a middle A note (440Hz) you need to be toggling the speaker 440 times a second, with 50 frames a second, that requires 8 changes per 50 Hz frame.
Wouldn't the speaker need to be turned on then off for a complete cycle, meaning that you need to toggle the speaker 880 times a second for a middle A?
User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

Re: Beeper music during gameplay/action

Post by Stefan »

Ersh wrote: Tue May 11, 2021 11:18 am
Stefan wrote: Thu Apr 29, 2021 4:40 pm To produce a middle A note (440Hz) you need to be toggling the speaker 440 times a second, with 50 frames a second, that requires 8 changes per 50 Hz frame.
Wouldn't the speaker need to be turned on then off for a complete cycle, meaning that you need to toggle the speaker 880 times a second for a middle A?
Yes, I think you are spot on, you actually need 16 evenly timed OUTs to the beeper per frame, which is even further past "trivial in machine language in high memory".
User avatar
druellan
Dynamite Dan
Posts: 1475
Joined: Tue Apr 03, 2018 7:19 pm

Re: Beeper music during gameplay/action

Post by druellan »

Hi! We are compiling a definitive list here, so we can add a new group to the database.
Post Reply