Skip to content

Instantly share code, notes, and snippets.

@atchoo78
Last active February 20, 2023 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atchoo78/0f4e6fc75379410da7327fc1f4144c51 to your computer and use it in GitHub Desktop.
Save atchoo78/0f4e6fc75379410da7327fc1f4144c51 to your computer and use it in GitHub Desktop.
writehex - Converts hexadecimal data to ASCII text or pipe it to a file (useful for creating valid System Exclusive MIDI message files). Usage: "./writehex 6964 6b66 6120 6964 6471 6420 6964 7370 6973 706f 7064" or "./writehex F0 00 20 6B 7F 42 02 00 40 52 00 F7>sysex.syx"
#!/usr/bin/env bash
while [ "$1" ]; do
for ((i=0; i<${#1}; i+=2))
do
printf "\x${1:i:2}";
done;
shift;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment