SNES Doom Source Released! Now What?

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: SNES Doom Source Released! Now What?

Post by tepples »

SPC700 direct page is either $0000-$00FF or $0100-$01FF. If it is set to the latter, the CPU cannot use direct page instructions to read the I/O ports.
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: SNES Doom Source Released! Now What?

Post by 93143 »

none wrote: Fri Sep 04, 2020 1:37 amCan't you use indirect moves instead and just move the direct page to where you want to stream the data?
I don't think that would be a net win. The instruction I'm using, mov !addr+X, A, takes one less cycle than mov [dp]+Y, A, which gives me three cycles of extra timing margin. In your scheme, writing the destination addresses into direct page instead of wherever my pickup code is would save enough time that I could improve my initial margin (by one cycle), but my scheme gives me a narrower timing-critical section, so I can just offset the timing ranges where I use each delay block and still get better performance despite the off-centre start.
Also if the loop is unrolled
This idea would seem to suggest that the area of memory available to stream data into would be much smaller than the memory taken by the unrolled loop, which is not a limitation I'm willing to accept. It implies a large chunk of memory dedicated to streaming just for a few tiny ring buffers, and a nearly complete inability to do sample replacement (where the buffer is static and much larger). Not to mention that with an unrolled loop it would take forever to swap out the delay section if clock drift was detected.
Maybe you can pass the current buffer positions / stride to the CPU during sync, and adjust the burst length based on that?
I'm not even sure I can get the current buffer positions on the SPC700 side. I was hoping to be able to infer them from the timers and sample rates (because however bad the APU clock is, it is at least guaranteed to remain in step with itself)... Yes, it would work, if it could be pulled off. I'd still need the clock ratio to adjust the streaming data pickup loop length, though.

As for adjusting burst length, I was going to use a higher data rate than necessary and just delay a burst by one slot now and then. This would make fitting into the buffer easier, as there's no way to intelligently handle the case where the data burst straddles the end of the buffer, so you have to make sure they line up, but if all the bursts are the same size you have nothing to worry about.

APU-side sync is all very well when the playback speed is supposed to be fixed, but in a case like Doom where the streaming samples may be played across a range of pitches, CPU-side is the only way to make it work without unnecessarily large buffers.

...and now I'm wondering if it's possible to implement the Doppler effect. Doomguy probably moves fast enough for it to be a thing, and Lost Souls definitely do. On the other hand, the effect might end up sounding comical, which is not appropriate for Doom... and I don't think it would play well with reverb...
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: SNES Doom Source Released! Now What?

Post by tepples »

As for the Doppler effect, here are things Doom and Animal Crossing have in common:
  • The four-character code ADME. Doom for Game Boy Advance was AGB-ADME, while Animal Crossing: Wild World for Nintendo DS was NTR-ADME. (Spider-Man anyone?)
  • The release of Doom Eternal and Animal Crossing: New Horizons for Nintendo Switch on the same day around the start of COVID-19 lockdown in many areas, celebrated in meme circles as Isabelle and Doomguy enjoying each other's games.
  • Running in excess of 50 km/h. Animal Crossing for GameCube, DS, and Wii caps running speed at one cell per 16 frames. An "acre" is 16 by 16 cells. Given the real world definition of an acre as 43560 square feet (4046.86 m²), this must mean outdoor cells are 4 m on a side. This would make the outdoor running speed .25 m per frame, or .25 * 60,= 15 m/s, or .25 * 60 * 60 * 60 / 1000 = 54 km/h. "Coelacanth: Lessons from Doom" states Doomguy's running speed as "about 50 scale miles per hour – nonsensically fast by modern standards."
But if you really want to overthink it, how well do the atmospheres of Phobos and Deimos carry sound?
User avatar
Señor Ventura
Posts: 233
Joined: Sat Aug 20, 2016 3:58 am

Re: SNES Doom Source Released! Now What?

Post by Señor Ventura »

Now that we are talking about sound... Do has doom dolby surround sound for quadraphonic speakers?.


