sox-users@lists.sourceforge.net unofficial mirror
 help / color / Atom feed
* Re: Post to sox-devel@public-inbox.org denied: Re: how to interpret tell_off, and the right way to use sox_seek
       [not found] <1510049155-26818-mlmmj-0860bf8a@public-inbox.org>
@ 2017-11-07 15:12 ` Jan Stary
  2017-11-07 18:14   ` [SoX-devel] " Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Stary @ 2017-11-07 15:12 UTC (permalink / raw)
  To: sox-devel, sox-users

Sorry for crossposting, but whoever's running the public-inbox.org mirror,
please get it fixed.

	Jan


On Nov 07 10:05:55, sox-devel+owner@public-inbox.org wrote:
> Hi, this is the Mlmmj program managing the <sox-devel@public-inbox.org>
> mailing list.
> 
> The message from <hans@stare.cz> with subject "Re: [SoX-users] how to
> interpret tell_off, and the right way to use sox_seek" was unable to be
> delivered to the list
> 
> (The denied message is below.)

> Date: Tue, 7 Nov 2017 09:50:36 +0100
> From: Jan Stary <hans@stare.cz>
> To: sox-users@lists.sourceforge.net
> Subject: Re: [SoX-users] how to interpret tell_off, and the right way to
>  use sox_seek
> Reply-To: sox-devel@lists.sourceforge.net
> 
> > First, it reads (which presumably moves the file pointer forwards),
> > then it seeks back to where it was.
> > I've verified in gdb that it actually does call sox_seek() (again and
> > again and again, but not forever).  I have also verified in gdb that
> > it is reading the same samples.
> 
> Ah, I see what your problem is now.
> 
> > So sox_seek() is definitely being called, and definitely working.
> > But nevertheless, the reading done after the seeking eventually fails.
> 
> Here is my slight rewrite of your example:
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include <err.h>
> #include <sox.h>
> 
> int 
> main(int argc, char **argv)
> {
> 	sox_format_t *s;
> 	int32_t buf[1024];
> 	ssize_t r;
> 	int i;
> 
> 	if (argc < 2)
> 		errx(1, "usage: ./soxseek input");
> 	if (sox_init() != SOX_SUCCESS)
> 		errx(1, "Cannot init libsox");
> 	if ((s = sox_open_read(*++argv, 0, 0, 0)) == NULL)
> 		errx(1, "Cannot open `%s'", *argv);
> 	for (i = 1; (r = sox_read(s, buf, 1024)) > 0; i++) {
> 		printf("[%04d] %zd samples, starting with %0x\n", i, r, *buf);
> 		if (sox_seek(s, 0, SOX_SEEK_SET) != SOX_SUCCESS)
> 			errx(1, "Cannot seek");
> 	}
> 	/* No way to test for sox_read() error */
> 	return 0;
> }
> 
> (Note how I don't use sox_site_t for the sox_read() return value,
> because it does not exist, eventhough that's what libsox(3) documents.)
> 
> $ sox -n /tmp/file.wav synth trim 0 $((1024 * 1000))s  
> $ cc -o soxseek soxseek.c -lsox -I/usr/local/include/ -L/usr/local/lib
> $ ./soxseek /tmp/file.wav 
> [0000] 1024 samples, starting with 0
> [0001] 1024 samples, starting with 0
> [....]
> [0999] 1024 samples, starting with 0
> [1000] 1024 samples, starting with 0
> 
> So I think you are right. It does seek back to the begining of the sine wave
> (thus reporting 0 as the first sample value in the buffer), but it gets
> exhausted at EOF anyway. I suspect now it is a bug in sox_seek()
> if we are calling it right.
> 
> > Certainly if you do analogous coding with calls to fread() and
> > fseek(), it would not terminate.
> 
> Yes, the following will read the same file forever:
> 
> #include <unistd.h>
> #include <fcntl.h>
> #include <stdio.h>
> #include <err.h>
> 
> int 
> main(int argc, char **argv)
> {
> 	int fd;
> 	int32_t buf[1024];
> 	ssize_t r;
> 	int i;
> 
> 	if (argc < 2)
> 		errx(1, "usage: ./seek input");
> 	if ((fd = open(*++argv, O_RDONLY)) == -1)
> 		err(1, NULL);
> 	for (i = 1; (r = read(fd, buf, 1024)) > 0; i++) {
> 		printf("[%04d] %zd samples, starting with %0x\n", i, r, *buf);
> 		if (lseek(fd, 0, SEEK_SET) == -1)
> 			err(1, NULL);
> 	}
> 	return (r != 0);
> }
> 
> 
> > What i'm trying to do now is to determine the correct way to use
> > sox_seek() if i am using it incorrectly.  If i'm using it correctly,
> > then i would like confirmation of my characterization (that it has
> > some internal counter which is decremented until it hits zero).
> 
> I share your suspition now.
> 
> > (I did have a signal processing problem that i was considering
> > earlier, but that's not relevant now because i avoided the sox_seek
> > issue by rearranging the computation.  So i can do my dsp, but i do
> > wonder about correct usage of sox_seek.)
> 
> Should we move this to sox-devel?
> 
> 	Jan
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> SoX-devel mailing list
> SoX-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-devel


------------------------------------------------------------------------------
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] 4+ messages in thread

