Re: how to interpret tell_off, and the right way to use sox_seek

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

 



Hi Jan,

Thanks for your mail!  And thanks for your activity in SoX!

I appreciate your help, and i will try to list my answers below.

I do take your message to imply that SoX will read no more samples
than the number of in a file total, so that, e.g., if you read the
same 10 blocks of samples and sox_seek() to the beginning of them
repeatedly, eventually your reads will fail.  And in fact, if the
length of the file is 50 blocks, those reads will fail as soon as you
have done this 5 times.  If this is not correct, please let me know!!
:)

Now, in answer to your three questions and suggestion about libsndfile:

(1) In fact, i didn't need to read the same samples multiple times, i
just needed to use them multiple times.  And it was possible for me to
implement my own buffering scheme.   And that's what i ended up doing,
because in this particular case there is a pattern of access that
repeats.  So it was possible to code around not being able to seek
freely.

However it would have been easier not to do any buffering, and just
seek, and use the implicit buffering of the system.

A sort of analogous situation is with the file system and linux: if
you're reading through a file the OS will keep it in memory so you
don't have too much overhead just relying on the OS itself to seek
back and forth in a file --- the caching has already been done.

And it's sort of similar in this case too: the file on the other side
of the SoX interface already has the data buffered, so if unlimited
seeking were possible, then there would presumably not be much file io
overhead.

(2) I'm doing this programmatically because i anticipate running the
program many times, and i want to be as sure of correctness as i can.
(In fact, i'm not actually programming it in C, but i'm using the C
calling conventions, and in principle i could certainly do this in C.)

(3) I'm using SoX to do this because it is so good :) :).  I also have
experience programming in SoX, although obviously i'm still learning.

(4) libsndfile would definitely have been a possibility, but every
library has trade offs.  As i understand it, libsndfile does not yet
support mp3, although that is on the road map.  And it is possible
that there would be some other move that i was making that wouldn't
work in libsndfile.  So i'd have to recode to see --- although as far
as i can tell, libsndfile and SoX are both excellent pieces of
software.

Thanks again for providing me information, and if anything i said is
wrong, please correct me! :)

dan


On Mon, Nov 6, 2017 at 3:10 AM, Jan Stary <hans@xxxxxxxx> wrote:
> On Nov 04 00:26:37, dan.hitt@xxxxxxxxx wrote:
>> I'm on a debian stretch box, using what i imagine is version 14, 4, 1
>> based on sox.h (SOX_LIB_VERSION(14, 4, 1)).
>>
>> I need to seek back and forth in a file, ultimately reading the same
>> samples multiple times.
>
> Why do you need to reread those same samples multiple times?
> Why do you need to do that programatically, in C?
>
> Why are you using SoX for this?
> This might be easier using libsndfile.
>
>         Jan
>
>
> ------------------------------------------------------------------------------
> 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

------------------------------------------------------------------------------
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