Samurai shodown and others has it, look at this videos:
https://youtu.be/1YuGGN3SRj8?list=UUGrS ... A6VDg&t=21
https://www.youtube.com/watch?v=pdgX8sL ... &index=268
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: SNES Doom Source Released! Now What?

Post by 93143 »

tepples wrote: Sat Sep 05, 2020 3:55 amAnimal Crossing for GameCube, DS, and Wii caps running speed at one cell per 16 frames. An "acre" is 16 by 16 cells. Given the real world definition of an acre as 43560 square feet (4046.86 m²), this must mean outdoor cells are 4 m on a side.
Doesn't that make the characters pretty big? Trees, fruits and vegetables... I think this one can be chalked up to non-literal artistic representation, similar to how the SNES Final Fantasy games dealt with open-world traversal.
"Coelacanth: Lessons from Doom" states Doomguy's running speed as "about 50 scale miles per hour – nonsensically fast by modern standards."
That's one reason I think using the Doppler effect might be unnecessarily comical. Doomguy's run speed, I think, is another case of non-literal artistic license to make the game more fun to play. Hearing sounds pitch up and down like you're literally running at 50 mph past the sound sources would legitimize the literal interpretation and expose the absurdity.
But if you really want to overthink it, how well do the atmospheres of Phobos and Deimos carry sound?
Well, Deimos is low enough over Hell (low enough that Doomguy can rappel down!) that that's probably not a concern... Perhaps Phobos has some sort of dome over the base, or at least over individual buildings that seem to have courtyards. It's not like the images on the map seem to have much to do with the level layouts anyway...

No, the real question is "why is there a misty sky on a moon 14 miles wide?". Maybe there is a dome over the whole crater, explaining the atmosphere, and the mist is from the nuclear plant venting coolant... although if you really want to overthink it, large domes on airless worlds don't work out nearly as well as you'd think from an anchoring and structural strength perspective. They tend to blow off due to the atmospheric pressure underneath them, since the force goes up as the square of the circumference, and it's hard to add enough mass to the dome to counteract this - 1 bar is 10 metres of water on Earth, and this ain't Earth...

Speaking of gravity, I suspect Doomguy and the former soldiers could simply be wearing magnetic boots, and the demons are potentially exempt due to not being strictly physical creatures. Unfortunately this doesn't explain why a zombieman falls over in a puddle of blood when killed... Artificial gravity is the other obvious solution, but is the world of Doom advanced enough to have it? The teleportation technology suggests maybe... although they did end up cheating by using magic (fan theory I heard somewhere); hence the plot...

None of this explains how Doomguy can run at fifty miles an hour in what is clearly not powered armour. The Doom Slayer could maybe do it (and he is wearing powered armour), but the original Doomguy is just a random marine.

It's probably not good to overthink Doom. It's like overthinking Super Mario Bros.... It's been said that movies should avoid raising questions that have stupid answers. This clearly applies just as well to other forms of narrative fiction like TV and literature, at least if they're attempting to be taken seriously, but it doesn't apply to jokes ("how did the dog learn to talk?"), and it probably doesn't apply to the sort of gameplay-first creation Doom is either. It hangs together well enough to justify the gameplay, and that will do.
Señor Ventura wrote: Sat Sep 05, 2020 4:42 amNow that we are talking about sound... Do has doom dolby surround sound for quadraphonic speakers?.
Not as far as I know. The music sounds like it's conventional stereo, the sound effects are in mono, and there are no options to change either of them.

It's certainly possible, which is why I suggested it upthread. The S-DSP doesn't incorporate a pan law; you have to manually adjust the L and R channel volumes to pan a sound. The channel volumes are signed, meaning you can phase-invert the signal on one side or the other, and that's all you need for Dolby Surround. Vortex is a good example of a game that uses this technique.

In other words, with rear speakers (or headphones - the effect works surprisingly well), you could have sound effects coming from behind you. Of course, this would have to be optional, because in the case of monaural playback, phase inversion would cause channel cancellation, making sounds from behind you quieter than they should be. Sounds from directly behind you would mix to silence in mono...

