Delay/offset for PlaySound OR a TEXTURES-like SNDINFO

Moderator: GZDoom Developers

Post Reply
User avatar
Caligari87
Admin
Posts: 6230
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Delay/offset for PlaySound OR a TEXTURES-like SNDINFO

Post by Caligari87 »

Very simply, it might be useful to have an option to offset the playing of a sound by some amount, such as a fractional tic (1.25 tics), fractional second (possibly less useful for the time ranges involved), or samples (high control but inconsistent by sound format, non-intuitive). This would be useful if a modder needs to play a sound "between" tics, or combine it with another sound with some degree of control, without using an external editor to create extra resources.

One specific use case would be making true-to-life miniguns (that can reach up to 6000rpm or more). It still would fire multiple rounds on the same tic, like a shotgun, but the classic "pistol" sound could be played at staggered intervals to make it sound as if it's firing at much faster than the tic rate, and a new sound effect would not need to be created, saving time and space.

Alternatively, the same idea could be applied to the SNDINFO lump, perhaps allowing the creation of "blended" sounds under one alias, similar to SNDSEQ (or even an expanded version of the same) with additional options to delay the parts by fractional amounts, have them play at varying volumes, or only play a range of the sound. For an unconventional example, a modder could create a combination noise of the pistol firing, plus the reload noise of the regular shotgun, by specifying only the last part of the latter sound be used, and they wouldn't have to open an audio editor, risking additonal signal compression.

8-)
D2JK
Posts: 545
Joined: Sat Aug 30, 2014 8:21 am

Re: Delay/offset for PlaySound OR a TEXTURES-like SNDINFO

Post by D2JK »

Excellent suggestions. If you don't mind, I'll add a few since you mentioned a TEXTURES-like SNDINFO:

1) Fixed pitch for a sound effect; if I've understood, currently one can only set a range of pitches in SNDINFO, from which a pitch is randomly chosen each time the sound is played.

2) Advanced looping for sounds that contain both the "start" and "looping" parts within the same sound file. Maybe the usage of the function would be like so (open to alternate ideas):
A_PlayLoopingSound (string soundname, int slot, float volume, float 2ndLoopStartPositionInSeconds, float attenuation).

Example 1:
Spoiler:
Example 2:
Spoiler:
3) Although this last suggestion is not of high priority as one could just create an extra sound... it also springed to my mind from the above, that the minigun fire sound could also include the 3rd, spindown part. In this case, you would play "Weapons/MinigunFire" in an otherwise normal manner, except that it would start from a given position within the sound file.

Finally, if you consider this thread hijacking, I can take these to a new thread, no worries. :-)
Gez
 
 
Posts: 17943
Joined: Fri Jul 06, 2007 3:22 pm

Re: Delay/offset for PlaySound OR a TEXTURES-like SNDINFO

Post by Gez »

TEXTURES works because ZDoom can read all image formats directly and converts them from whatever format they are to a type of bitmap so it can manipulate them at the pixel level. Doing the equivalent for sound would require ZDoom to likewise read all sound formats directly; but it's not the case. Most of them are fed straight to FMOD Ex. Also, sounds have varying sample rates.

These things seem to me they'd be quite complex to implement, as a lot of sound code would have to be overhauled.
User avatar
Caligari87
Admin
Posts: 6230
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: Delay/offset for PlaySound OR a TEXTURES-like SNDINFO

Post by Caligari87 »

Yeah, I realize that's probably the case, so I'm not holding my breath. Still, never hurts to ask.

8-)
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”