Re: Can I use sox to glitch images?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shailendra Paliwal <beingshailendra@xxxxxxxxx> writes:

> On Sat, May 5, 2018 at 4:43 PM, Måns Rullgård <mans@xxxxxxxxx> wrote:
>
>> Shailendra Paliwal <beingshailendra@xxxxxxxxx> 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.

Yes, of course.  I assumed you had some way of dealing with that.

> 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

You should also be able to simply do this: 

$ sox -t ul -c 1 -r 48k water.bmp -t ul water_out trim 0 100s : effects ...

That will pass through the first 100 samples (enough to skip the BMP
header) unchanged, then apply the specified effects to the remainder of
the file.

> 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

If you trimmed 15 seconds from the start of the file, that would be
about 700 kB at 48 kHz.

-- 
Måns Rullgård

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sox-users




[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux