It is currently Fri Jan 15, 2021 5:52 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: [Done] flac skips over samples at the start of a sound
PostPosted: Sun Oct 11, 2020 10:11 am 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 28, 2019 1:01 pm
Posts: 112
Hi,

Surprised no one has reported this (or at least I can't find anything related), but there's a long-standing bug with playing flack sounds that makes the flac playing support virtually useless.
Depending on the compression used, pb plays flac sounds with a chunk of audio missing from the start of audio.
My tests with a 44100, 16 bit, stereo flac sound with different compression rates yielded:
With compression of 3-8, my sound loses about 70 ms from the start, and with compression of 0-2, about 20 ms.
The cutting of the start of audio happens both on Windows and MacOS, with the exception of certain compression rates causing MacOS to throw an invalid memory error.
The sounds play fine in other things, and SoundLength() does report the correct length.

Here's a zip file with the source code, and 9 flac sounds, each saved with the compression rate specified in the filename (0-8).

http://nsstudiosweb.com/test.zip


Top
 Profile  
Reply with quote  
 Post subject: Re: flac playback skips over samples at the start of a sound
PostPosted: Sun Oct 11, 2020 12:02 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3822
Hi nsstudios
Every thing looks OK to me
Just I moved UseFLACSoundDecoder() to start

Code:
UseFLACSoundDecoder()
#comp=8
; 3 and above cut the beginning of sound about 60 ms, 2 and below cut it lower (about 20 ms)
InitSound()
LoadSound(0, "test"+#comp+".flac")
Debug GetSoundFrequency(0)
Debug SoundLength(0, #PB_Sound_Millisecond)
PlaySound(0)
Repeat
Delay(1)
Until SoundStatus(0)<>#PB_Sound_Playing

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: flac playback skips over samples at the start of a sound
PostPosted: Sun Oct 11, 2020 1:59 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 28, 2019 1:01 pm
Posts: 112
Thanks, but that did not help.
Here's the demo of how it's supposed to sound vs how it sounds.
I first play the file once in my media player, and then play different variants from 8 to 0 from pb.

http://nsstudiosweb.com/test_demo.mp3

I do not get this behavior with any other media player, or other audio libraries like Bass.


Top
 Profile  
Reply with quote  
 Post subject: Re: flac playback skips over samples at the start of a sound
PostPosted: Sun Oct 11, 2020 2:44 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3822
You are absolutely right
It is clear to me now

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: flac playback skips over samples at the start of a sound
PostPosted: Thu Oct 22, 2020 2:55 pm 
Offline
User
User

Joined: Thu May 14, 2020 10:31 pm
Posts: 31
Hi.
Yes, I have this problem as well, and it would be great to see it fixed!


Top
 Profile  
Reply with quote  
 Post subject: Re: flac playback skips over samples at the start of a sound
PostPosted: Fri Oct 30, 2020 5:23 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 14181
Location: France
Fixed.


Top
 Profile  
Reply with quote  
 Post subject: Re: flac playback skips over samples at the start of a sound
PostPosted: Fri Oct 30, 2020 9:40 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 28, 2019 1:01 pm
Posts: 112
Thank you very much @Fred!
Fred wrote:
Fixed.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] flac skips over samples at the start of a sound
PostPosted: Fri Oct 30, 2020 10:26 pm 
Offline
User
User

Joined: Thu May 14, 2020 10:31 pm
Posts: 31
Thanks Fred! It'll be nice to be able to use flac sounds again!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye