Skip to content

Instantly share code, notes, and snippets.

@plexus
Created April 13, 2017 19:04
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 plexus/fc3c112cd3ba36aa426084c69399e904 to your computer and use it in GitHub Desktop.
Save plexus/fc3c112cd3ba36aa426084c69399e904 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Command line glitch script. Requires `convert' (ImageMagick) and `sox'
#
# Usage: ./glitch <image_name>
#
# The result ends up in glitch.png
export HEADER_SIZE=1000
export SOX_IN="-r 44100 -b 16 -e unsigned-integer"
# This is where the fun starts, look at the man page for sox, skip to the
# "effects" section, and try them out!
export SOX_OUT="gain -nh bandreject 5 300"
#export SOX_OUT="gain -nh bass +10 "
#export SOX_OUT="chorus 1 2 70 0.05 0.1 1.4 -t"
convert $1 tmp_input.bmp
split -d -b $HEADER_SIZE tmp_input.bmp tmp_chunk_
mv tmp_chunk_00 tmp_header.raw
cat tmp_chunk_* > tmp_body.raw
`sox $SOX_IN tmp_body.raw tmp_output.raw $SOX_OUT`
cat tmp_header.raw tmp_output.raw > tmp_result.bmp
convert tmp_result.bmp glitch.png
rm -f tmp_*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment