Skip to content

Instantly share code, notes, and snippets.

@donnaken15
Created August 29, 2025 11:47
Show Gist options
  • Select an option

  • Save donnaken15/b8f1d099dc1e8c2770ca3d093e3ef489 to your computer and use it in GitHub Desktop.

Select an option

Save donnaken15/b8f1d099dc1e8c2770ca3d093e3ef489 to your computer and use it in GitHub Desktop.
wrapper thing for aubio, made for zsh on windows
#!/bin/zsh
# windows is cool and linux is cringe
[ $# -lt 1 ] && {
expand -t 4 <<use
No arguments supplied. Usage:
${0:t} [utility name (without aubio prefixed)] [input] [utility parameters (no --input)]
or
${0:t} [utility name (without aubio prefixed)] --help
to get the usage information of one of the following utilities:
- onset: outputs the time stamp of detected note onsets
- pitch: attempts to identify a fundamental frequency,
or pitch, for each frame of the input sound
- mfcc: computes mel frequency cepstrum coefficients
- track: outputs the time stamp of detected beats
- notes: emits midi-like notes, with an onset, a pitch, and a duration
- quiet: extracts quiet and loud regions
use
exit 1
}
basepath=$(cygpath -u 'C:/Program Files (x86)/Aubio/')
tool="${basepath}aubio$1.exe"
[ ! -f "${tool}" ] && {
echo 'Cannot find utility.' 1>&2
exit 1
}
[ "${2:---help}" = '--help' ] && {
"${tool}" --help
exit 0
}
[ ! -f "$2" ] && {
echo 'Audio cannot be found.' 1>&2
exit 1
}
input="$(cygpath -m "$2")"
tmpname=$(cygpath -m "/tmp/--aubio$(xxd -ps -c 0 -l 8 /dev/urandom)")
shift 2
#mkfifo $tmpname
ffprobe -hide_banner -v error -i "$input" || {
echo 'FFmpeg exited erroneously.' 1>&2
exit 1
}
echo 'Decoding...' 1>&2
ffmpeg -v error -i "$input" -vn -c:a pcm_s16le -f wav "$tmpname" # need to get if it immediately exited due to error
echo 'Running aubio...' 1>&2
"${tool}" --input "$tmpname" ${@} | sed 's/\r//g'
rm -f "$tmpname"
@donnaken15
Copy link
Author

donnaken15 commented Aug 30, 2025

BPM ANALYZER DOESN'T EVEN WORK, THE ONLY THING THIS IS GOOD FOR, ABYSSMEDIA WINS AGAIN GOD SAKE

also mark hills

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment