Set pitch of a playing sound

Moderator: GZDoom Developers

Post Reply
D2JK
Posts: 543
Joined: Sat Aug 30, 2014 8:21 am

Set pitch of a playing sound

Post by D2JK »

Similar to A_SoundVolume, but this would modify the pitch instead, and perhaps have slightly extended functionality.

My use case would be a chaingun where the spin rate can change based on user inputs, but not instantaneously; the spin rate would settle on a new speed over a brief period. This new function would then be used to constantly match the pitch of the looping electric motor sound effect with the visual spin rate. Doing this manually with the existing functions would be very cumbersome and laborous, I think.

Another, more common use case would be a car engine sound, where you would be constantly evaluating the engine revolutions, matching the pitch of the looping sound accordingly.

Probably a "nice to have" addition to this function would be pitch change interpolation, because the more the pitch instantly changes, the more noticable and jarring the change sounds. So perhaps as a function parameter, you could set the time period in tics or seconds, over which the change in pitch should complete? Or perhaps you could set a hard limit X for the pitch change rate, so that the pitch could not change by more than X per tic (or second).
D2JK
Posts: 543
Joined: Sat Aug 30, 2014 8:21 am

Re: Set pitch of a playing sound

Post by D2JK »

The pitch controlling functionality has been recently added.

The latter part of the request (interpolated pitch changes) probably still stands, though I have to test this new addition to find out if it's actually a necessary feature. But I assume attempting to manually interpolate pitch changes by dividing the change over a range of tics, and progressively modifying the pitch each tic (which should be the finest control possible for the modder), will still produce discernible "steps" in the heard pitch. And manually doing this between the individual tics isn't possible at all.
User avatar
Major Cooke
Posts: 8176
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Set pitch of a playing sound

Post by Major Cooke »

Correct. You cannot adjust the pitch between tics. That's not going to be possible. Sorry.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49071
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Set pitch of a playing sound

Post by Graf Zahl »

This got added in the mean time.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”