With the option of MSU1 music, or no music, perhaps you could use two channels for one sound effect and have a reflection (with slower attack?) at 180° from the original sound, with filtered echo on both. You'd have to be careful not to offset the two sounds by a multiple of the echo delay time, in order to avoid channel cancellation. Player sound effects could benefit further from a third channel (if available) for a single early reflection (not sent to echo) from the nearest wall.

I wonder if I'm getting too greedy with this audio stuff... It doesn't strike me as particularly computationally intensive, given that a lot of the information you'd need is calculated for other purposes anyway, but obviously I haven't tried any of it...
User avatar
Nikku4211
Posts: 569
Joined: Sun Dec 15, 2019 1:28 pm
Location: Florida
Contact:

Re: SNES Doom Source Released! Now What?

Post by Nikku4211 »

93143 wrote: Sat Sep 05, 2020 10:55 pm
Señor Ventura wrote: Sat Sep 05, 2020 4:42 amNow that we are talking about sound... Do has doom dolby surround sound for quadraphonic speakers?.
Not as far as I know. The music sounds like it's conventional stereo, the sound effects are in mono, and there are no options to change either of them.

It's certainly possible, which is why I suggested it upthread. The S-DSP doesn't incorporate a pan law; you have to manually adjust the L and R channel volumes to pan a sound. The channel volumes are signed, meaning you can phase-invert the signal on one side or the other, and that's all you need for Dolby Surround. Vortex is a good example of a game that uses this technique.

In other words, with rear speakers (or headphones - the effect works surprisingly well), you could have sound effects coming from behind you. Of course, this would have to be optional, because in the case of monaural playback, phase inversion would cause channel cancellation, making sounds from behind you quieter than they should be. Sounds from directly behind you would mix to silence in mono...

With the option of MSU1 music, or no music, perhaps you could use two channels for one sound effect and have a reflection (with slower attack?) at 180° from the original sound, with filtered echo on both. You'd have to be careful not to offset the two sounds by a multiple of the echo delay time, in order to avoid channel cancellation. Player sound effects could benefit further from a third channel (if available) for a single early reflection (not sent to echo) from the nearest wall.

I wonder if I'm getting too greedy with this audio stuff... It doesn't strike me as particularly computationally intensive, given that a lot of the information you'd need is calculated for other purposes anyway, but obviously I haven't tried any of it...
Okay, how many people actually have Dolby Surround speakers? I sure don't. There's not even enough space in my room for a basic Dolby 3.0 setup.

As for headphones, they're basically stereo only, as there's only 2 speakers, so if you wear those, you're only getting the stereo stream meant to be interpreted by the Dolby Pro Logic without the Dolby Pro Logic to turn it into actual Surround Sound.
I have an ASD, so empathy is not natural for me. If I hurt you, I apologise.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: SNES Doom Source Released! Now What?

Post by lidnariq »

The nifty(?) thing about ProLogic-encoded audio is that stuff that was encoded for the surround channel still is decoded by a human's brain as surround (well, not localizeable), even without an explicit decoding stage.
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: SNES Doom Source Released! Now What?

Post by 93143 »

Listen to the level 2-1 music from Super Turrican with headphones, and wait for the low flute to start panning all the way around, about 35 seconds in. Seems pretty convincing to me...
creaothceann
Posts: 611
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany
Contact:

Re: SNES Doom Source Released! Now What?

Post by creaothceann »

93143 wrote: Sun Sep 06, 2020 1:22 pm2-1
https://www.youtube.com/watch?v=D4VCZ89tqYw
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
User avatar
Nikku4211
Posts: 569
Joined: Sun Dec 15, 2019 1:28 pm
Location: Florida
Contact:

Re: SNES Doom Source Released! Now What?

Post by Nikku4211 »

lidnariq wrote: Sun Sep 06, 2020 12:05 pm The nifty(?) thing about ProLogic-encoded audio is that stuff that was encoded for the surround channel still is decoded by a human's brain as surround (well, not localizeable), even without an explicit decoding stage.
I don't know, when I hear one channel being inverted compared to the other in stereo, it doesn't sound like it's behind me, it sounds like it's in my head.
I have an ASD, so empathy is not natural for me. If I hurt you, I apologise.
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: SNES Doom Source Released! Now What?

