-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support for foreign metadata RIFF chunks #49
Comments
Hello! This is the first time I see this feature of the First, what you want is something you can accomplish using the available APIs (either through streams or using the metadata API level 1 or level 2). I know the metadata APIs are a bit complicated so that's why added the metadata array for the stream encoders ( The For that case, the idea is to read the Imagine that you have a library that reads all // read riff chunks
const pathToTheFile = '...'
const riffChunks = []
for await (const riffChunk of readRiffChunks(pathToTheFile)) {
const riffApplicationMetadata = new flac.metadata.ApplicationMetadata()
riffApplicationMetadata.id = 'riff'
riffApplicationMetadata.data = riffChunk.raw
riffChunks.push(riffApplicationMetadata)
}
// create encoder with the metadata block
const flacEncoder = new flac.FileEncoder({
file: output || 'out.flac',
compressionLevel: 9,
metadata: riffChunks,
}) Note that I could not test that properly, don't have anything to try this fine. This "code" gives you something like this: If you would like to inspect further, I made a quick CodeSandbox https://codesandbox.io/p/sandbox/lively-bash-gw9jnh?file=%2Findex.js%3A76%2C38 I could not find any npm package that I liked to use for this sample (I have to say I just spend 10 minutes looking) so I made the code to read the chunks manually. Is not that complicated I have to say hehe. I hope this helps you find the solution to your issue. On the other hand, I don't quite like the idea to have this kind of code around, which is not from flac API directly. I see the utility of it but I don't many people using it for their daily use. If you would like to keep this for your project, for me it's fine. Anyway, I also don't mind to have it anyways if the code does not use any external dependency. Like an utils package inside the library 🤔 I would accept the PR. The only issue is I don't have time to maintain two versions for the library (2.x and 3.x), so it will only go to 3.x, sorry for that tho. Thanks for raising the issue :) |
Hello again! At least something is being read with that tool! That's something hehe Good luck with the investigations. I am looking forward to your results. If you need some help, I may be able to assist you. Also, take a look at flac's source code, something I did not think of yesterday to check: https://github.com/xiph/flac/blob/master/src/flac/foreign_metadata.c#L210 Maybe you see something useful in it. |
Wave files can contain unofficial metadata, such as Sampler Chunk - "smpl":
https://sites.google.com/site/musicgapi/technical-documents/wav-file-format#smpl
These are used for audio looping players and samplers avoiding to loading multiple samples.
I have one such file here:
https://github.com/studiorack/basic-harmonica/blob/bf42d5bab7470cc201e3c4b6dee7925b19db6bff/samples/harmonica_1.wav
and a flac file converted using the official flac command line tool:
flac harmonica_1.wav --keep-foreign-metadata
When inspecting with exiftool it shows the RIFF metadata was copied:
I have tried all the metadata types in your bindings, but none appear to support the RIFF chunks:
How can I get this to work? Happy to submit a PR
Using flac-bindings v2.7.2 as I want my library to have backwards compatibility for CommonJS.
The text was updated successfully, but these errors were encountered: