Page 1 of 1

soundData:getSample() keeps returning 0

Posted: Sat Oct 31, 2020 7:46 pm
by fegnouche
i dont know why but when i try to do

Code: Select all

soundData:getSample(audio:tell(),1)
it keeps returning 0 (even though there is actually sound playing)

Re: soundData:getSample() keeps returning 0

Posted: Sat Oct 31, 2020 11:30 pm
by pgimeno
Hi welcome to the forums. With that information there's very little anyone can do to help. I can only suggest you to double check that the audio corresponds to the soundData.

Edit: Maybe also check that it's a stereo track and that the second channel has data.

Re: soundData:getSample() keeps returning 0

Posted: Sun Nov 01, 2020 3:16 am
by slime
The unit returned by Source:tell is seconds by default, whereas SoundData:getSample takes a sample index. You can use Source:tell("samples") to get the current playback position of the Source in the same unit that SoundData:getSample needs.