diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /dom/media/webaudio/test/generate-test-files.py | |
parent | Initial commit. (diff) | |
download | firefox-esr-37a0381f8351b370577b65028ba1f6563ae23fdf.tar.xz firefox-esr-37a0381f8351b370577b65028ba1f6563ae23fdf.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webaudio/test/generate-test-files.py')
-rwxr-xr-x | dom/media/webaudio/test/generate-test-files.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/dom/media/webaudio/test/generate-test-files.py b/dom/media/webaudio/test/generate-test-files.py new file mode 100755 index 0000000000..af4bc3bb49 --- /dev/null +++ b/dom/media/webaudio/test/generate-test-files.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +import os + +rates = [44100, 48000] +channels = [1, 2] +duration = "0.5" +frequency = "1000" +volume = "-3dB" +name = "half-a-second" +formats = { + "aac-in-adts": [{"codec": "aac", "extension": "aac"}], + "mp3": [{"codec": "libmp3lame", "extension": "mp3"}], + "mp4": [ + { + "codec": "libopus", + "extension": "mp4", + }, + {"codec": "aac", "extension": "mp4"}, + ], + "ogg": [ + {"codec": "libvorbis", "extension": "ogg"}, + {"codec": "libopus", "extension": "opus"}, + ], + "flac": [ + {"codec": "flac", "extension": "flac"}, + ], + "webm": [ + {"codec": "libopus", "extension": "webm"}, + {"codec": "libvorbis", "extension": "webm"}, + ], +} + +for rate in rates: + for channel_count in channels: + wav_filename = "{}-{}ch-{}.wav".format(name, channel_count, rate) + wav_command = "sox -V -r {} -n -b 16 -c {} {} synth {} sin {} vol {}".format( + rate, channel_count, wav_filename, duration, frequency, volume + ) + print(wav_command) + os.system(wav_command) + for container, codecs in formats.items(): + for codec in codecs: + encoded_filename = "{}-{}ch-{}-{}.{}".format( + name, channel_count, rate, codec["codec"], codec["extension"] + ) + print(encoded_filename) + encoded_command = "ffmpeg -y -i {} -acodec {} {}".format( + wav_filename, codec["codec"], encoded_filename + ) + print(encoded_command) + os.system(encoded_command) |