sox-users@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
From: "Måns Rullgård" <mans@mansr.com>
To: Shailendra Paliwal <beingshailendra@gmail.com>
Cc: sox-users@lists.sourceforge.net
Subject: Re: Can I use sox to glitch images?
Date: Sun, 06 May 2018 16:40:19 +0100	[thread overview]
Message-ID: <yw1xfu34bxng.fsf@mansr.com> (raw)
In-Reply-To: <CAJgyfojw9B7dZ5r0_vVHCyv++6hKSh1n6EDRwj8urbFkxkeqYw@mail.gmail.com> (Shailendra Paliwal's message of "Sun, 6 May 2018 17:23:43 +0530")

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

      reply	other threads:[~2018-05-06 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-users

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yw1xfu34bxng.fsf@mansr.com \
    --to=sox-users@lists.sourceforge.net \
    --cc=beingshailendra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).