How do I find the SoundDuration of a sound, but with a different pitch? All I would have to do is find the algorithm used, but I don’t know how to find it. All I know for sure is, 50 is DEFINITELY not half of the default speed (100).
By what i know pitch don’t change the duration just change the sound frequency
No, I changed pitch and the sounds are noticably longer/shorter, especially if the sound length is below 90 or above 110.
maybe some frequencys can’t be hear by our ears but i think sound duration is the same
Actually i’m doing tests and the sounds pithch/duration it’s 1:1
for k=0,1 do
timer.Simple(3+k/2,function() LocalPlayer():EmitSound("weapons/usp/9mm_unsil-1.wav",100,200) MsgN("Play faster") end)
I’m using SoundDuration to find the amount of time until another sound will play, I modified pitch and it’s totally off now, so…
Also it might be because you’re using weapon sounds and I’m using sounds from /npc/combine_soldier/vo/.
I’ll upload a video to show it later.
EDIT: Also it appears you’re doing it clientside, I’m doing it serverside.
EDIT2: Try this code on the server, not client:
[lua]ply:EmitSound("/npc/combine_soldier/vo/stabilizationteamhassector.wav", 75, 70);
ply:EmitSound("/npc/combine_soldier/vo/ripcordripcord.wav", 75, 110);
Does it sync up for you?
EDIT3: Using that exact code in a concommand:
Pitch adjusts the audio, not the duration. SoundDuration returns the length of time it takes to play the sound at normal playback speed… If you are adjusting the playback speed, you’ll need to apply the same math to the time to get the adjusted time.
Exactly my problem. I don’t know the math used for source audio pitching.
wouldnt a sound that plays at 200% normal pitch take half the time to play? so just do SoundDuration/(pitch/100) so if pitch was 200 it would be devided by 2
It doesn’t work that way. 200% is barely audible it’s so fast, as far as I know it’s not even a percentage, especially since the maximum is 255 and not 200.