* Re: [SoX-devel] Post to sox-devel@public-inbox.org denied: Re: how to interpret tell_off, and the right way to use sox_seek
  2017-11-07 15:12 ` Post to sox-devel@public-inbox.org denied: Re: how to interpret tell_off, and the right way to use sox_seek Jan Stary
@ 2017-11-07 18:14   ` " Eric Wong
  2017-11-07 20:41     ` Jan Stary
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2017-11-07 18:14 UTC (permalink / raw)
  To: sox-devel; +Cc: sox-users

Jan Stary <hans@stare.cz> wrote:
> Sorry for crossposting, but whoever's running the public-inbox.org mirror,
> please get it fixed.

Sorry, though I'm not sure what's tripping up mlmmj for you.
I'll disable mlmmj for this list since it wasn't used anyways...

Was that the only bounce you've seen, lately?
I don't think anybody else has been affected, lately.

But the HTTPS mirrors at https://public-inbox.org/sox-devel/ should
remain up.

------------------------------------------------------------------------------
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] 4+ messages in thread

* Re: [SoX-devel] Post to sox-devel@public-inbox.org denied: Re: how to interpret tell_off, and the right way to use sox_seek
  2017-11-07 18:14   ` [SoX-devel] " Eric Wong
@ 2017-11-07 20:41     ` Jan Stary
  2017-11-08  0:47       ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Stary @ 2017-11-07 20:41 UTC (permalink / raw)
  To: sox-devel; +Cc: sox-users

On Nov 07 18:14:23, normalperson@yhbt.net wrote:
> Jan Stary <hans@stare.cz> wrote:
> > Sorry for crossposting, but whoever's running the public-inbox.org mirror,
> > please get it fixed.
> 
> Sorry, though I'm not sure what's tripping up mlmmj for you.
> I'll disable mlmmj for this list since it wasn't used anyways...
> 
> Was that the only bounce you've seen, lately?

Yes.

But I have inly been posting to sox-users lately,
this was the inly post to sox-devel.

> But the HTTPS mirrors at https://public-inbox.org/sox-devel/ should
> remain up.

The mirror at
https://marc.info/?l=sox-users&r=1&w=2
https://marc.info/?l=sox-devel&r=1&w=2
is very reliable and the interface sucks way less.


------------------------------------------------------------------------------
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] 4+ messages in thread

* Re: [SoX-devel] Post to sox-devel@public-inbox.org denied: Re: how to interpret tell_off, and the right way to use sox_seek
  2017-11-07 20:41     ` Jan Stary
@ 2017-11-08  0:47       ` Eric Wong
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2017-11-08  0:47 UTC (permalink / raw)
  To: sox-devel, sox-users

Jan Stary <hans@stare.cz> wrote:
> On Nov 07 18:14:23, normalperson@yhbt.net wrote:
> > But the HTTPS mirrors at https://public-inbox.org/sox-devel/ should
> > remain up.
> 
> The mirror at
> https://marc.info/?l=sox-users&r=1&w=2
> https://marc.info/?l=sox-devel&r=1&w=2
> is very reliable and the interface sucks way less.

More mirrors is better for redundancy (some git developers
thought gmane would last forever, too).  If you have ideas to
improve the UI without increasing hardware requirements for
clients or servers I'd be happy to hear them at meta@public-inbox.org

And the code + raw archives are totally forkable, too; since UI
is mostly subjective and everybody has different tastes.

------------------------------------------------------------------------------
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] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1510049155-26818-mlmmj-0860bf8a@public-inbox.org>
2017-11-07 15:12 ` Post to sox-devel@public-inbox.org denied: Re: how to interpret tell_off, and the right way to use sox_seek Jan Stary
2017-11-07 18:14   ` [SoX-devel] " Eric Wong
2017-11-07 20:41     ` Jan Stary
2017-11-08  0:47       ` Eric Wong

sox-users@lists.sourceforge.net unofficial mirror

Archives are clonable: git clone --mirror https://public-inbox.org/sox-users

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.sox
	nntp://ou63pmih66umazou.onion/inbox.comp.audio.sox
	nntp://news.gmane.org/gmane.comp.audio.sox

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox