View Issue Details

IDProjectCategoryView StatusLast Update
0005801Spring engineGeneralpublic2017-10-11 11:30
ReporterAntero Assigned ToKloot  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version104.0 +git 
Summary0005801: PitchAdjust not taking low game speed into account enough
DescriptionWith PitchAdjust enabled in springsettings, game speed affects sound length and pitch. This is useful when recording a cinematic clip on less than 1.0 speed, then speeding it back up in a video editor (for smoother fps etc). However, currently PitchAdjust isn't taking low game speed into account enough. When sped up, the sounds are too short and high pitched.

I recorded a sound on 0.6 game speed. To match the length of the same sound recorded on 1.0 speed, I had to speed it up to 0000118:0000125% instead of the expected 167%.

A sound recorded on 0.3 speed had to be sped to 0000064:0000180% instead of 333%, and a sound recorded on 0.1 speed had to be sped to 0000262:0000315% instead of 1000%.

A fix would be greatly appreciated. I'll gladly provide any other info. Thank you.
Steps To Reproduce1. Record an ingame sound on 1.0 speed.
2. Record the same sound on a lower speed with PitchAdjust enabled.
3. Speed up the lower speed recording and compare.
Tagspitch sound speed
Checked infolog.txt for Errors

Activities

Antero

2017-10-10 01:03

reporter   ~0018490

Looks like I managed to break the formatting. Let's try that again.

I recorded a sound on 0.6 game speed. To match the length of the same sound recorded on 1.0 speed, I had to speed it up to around 125% instead of the expected 167%.

A sound recorded on 0.3 speed had to be sped to around 180% instead of 333%, and a sound recorded on 0.1 speed had to be sped to around 315% instead of 1000%.

Kloot

2017-10-10 01:33

developer   ~0018491

Last edited: 2017-10-10 11:15

To explain your numbers: Spring sets the pitch-adjustment factor to the square root of the game speed.

Fixing this would be a one-liner but I don't remember the reason behind it.

Antero

2017-10-10 02:01

reporter   ~0018493

Ah, the square root modifier is added in NetCommands? It looks intentional, but the result is rather unsatisfactory. Whether it's left that way or changed, I'll need a custom compiled engine anyhow, so thanks for pointing the right way.

Kloot

2017-10-10 11:15

developer   ~0018494

Last edited: 2017-10-10 11:22

a workaround is to just call Spring.SetConfigFloat("PitchAdjust", gameSpeed) from a Lua snippet of choice after every speed change.

Antero

2017-10-10 21:28

reporter   ~0018499

Widgetifying this is a nice idea for a workaround without needing a custom engine, but I get the following:

[cawidgets.lua] Error: Error in Update(): [string "LuaUI\Widgets\dbg_cinematic.lua"]:40: attempt to call field 'SetConfigFloat' (a nil value)

Isn't PitchAdjust a boolean in springsettings anyhow, and not a float?

But I can continue with a custom engine, so this isn't urgent.

Kloot

2017-10-11 00:08

developer   ~0018500

you're right, the setting isn't actually a float. pitch adjustment needs some retooling before my suggestion would work.

by accident SetConfigFloat is not exposed to Lua in 104 (which has been fixed upstream), but you can disregard that.

Antero

2017-10-11 09:21

reporter   ~0018502

Your addition of the linear adjustment mode to the config is enough for me, so feel free to close.

Making the PitchAdjust modifier a configurable float would allow for additional shenanigans, but personally I see no use for that, so feel free to close this ticket.

Cheers!

Kloot

2017-10-11 11:30

developer   ~0018503

yw

Issue History

Date Modified Username Field Change
2017-10-10 01:00 Antero New Issue
2017-10-10 01:00 Antero Tag Attached: pitch sound speed
2017-10-10 01:03 Antero Note Added: 0018490
2017-10-10 01:33 Kloot Note Added: 0018491
2017-10-10 02:01 Antero Note Added: 0018493
2017-10-10 11:15 Kloot Note Added: 0018494
2017-10-10 11:15 Kloot Note Edited: 0018491
2017-10-10 11:22 Kloot Note Edited: 0018494
2017-10-10 21:28 Antero Note Added: 0018499
2017-10-11 00:08 Kloot Note Added: 0018500
2017-10-11 09:21 Antero Note Added: 0018502
2017-10-11 11:30 Kloot Assigned To => Kloot
2017-10-11 11:30 Kloot Status new => closed
2017-10-11 11:30 Kloot Resolution open => fixed
2017-10-11 11:30 Kloot Note Added: 0018503