On Sat, May 5, 2018 at 4:43 PM, Måns Rullgård wrote: > Shailendra Paliwal writes: > > > Hello, > > > > I found sox as a command-line equivalent of Audacity. I was wondering how > > can I glitch images like the way I can using Audacity. > > > > On audacity the usual modus operandi is, > > > > 1. Use Audacity > File > Import > Raw Data, to import a BMP image > file. > > 2. Set the encoding to U-Law or A-Law. > > 3. Apply audio effects to the track. > > 4. Export Audio, set Save As Type > Other Uncompressed Files > > 5. Header > RAW (header-less) and Encoding > whichever selected in (2) > > 6. Rename to BMP > > > > I was wondering if the same method can be used with sox. That way I can > > make shell scripts to glitch images or even thousands of frames in a > video. > > Yes, this can be done. Try something like this: > > $ sox -t ul -c 1 -r 48k input -t ul output effects... > This seems to corrupt the header of the file too and then I cannot open it at all. Usually in Audacity, I would not touch the first 5% of the track assuming it contains the header information that should be left untouched. So, I thought if I can split the header and the file contents into two file. That would be easy to run through sox. I tried $ sox -t ul -c 1 -r 48k water.bmp -t ul water_out trim 0 15 : newfile : restart This should work because new headers aren't created while spitting and I checked this by merging these files back (I'm on windows) $ type water_out* > water_databent.bmp This get me the image again. However, I processed one chunk with an audio effect and the file size reduced drastically from ~700KB to ~2KB. Would you know why did that happen? I did $ sox -t ul -c 1 -r 48k water_out002 -t ul water_out002 echo 0.8 0.7 45 0.31 Now the files don't stitch back to the image either. > -- > Måns Rullgård >