Re: how to copy just part of a file?

2003-07-16 Thread Matthew Emmerton
> On Wed, 16 Jul 2003, BSD baby wrote:
>
> > Is there an easy built-in way to copy only part of a file?
> >
> > I want to take a WAV audio file and copy from #__ bytes to
> > #___ bytes into a new file.
> >
> > (I'm making 30-second clips of files.)

You might find WavSplit (http://www.xmailserver.org/davide.html) useful.  It
will split a wav file into sections of X seconds each.

It isn't part of the ports collection yet, but I just submitted a PR to add
it.

--
Matt Emmerton

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: how to copy just part of a file?

2003-07-16 Thread Mikko Työläjärvi
On Wed, 16 Jul 2003, BSD baby wrote:

> Is there an easy built-in way to copy only part of a file?
>
> I want to take a WAV audio file and copy from #__ bytes to
> #___ bytes into a new file.
>
> (I'm making 30-second clips of files.)

Try "dd".  Thus:

  dd bs=1 skip=$offset count=$length < infile > outfile

It is possible that a block size of one byte is kind of inefficient,
so if you can operate in units of some larger size that might be good.
For example "bs=1k". See "man dd".

Also, remember that WAV files have a 44 byte (or was that 42...?) wav
header.  Yes, you can extract it with "dd bs=44 count=1", but I'm too
lazy to find out whether you can just prepend it to any split files
right now (i.e. if the file contains any length info; I suspect not).

> Though I found a scripting way to do it with PHP, I'm wondering
> if there's a more direct way to do it with basic GNU/BSD commands.

Ever heard of POSIX... ;-)

 $.02,
 /Mikko
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: how to copy just part of a file?

2003-07-16 Thread Dan Nelson
In the last episode (Jul 16), Chuck Swiger said:
> BSD baby wrote:
> [ ... ]
> > Though I found a scripting way to do it with PHP, I'm wondering if
> > there's a more direct way to do it with basic GNU/BSD commands.
> 
> GNU split will take options related to size/byte counts, rather than
> just ASCII lines.

... as will any other POSIX-conforming split, including FreeBSD's.  But
you need more than that because wav files have a header that you'll
have to duplicate onto each output file.  You can use the sox port to
convert the wav file into a raw pcm file that can be split up, then
convert the pieces back to wavs with sox again.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: how to copy just part of a file?

2003-07-16 Thread Chuck Swiger
BSD baby wrote:
[ ... ]
Though I found a scripting way to do it with PHP, I'm wondering
if there's a more direct way to do it with basic GNU/BSD commands.
GNU split will take options related to size/byte counts, rather than just ASCII 
lines.

--
-Chuck
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


how to copy just part of a file?

2003-07-16 Thread BSD baby
Is there an easy built-in way to copy only part of a file?

I want to take a WAV audio file and copy from #__ bytes to
#___ bytes into a new file.

(I'm making 30-second clips of files.)

Though I found a scripting way to do it with PHP, I'm wondering
if there's a more direct way to do it with basic GNU/BSD commands.

Anyone?

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"