So I'm making a simple .flac to .mp3 converter, but it can't handle the metadata for the files, as sometimes they have incompatible tags. (For example, Xiph is only found in .flac)

The code so far:

(*Getting a list of files*)
Dir = SetDirectory["C:\\Desktop\\Recordings"];
OldFiles = FileNames["*.flac", "", Infinity];
NewFiles = StringReplacePart[FileNameSplit[#][[-1]], "mp3", {-StringLength[FileExtension[#]], -1}] & /@ OldFiles;
TableForm[Join[{{"Old Files", "New Files"}}, {OldFiles, NewFiles}\[Transpose]]]

(*Converting them*)
MapThread[Export[#2, Import[#1, "AudioFile"],"CompressionLevel" -> 0] &, {OldFiles, NewFiles}]

Basically what I'm looking for is something that does:

Association[ID3v1 -> Options[Import[#, "AudioFile"], MetaInformation][[1, 2,1]]] & /@ OldFiles

And then export using the new tag. However, I can't seem to find a way to export with the new MetaInformation, and always get an error that the tag is invalid.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.