1
- LIBSH_VERSION=20250302_eb4d524
1
+ LIBSH_VERSION=20250308_a621f6b
2
2
export LIBSH_VERSION
3
3
cat << EOF
4
4
lib.sh v$LIBSH_VERSION
@@ -291,6 +291,7 @@ alias kcont='k -SIGCONT'
291
291
pk () { pg " $1 " | x kill -9; }
292
292
293
293
alias t=btop
294
+ alias b=btop
294
295
295
296
_salias bw bandwhich --show-dns
296
297
@@ -1244,7 +1245,7 @@ alias nxhash='nx hash'
1244
1245
alias nxh=' nxhash'
1245
1246
1246
1247
nxhrand () {
1247
- _require nix
1248
+ _require nix || return 1
1248
1249
# branching to support Lix
1249
1250
if [[ " $( nix --version) " =~ Lix ]]; then
1250
1251
nxh to-sri --type sha256 $( rand 32) | tn
@@ -2191,7 +2192,6 @@ wttr() {
2191
2192
}
2192
2193
2193
2194
# FLAC to ALAC
2194
- #
2195
2195
function flac2alac() {
2196
2196
local _noart=0
2197
2197
case $1 in
@@ -2200,35 +2200,33 @@ function flac2alac() {
2200
2200
;;
2201
2201
-h | --help)
2202
2202
cat << 'EOF '
2203
+ flac2alac [ <artwork file name>|--no-art|--no-cover ]
2204
+
2205
+ Recursively converts FLAC to ALAC, starting from the current directory.
2203
2206
2204
- flac2alac [ artwork ]
2205
- recursively converts FLAC to ALAC, starting from the current directory (.)
2207
+ artwork file name: jpeg or png filename containing the artwork to be embedded in the
2208
+ resulting m4a; searched in every subdir
2206
2209
2207
- artwork:
2208
- jpeg or png filename containing the artwork to be embedded in the
2209
- resulting m4a; searched in every subdir
2210
+ default names being searched:
2211
+ - cover.jpg
2212
+ - cover.jpeg
2213
+ - cover.png
2210
2214
2211
- default names being searched:
2212
- cover.jpg
2213
- cover.jpeg
2214
- cover.png
2215
+ --no-art|--no-cover don't embed any art
2215
2216
2216
2217
EOF
2217
- return 1
2218
2218
;;
2219
2219
esac
2220
+
2220
2221
_require ffmpeg || return 1
2221
2222
2222
2223
for f in ./** /* .flac; do
2223
2224
echo converting " $f " to " ${f% .* } .m4a" ...
2224
2225
ffmpeg -i " $f " -c:a alac -strict experimental -c:v copy " ${f% .* } " .m4a
2225
2226
done
2226
2227
2227
- _require atomicparsley && {
2228
- if [ $_noart = 1 ]; then
2229
- echo " not embedding artwork ($_noart )"
2230
- return
2231
- fi
2228
+ if [ $_noart != 1 ]; then
2229
+ _require atomicparsley || return 1
2232
2230
2233
2231
local _cnames=(" $1 " cover.jpg cover.jpeg cover.png)
2234
2232
@@ -2250,7 +2248,7 @@ EOF
2250
2248
echo not embedding artwork: " $_cover " does not exist
2251
2249
fi
2252
2250
done
2253
- }
2251
+ fi
2254
2252
}
2255
2253
2256
2254
alias f2a=flac2alac
@@ -2320,11 +2318,11 @@ any2any <src files extensions> <dst codec> [ dst files extension ]
2320
2318
recursively converts source to destination.
2321
2319
if destination is not specified, flac is used.
2322
2320
2323
- e.g. :
2321
+ Usage examples :
2324
2322
2325
- any2any ape alac m4a
2326
- any2any m4a flac
2327
- any2any flac alac m4a
2323
+ any2any ape alac m4a
2324
+ any2any m4a flac
2325
+ any2any flac alac m4a
2328
2326
2329
2327
EOF
2330
2328
return 1
@@ -2353,6 +2351,27 @@ EOF
2353
2351
2354
2352
}
2355
2353
2354
+ f22448 () {
2355
+ if [[ $1 =~ -h | --help ]]; then
2356
+ cat << 'EOF '
2357
+ Down-samples Hi-Res audio to 24bit / 48kHz.
2358
+ Supplying audio with lower bit or sample rate is not supported.
2359
+
2360
+ Usage:
2361
+ f22448
2362
+
2363
+ EOF
2364
+ return 1
2365
+ fi
2366
+
2367
+ _require ffmpeg || return 1
2368
+
2369
+ for f in ./** /* .flac; do
2370
+ local dst=" ${f% .* } " .24-48.flac
2371
+ ffmpeg -i " $f " -c:a flac -sample_fmt s32 -ar 48000 -af " aresample=resampler=soxr" " $dst "
2372
+ done
2373
+ }
2374
+
2356
2375
alias a2a=any2any
2357
2376
2358
2377
_wavpack () {
0 commit comments