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

Saving a slice of frames in a single operation, and removed fsync #19

Closed
wants to merge 3 commits into from

Conversation

ivoras
Copy link

@ivoras ivoras commented Apr 28, 2019

See commit descriptions and issue #18 for details.

This has huge performance benefits over doing it a frame at a time.
... or do any system-level stuff with the files, because they do not
know the specifics, for example where, on which file system or network
device the files are being stored. Only the file creator knows that.
@codecov-io
Copy link

Codecov Report

Merging #19 into master will decrease coverage by 2.84%.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #19      +/-   ##
=======================================
- Coverage   58.84%   56%   -2.85%     
=======================================
  Files           6     6              
  Lines         622   650      +28     
=======================================
- Hits          366   364       -2     
- Misses        160   190      +30     
  Partials       96    96
Impacted Files Coverage Δ
encoder.go 29.11% <0%> (-7.81%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc32323...e5a4256. Read the comment docs.

@mattetti
Copy link
Member

Thanks a lot for the PR, I like the direction, I am a bit surprised that a frame is equal to a sample, that doesn't seem right in the case of a file with more than 1 channel (a frame is a sample * num channels).

I need to try to remember why I was syncing when setting up the metadata, it doesn't seem to make a lot of sense but I will try to dig through the history.

Finally, any chance you could add some tests to make sure the code behaves as expected, especially with the type of frames.

@ivoras
Copy link
Author

ivoras commented Apr 29, 2019

It was just a single sample in my case where I have a single channel. I handled the case with multiple channels partially - some checks are needed that the slice length is sane.

The original issue is just a side effect of Go's binary.Write() accepting both simple types (like integers) and slices of those, transparently.

I'll add the tests and submit another PR.

@@ -1,4 +1,4 @@
module github.com/go-audio/wav
module github.com/ivoras/wav
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should import go-audio/wav

@ivoras ivoras closed this Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants