You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed the decoded frame count can differ depending on how you go about it.
This pertains to the following methods:
ma_sound_init_from_file
ma_sound_get_length_in_pcm_frames
ma_decode_memory
Here are some specific test cases. They are in the format:
Test file: filename ( original format | original channels | original sample rate | original frame count | estimated decoded frame count [48000 / original sample rate * original frame count])
Count 1: frame count from ma_decode_memory using sample rate 48000 , format F32, original channels
Count 2: ma_sound_get_length_in_pcm_frames on sound created with ma_sound_init_from_file (no flags)
Count 3: ma_sound_get_length_in_pcm_frames on sound created with ma_sound_init_from_file (MA_SOUND_FLAG_DECODE)
For completeness, the count returned from ma_decode_memory is equivalent to ma_sound_get_length_in_pcm_frames on sound created with ma_sound_init_from_file (no flags) using a path/name registered via ma_resource_manager_register_encoded_data using the data from ma_decode_memory.
These inconsistencies aren't a super major concern given that most of the time it's only off by 1 frame, but I thought it might be good to bring up and document.
Thanks for reporting this and the test cases. I would like this to be consistent between everything so I'll look at this when I get the chance. Obviously a resampling related error. Sounds like maybe that very last frame isn't being output properly for some reason. The "THE LAST NIGHT.ogg" test is an interesting one though and should definitely be investigated.
Will post a message here when I investigate this, but I've been a bit busy lately so no timeframe.
I noticed the decoded frame count can differ depending on how you go about it.
This pertains to the following methods:
ma_sound_init_from_file
ma_sound_get_length_in_pcm_frames
ma_decode_memory
Here are some specific test cases. They are in the format:
Test file: filename (
original format |
original channels |
original sample rate |
original frame count |
estimated decoded frame count [48000 / original sample rate * original frame count])
Count 1: frame count from
ma_decode_memory
using sample rate 48000 , format F32, original channelsCount 2:
ma_sound_get_length_in_pcm_frames
on sound created withma_sound_init_from_file
(no flags)Count 3:
ma_sound_get_length_in_pcm_frames
on sound created withma_sound_init_from_file
(MA_SOUND_FLAG_DECODE
)Failed cases
File: short_IMP.mp3 (F32 | 2 ch | 44100 Hz | 3255552 | 3543457.96)
Count 1: 3543458
Count 2: 3543457
Count 3: 3543457
File: A Journey Awaits.flac (F32 | 2 ch | 44100 Hz | 4559262 | 4962462.04)
Count 1: 4962463
Count 2: 4962462
Count 3: 4962462
File: Pistol Shot_08.wav (S16 | 2 ch | 44100 Hz | 53429 | 58154.01)
Count 1: 58155
Count 2: 58154
Count 3: 58154
File: House In a Forest Loop.ogg (F32 | 2 ch | 44100 Hz | 1110210 | 1208391.84)
Count 1: 1208392
Count 2: 1208391
Count 3: 1208392
File: shortcuts.ogg (F32 | 2 ch | 44100 Hz | 12765112 | 13893999.46)
Count 1: 13894000
Count 2: 13893999
Count 3: 13894000
File: THE LAST NIGHT.ogg (F32 | 2 ch | 48000 Hz | 8307915 | 8307915.00)
Count 1: 8307915
Count 2: 8308275
Count 3: 8307915
Passed cases
File: Pistol Shot_06.wav (S16 | 2 ch | 44100 Hz | 66150 | 72000.00)
Count 1: 72000
Count 2: 72000
Count 3: 72000
File: Examples_Audio_Audio_Blip_Select.ogg (F32 | 1 ch | 48000 Hz | 5952 | 5952.00)
Count 1: 5952
Count 2: 5952
Count 3: 5952
Observations
There are three specific categories I can group the failed cases into:
ma_decode_memory
48000 / original sample rate * original frame count
is not a whole numberma_decode_memory
andma_sound_get_length_in_pcm_frames
on sound created withma_sound_init_from_file
(MA_SOUND_FLAG_DECODE
)48000 / original sample rate * original frame count
is not a whole numberma_sound_get_length_in_pcm_frames
on sound created withma_sound_init_from_file
(no flags)48000 / original sample rate * original frame count
is a whole numberTHE LAST NIGHT.ogg
For completeness, the count returned from
ma_decode_memory
is equivalent toma_sound_get_length_in_pcm_frames
on sound created withma_sound_init_from_file
(no flags) using a path/name registered viama_resource_manager_register_encoded_data
using the data fromma_decode_memory
.These inconsistencies aren't a super major concern given that most of the time it's only off by 1 frame, but I thought it might be good to bring up and document.
Here are the test files:
Frame Count Test Cases.zip
The text was updated successfully, but these errors were encountered: