8000 reduce filesize, make files silent, add script to create them by boredsquirrel · Pull Request #20 · anars/blank-audio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

reduce filesize, make files silent, add script to create them #20

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed 1-hour-and-20-minutes-of-silence.mp3
Binary file not shown.
Binary file removed 1-hour-of-silence.mp3
Binary file not shown.
Binary file removed 1-minute-of-silence.mp3
Binary file not shown.
Binary file removed 1-second-and-500-milliseconds-of-silence.mp3
Binary file not shown.
Binary file removed 1-second-of-silence.mp3
Binary file not shown.
Binary file removed 10-minutes-of-silence.mp3
Binary file not shown.
Binary 8000 file removed 10-seconds-of-silence.mp3
Binary file not shown.
Binary file added 10sec-silence.m4a
Binary file not shown.
Binary file removed 15-minutes-of-silence.mp3
Binary file not shown.
Binary file removed 15-seconds-of-silence.mp3
Binary file not shown.
Binary file added 15min-silence.m4a
Binary file not shown.
Binary file added 15sec-silence.m4a
Binary file not shown.
Binary file added 1h-silence.m4a
Binary file not shown.
Binary file added 1min-silence.m4a
Binary file not shown.
Binary file added 1sec-silence.m4a
Binary file not shown.
Binary file removed 2-minutes-and-30-seconds-of-silence.mp3
Binary file not shown.
Binary file removed 2-seconds-and-500-milliseconds-of-silence.mp3
Binary file not shown.
Binary file removed 2-seconds-of-silence.mp3
Binary file not shown.
Binary file removed 250-milliseconds-of-silence.mp3
Binary file not shown.
Binary file added 2h-silence.m4a
Binary file not shown.
Binary file added 2sec-silence.m4a
Binary file not shown.
Binary file removed 30-minutes-of-silence.mp3
Binary file not shown.
Binary file removed 30-seconds-of-silence.mp3
Binary file not shown.
Binary file added 30min-silence.m4a
Binary file not shown.
Binary file added 30sec-silence.m4a
Binary file not shown.
Binary file removed 45-minutes-of-silence.mp3
Binary file not shown.
Binary file removed 45-seconds-of-silence.mp3
Binary file not shown.
Binary file added 4h-silence.m4a
Binary file not shown.
Binary file removed 5-minutes-of-silence.mp3
Binary file not shown.
Binary file removed 5-seconds-of-silence.mp3
Binary file not shown.
Binary file removed 500-milliseconds-of-silence.mp3
Binary file not shown.
Binary file added 5sec-silence.m4a
Binary file not shown.
Binary file removed 750-milliseconds-of-silence.mp3
Binary file not shown.
Binary file added 8h-silence.m4a
Binary file not shown.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 boredsquirrel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
53 changes: 53 additions & 0 deletions empty-audio
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash
set -euo pipefail

read -rp "Enter amount of seconds: " seconds &&

#### Construct the filename ###

# filename
secrest=0
minutes=0
hours=0
result=""

# Calculate minutes and remaining seconds
if (( seconds >= 60 )); then
minutes=$(( seconds / 60 ))
secrest=$(( seconds % 60 ))
else
secrest=$seconds
fi

# Calculate hours and remaining minutes
if (( minutes >= 60 )); then
hours=$(( minutes / 60 ))
minutes=$(( minutes % 60 ))
fi

# Build the filename
result=""
(( hours > 0 )) && result+="${hours}h"
(( minutes > 0 )) && result+="${minutes}min"
(( secrest > 0 )) && result+="${secrest}sec"

### Create the file ###

# parameters for AAC:
# - 4000Hz as samplerate, lowest possible
# - mono channel, doesnt matter if the audioplayer duplicates this as this is silence
# - 1kHz bitrate, lowest possible

# AAC
ffmpeg -f lavfi -i anullsrc=r=2000:cl=mono -t "$seconds" -c:a aac -b:a 1k "$result"-silence.m4a


# ALTERNATIVES
# opus (4x the size)
# higher minimum bitrate
# ffmpeg -f lavfi -i anullsrc=r=8000:cl=mono -t $seconds -c:a libopus -application voip "$result"-silence.ogg

# other codecs tested, all bigger:
# wav
# mp3
# raw
0