Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beginning of Flac file is skipped #103

Closed
tzachshabtay opened this issue Jun 5, 2016 · 3 comments
Closed

Beginning of Flac file is skipped #103

tzachshabtay opened this issue Jun 5, 2016 · 3 comments
Labels

Comments

@tzachshabtay
Copy link

tzachshabtay commented Jun 5, 2016

Tried to read the following FLAC file (and feeding it to OpenAL via OpenTK):

1.FLAC.zip

It skips a few seconds of the beginning of the sample (the file itself is very small, so it only plays the last 3 seconds or so).
I tried a large FLAC file and it sounded fine.

The code I used to load the buffer:

var stream = File.OpenRead(path);
FlacFile file = new FlacFile (stream);
byte[] buffer = new byte[stream.Length];
file.Read(buffer, 0, buffer.Length);

I compiled CSCore source (downloaded today) with Mono 4.5 on a Mac (don't know if it's relevant).

@filoe filoe closed this as completed in de9f32f Jun 5, 2016
@filoe
Copy link
Owner

filoe commented Jun 5, 2016

I can't really find a bug inside of the FlacDecoder. If I compare it with the original libflac used by audacity it looks like this: http://fs5.directupload.net/images/160605/r32suxq9.png
It is of the exactly same length (387072 samples). What are you using to decode the file?

@filoe filoe reopened this Jun 5, 2016
@tzachshabtay
Copy link
Author

Hmm, not sure what you mean, isn't the FlacFile class enough to decode?
Anyway, here's a sample project to illustrate the problem.
I tested on Windows as well:
On Mac the beginning of the file is skipped.
On Windows (both 7 and 10) I'm getting an "invalid value" from OpenAL when loading the buffer.
I compared the created buffers from the FlacFile on mac and windows, the buffer is the same. So I'm not sure if the issue is from CSCore, OpenTK or something I'm doing wrong.

I also have a wav file for comparison, if you comment the load flac and uncomment the load wav it plays fine on both mac and windows.

Flac_Sample.zip

@filoe
Copy link
Owner

filoe commented Sep 24, 2016

I would guess the problem is somewhere within the OpenAL implementation. You can try it out with the experimental OpenAL implementation of CSCore (see corresponding branch).

@filoe filoe closed this as completed Sep 24, 2016
@filoe filoe added the question label Sep 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants