beets icon indicating copy to clipboard operation
beets copied to clipboard

WAV Support

Open haakobja opened this issue 7 years ago • 19 comments

Please allow WAV-files to be imported

haakobja avatar Dec 02 '16 21:12 haakobja

Hi! As with #1160, do you have any references for how metadata tags might be saved in .wav files? Is there a standard way, or even a de facto common practice?

You might also be interested in reading #250, the thread about AIFF support (which we now have).

sampsyo avatar Dec 03 '16 15:12 sampsyo

It seems that the WAV-format may contain metadata-blocks of different types: http://wavmetadata.blogspot.com https://en.wikipedia.org/wiki/Resource_Interchange_File_Format

I do not know of if there is a de facto common practice. But it would be nice to be able to import wav-files. Currently I haven't been able to do so. It may of course be that I haven't found the correct way to import wav files into my beets library.

haakobja avatar Dec 06 '16 21:12 haakobja

You're right; it's currently not possible.

The problem, as you've no doubt surmised, is that we don't know exactly how to write tags to WAV files. Mutagen doesn't support it, so this is unlikely to happen immediately.

I know this isn't much of a solution, but have you considered switching to a more widely used lossless format, such as FLAC or ALAC?

sampsyo avatar Dec 06 '16 22:12 sampsyo

Yes, I could convert the wav to flac. In that case, it would be nice to use the convert plugin during import. I do not think it is run during import now, or have i configured it wrong?

haakobja avatar Dec 07 '16 16:12 haakobja

Hmm, interesting—no, convert-on-import won't quite work here, because beets needs to be able to read the metadata even for files that it's just converting. So, at least for the moment, you'd need to use some other tool to do the conversion. Interesting idea, though!

sampsyo avatar Dec 07 '16 19:12 sampsyo

What if instead of trying to insert metadata tags into wav files, which sort of isn't recommended since it messes with the container structure, one still had the ability to rename wav files based on user configuration?

brandonwkipp avatar Jan 19 '17 18:01 brandonwkipp

Yes, that's another option—supporting some file types that can't store metadata at all. It's worth considering, but we haven't done that for any other formats yet, so it would require a few architectural (and documentation) changes.

sampsyo avatar Jan 19 '17 18:01 sampsyo

This may create even more problems, but what about converting the WAV to FLAC, leaving the WAVs where they are (or wherever the user wants them), and importing the FLAC files to the normal sorted library location for beets?

RollingStar avatar Jan 22 '17 17:01 RollingStar

Right—in fact, that could be accomplished already with the convert plugin if beets was allowed to scan WAV files.

sampsyo avatar Jan 22 '17 17:01 sampsyo

I would be quite happy with an "import wav, convert to FLAC, write metadata" approach. Would this be a lower friction route than full support for non-metadata storing formats?

khimaros avatar Oct 05 '17 00:10 khimaros

It probably would; yes! But either would be a worthy project.

sampsyo avatar Oct 05 '17 06:10 sampsyo

@sampsyo -- if someone were interested in working on this functionality, do you have design guidance or pointers for where to start looking?

khimaros avatar Oct 05 '17 17:10 khimaros

@khimaros Good question! I can think of two good places to start:

  • Take a look at the existing filefilter plugin. That intercepts "import tasks" (as they're called) from the importer pipeline and drops them if they don't match a pattern. A hypothetical new plugin could work much the same way—it gets new ImportTask objects, checks whether they contain WAV files, and transcodes them to FLAC, and then continues. We'd also need to add some new API to tell the importer that it's OK to load WAV files without reading their metadata.
  • Look at the code in importer.py for handing compressed archives (e.g., zip files). The unarchive method in ImportTaskFactory is the central piece there. We could build in a similar check for files that need transcoding.

And then there's also the alternative of just supporting files without embedded metadata. The places to look for that are read_item in importer.py and the from_path method on Item in library.py. The current logic tries opening the file with MediaFile and, if that fails, says that the Item object could not be created. We could instead use a list of known metadata-free audio format extensions to allow some files that can't be read.

sampsyo avatar Oct 06 '17 21:10 sampsyo

Perhaps this could ne helpful : http://bwfmetaedit.sourceforge.net/ This is how metadata are stored in wave BWF format ( Brodcast Wave )

koflesinge avatar Sep 17 '18 12:09 koflesinge

Tagging is still possible with audio fingerprinting via the chroma plugin.

Evidlo avatar Nov 10 '18 08:11 Evidlo

As someone looking to use Beets for managing a sound FX library, I don't often have control over filetypes; I'd love to be able to import WAVs, even if I have to manually tag them.

morgajel avatar Apr 23 '19 15:04 morgajel

Just wanted to point out that there has been some activity on WAV support in Mutagen lately in https://github.com/quodlibet/mutagen/pull/408. If you're interested in making this work, perhaps you can help out there. :smiley:

sampsyo avatar Jan 16 '20 22:01 sampsyo

Now that https://github.com/quodlibet/mutagen/pull/408 has been merged, does that make supporting WAV less complicated?

techdragon avatar Jan 13 '21 07:01 techdragon

Cool! It sure does. Happy to take a PR to depend on the new version of Mutagen and enable ID3 for WAV files.

sampsyo avatar Jan 13 '21 13:01 sampsyo

@sampsyo Can probably close this issue since https://github.com/beetbox/mediafile/pull/50 should have resolved it.

Bobo1239 avatar Feb 29 '24 12:02 Bobo1239