Orl13
Orl13

Reputation: 513

Python: create dummy audio file with metadata

for testing purposes, I would like to create audio files (.mp, .wav, .flac, .aiff) with metadata. The audio files do not have to be "legit", as I need to test the information of the file, not the file content itself. How could I do that?

Upvotes: 1

Views: 579

Answers (1)

Hans-Martin Mosner
Hans-Martin Mosner

Reputation: 846

Use an appropriate file manipulation library for the formats that you want to handle, and write empty files (no audio samples). One example of such a library is Soundfile (https://pypi.org/project/SoundFile/)

If the library supports writing metadata, you could just use that, but it looks like Soundfile does not do this itself. So you could use a second library which can read and write metadata for the chosen file format, for example mutagen (https://mutagen.readthedocs.io/en/latest/)

Upvotes: 1

Related Questions