Post by 93143 »

That one's smashed pretty hard. It might be easier to hear the effect in this one: https://www.youtube.com/watch?v=uNz3qC1W7Aw
User avatar
Nikku4211
Posts: 569
Joined: Sun Dec 15, 2019 1:28 pm
Location: Florida
Contact:

Re: SNES Doom Source Released! Now What?

Post by Nikku4211 »

93143 wrote: Sun Sep 06, 2020 3:33 pm
That one's smashed pretty hard. It might be easier to hear the effect in this one: https://www.youtube.com/watch?v=uNz3qC1W7Aw
Still the same. :/
I have an ASD, so empathy is not natural for me. If I hurt you, I apologise.
creaothceann
Posts: 611
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany
Contact:

Re: SNES Doom Source Released! Now What?

Post by creaothceann »

Nikku4211 wrote: Sun Sep 06, 2020 6:11 pm Still the same. :/
Here's a HD example. I listened to it with headphones and the sound at ~35s in seemed to move between the right side and the center, but not to the left.

Sounds coming from behind the player could perhaps be modified in some way to signal that fact to the player, even if the result is not physically accurate.
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: SNES Doom Source Released! Now What?

Post by 93143 »

To me it sounds pretty clearly like the low flute sound starts directly in front, then moves to the right and around behind my head (close, like it's sneaking up on me - that nervous feeling is one reason I thought of using this technique in Doom). Basically a 180° arc from front to back.

I understand what is meant by phase-inverted stereo sounding like it's in your head. It sometimes does to me too, and I picked this specific example because it doesn't.

It's cool. If you don't want surround for whatever reason, there'll be a stereo setting too. (If this ever gets made, which is obviously a long shot...)

(Also, I do have access to a setup that can handle Pro Logic II. It's only one data point, but there are a number of SNES games that support Dolby Surround, so I can't be the only one...)

...

As for modifying sounds coming from behind, head-related transfer functions are a thing, but that would probably require multiplying the number of versions of each sound effect in ROM quite a bit. I'm already considering having a few levels of muffling for indirect sound, and possibly versions of those with and without extra reverb; adding a differential HRTF at any serviceable angular resolution would take too much ROM, and for authenticity reasons I don't want to lean on the MSU1's data side. You can't really use the FIR filter for this, because (a) you'd lose the use of echo, and (b) there's only one filter, so it wouldn't work on multiple simultaneous sound effects.

Just using muffling is a possibility, but that's already in use to signal that the source is behind an obstacle. Having the player turn out to be the obstacle in question is a bit of a jerk move; basically this would result in no audible difference between a demon around the corner in front of you and a demon right behind you.

Besides, if the pan position is smoothly interpolated between frames depending on the changing position of the source relative to the player, you'd have to crossfade between HRTFs (or muffling levels). This instantly doubles the channel count requirements for all sound effects except those made by Doomguy himself. Just four simultaneous sound effects would crowd out the music completely even without stereo reverb.

Actually, since HRTFs are supposed to be stereo, it would ideally be four channels per sound effect, which only allows one streaming sound effect before the HDMA is overloaded. This might be cool as a demo (you could combine it with interaural time delay for maximum realism, and use separate samples for the stereo reverb to nearly max out the S-DSP with one sound effect), but for a game it's a bit much.

By contrast, Dolby Surround requires no additional resources beyond what simple stereo does.

What do you mean by "not physically accurate"? Do you have a specific approach in mind?
Last edited by 93143 on Mon Sep 07, 2020 5:48 pm, edited 1 time in total.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: SNES Doom Source Released! Now What?

Post by lidnariq »

If I listen to the track using Kurohane's SPC player, it shows the splash cymbal also having surround panning...
The splash cymbal at 12 seconds is 62/-127.
Each channel of the flute, sweeps through 127/127 to 0/127, swaps sign to become 0/-127 and sweeps to 127/-127, then swaps sign and fades down again. That sign reversal should be an audible click, but ... ?
Post Reply