jstrait / wavefile

A Ruby gem for reading and writing sound files in Wave format (*.wav)
https://wavefilegem.com
MIT License
208 stars 24 forks source link

Added smpl chunk reader #28

Closed henrikj242 closed 5 years ago

henrikj242 commented 6 years ago

Let me know what you think. I can look into adding tests as well.

jstrait commented 6 years ago

@henrikj242 thanks for opening this PR! This seems like a good feature to add.

Out of curiosity, is there a specific use case you have for using files with a smpl chunk? Also, do you know of a good place to find files that have a smpl chunk? I found some in audio files included with GarageBand/Logic, but interested to know of other sources.

I’ll add some comments in the code for things that I think would be good to change before merging.

Like you mentioned, it would also be helpful if you added tests. The Generating Test Fixtures section in the README explains how to create new *.wav fixture files. (You’d also need to edit tools/fixture_writer.rb as well to support writing smpl chunks). I'm happy to answer any questions about the tests.

jstrait commented 5 years ago

@henrikj242 I will merge this pull request into the v1.1.0 branch, and make the changes I mentioned in the review comments. When complete, this will be released as part of v1.1.0. Thanks for submitting this!

henrikj242 commented 5 years ago

Thanks @jstrait for accepting the pr, and sorry for late response! You asked about the usecase: A friend of mine bought a sampler that read wave files, but not the loop information embedded in it. Instead it reads loop information from an attached yaml file... So I needed to extract the loop information and generate the appropriate yaml file to go along with it.

I wanted to see if it was possible to do this in Ruby (just because...), and this wavefile project was the closest thing I could come by :)

jstrait commented 5 years ago

No problem! Sounds like a cool project, glad the gem was helpful

jstrait commented 5 years ago

@henrikj242 v1.1.0 has now been released with this feature. Thanks again!

henrikj242 commented 5 years ago

My first open source contribution, yay :-) Happy to help! @jstrait