sox-users@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
* Can I use sox to glitch images?
@ 2018-05-04 15:51 Shailendra Paliwal
  2018-05-05 11:13 ` Måns Rullgård
  0 siblings, 1 reply; 6+ messages in thread
From: Shailendra Paliwal @ 2018-05-04 15:51 UTC (permalink / raw)
  To: sox-users


[-- Attachment #1.1: Type: text/plain, Size: 664 bytes --]

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.

Cheers

Shailendra

[-- Attachment #1.2: Type: text/html, Size: 786 bytes --]

[-- Attachment #2: Type: text/plain, Size: 202 bytes --]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can I use sox to glitch images?
  2018-05-04 15:51 Can I use sox to glitch images? Shailendra Paliwal
@ 2018-05-05 11:13 ` Måns Rullgård
  2018-05-06 10:33   ` James Trammell
  2018-05-06 11:53   ` Shailendra Paliwal
  0 siblings, 2 replies; 6+ messages in thread
From: Måns Rullgård @ 2018-05-05 11:13 UTC (permalink / raw)
  To: Shailendra Paliwal; +Cc: sox-users

Shailendra Paliwal <beingshailendra@gmail.com> 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...

-- 
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can I use sox to glitch images?
  2018-05-05 11:13 ` Måns Rullgård
@ 2018-05-06 10:33   ` James Trammell
  2018-05-06 12:18     ` Shailendra Paliwal
  2018-05-06 11:53   ` Shailendra Paliwal
  1 sibling, 1 reply; 6+ messages in thread
From: James Trammell @ 2018-05-06 10:33 UTC (permalink / raw)
  To: sox-users


[-- Attachment #1.1: Type: text/plain, Size: 1575 bytes --]

Shailendra,

Glitching images seems like a cool idea and has me curious: what do you use
this for? Are you hiding audio messages in images, as in steganography?

Thanks.

On Sat, May 5, 2018 at 7:13 AM, Måns Rullgård <mans@mansr.com> wrote:

> Shailendra Paliwal <beingshailendra@gmail.com> 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...
>
> --
> 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@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-users
>

[-- Attachment #1.2: Type: text/html, Size: 2451 bytes --]

[-- Attachment #2: Type: text/plain, Size: 202 bytes --]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can I use sox to glitch images?
  2018-05-05 11:13 ` Måns Rullgård
  2018-05-06 10:33   ` James Trammell
@ 2018-05-06 11:53   ` Shailendra Paliwal
  2018-05-06 15:40     ` Måns Rullgård
  1 sibling, 1 reply; 6+ messages in thread
From: Shailendra Paliwal @ 2018-05-06 11:53 UTC (permalink / raw)
  To: Måns Rullgård; +Cc: sox-users


[-- Attachment #1.1: Type: text/plain, Size: 1950 bytes --]

On Sat, May 5, 2018 at 4:43 PM, Måns Rullgård <mans@mansr.com> wrote:

> Shailendra Paliwal <beingshailendra@gmail.com> 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
>

[-- Attachment #1.2: Type: text/html, Size: 2810 bytes --]

[-- Attachment #2: Type: text/plain, Size: 202 bytes --]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can I use sox to glitch images?
  2018-05-06 10:33   ` James Trammell
@ 2018-05-06 12:18     ` Shailendra Paliwal
  0 siblings, 0 replies; 6+ messages in thread
From: Shailendra Paliwal @ 2018-05-06 12:18 UTC (permalink / raw)
  To: James Trammell; +Cc: sox-users


[-- Attachment #1.1: Type: text/plain, Size: 2528 bytes --]

On Sun, May 6, 2018 at 4:03 PM, James Trammell <james.trammell@gmail.com>
wrote:

> Shailendra,
>
> Glitching images seems like a cool idea and has me curious: what do you
> use this for? Are you hiding audio messages in images, as in steganography?
>
Hello James,

I don't have a use for it and so far it is only for recreation. Some of the
artists I follow use this technique sometimes to play with images. Some of
the music I like reminds me of the way Audacity bends images(I made short
clips with Ryoji Ikeda's soundtracks, [1]
<https://www.instagram.com/p/BgGp6DNgw0J/?taken-by=ziscore> and [2
<https://www.instagram.com/p/BgWONx3AFoA/?taken-by=ziscore>]) . I want to
explore analog video synthesizers but don't have the money to invest in a
setup right now so I thought I can explore digital ways for the idea.

Although steganography like that is also an inviting idea. I think an
esoteric mix of cryptography + machine learning + digital signal processing
tools would make for some really interesting work.

Best,
Shailendra


> Thanks.
>
> On Sat, May 5, 2018 at 7:13 AM, Måns Rullgård <mans@mansr.com> wrote:
>
>> Shailendra Paliwal <beingshailendra@gmail.com> 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...
>>
>> --
>> 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@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/sox-users
>>
>
>

[-- Attachment #1.2: Type: text/html, Size: 4046 bytes --]

[-- Attachment #2: Type: text/plain, Size: 202 bytes --]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can I use sox to glitch images?
  2018-05-06 11:53   ` Shailendra Paliwal
@ 2018-05-06 15:40     ` Måns Rullgård
  0 siblings, 0 replies; 6+ messages in thread
From: Måns Rullgård @ 2018-05-06 15:40 UTC (permalink / raw)
  To: Shailendra Paliwal; +Cc: sox-users

Shailendra Paliwal <beingshailendra@gmail.com> writes:

> On Sat, May 5, 2018 at 4:43 PM, Måns Rullgård <mans@mansr.com> wrote:
>
>> Shailendra Paliwal <beingshailendra@gmail.com> 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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-06 15:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-04 15:51 Can I use sox to glitch images? Shailendra Paliwal
2018-05-05 11:13 ` Måns Rullgård
2018-05-06 10:33   ` James Trammell
2018-05-06 12:18     ` Shailendra Paliwal
2018-05-06 11:53   ` Shailendra Paliwal
2018-05-06 15:40     ` Måns Rullgård

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).