From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3561 216.34.176.0/20 X-Spam-Status: No, score=-3.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,T_DKIM_INVALID shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 1B05920A10 for ; Mon, 6 Nov 2017 19:06:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1eBmjZ-0007iD-LB; Mon, 06 Nov 2017 19:06:57 +0000 Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eBmjX-0007i5-OH for sox-users@lists.sourceforge.net; Mon, 06 Nov 2017 19:06:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:To:From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Wzd3WgjIt5/tcRMT0lKxuBIVjj6Y0haQ8rUF54U+ASM=; b=dAYhYumMi6gZHuy4hO2ptcHsoq U/J+jUaRYXTk5SPDuJcj9f10SiRP5q3WNGilw2Vh9/C4ZpcPQloXiP5RCOrrMsoQENlWyXaUkEZB/ kHQB15drUIB8JPCROB+wu5ncs736ZTl1lhIBY2ycEPhY1Ia4vH+5qiOXSLpGXylKwYGY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To: From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Wzd3WgjIt5/tcRMT0lKxuBIVjj6Y0haQ8rUF54U+ASM=; b=MkWWZAs5axWTZYd6NRLfahc1hn RdQw/WasPiHQoUoxpY0CDnqDMkz+Sj6OZCprcymBiRZ9Vq60M57ZjqUdx9ubuUEsBCSLB1SHlFTnU cvAWbe2oqjPBJL6ZNDyru9MkHPbywSWPoQ/KZa4B3VRhGN7ElHorzBTB2FMP0NxpO2Hg=; Received: from ns.stare.cz ([79.98.77.229] helo=mx.stare.cz) by sfi-mx-3.v28.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) id 1eBmjW-0001Vd-6C for sox-users@lists.sourceforge.net; Mon, 06 Nov 2017 19:06:55 +0000 Received: from www.stare.cz (localhost [127.0.0.1]) by www.stare.cz (OpenSMTPD) with ESMTP id ba75b221 for ; Mon, 6 Nov 2017 20:06:46 +0100 (CET) Date: Mon, 6 Nov 2017 20:06:46 +0100 From: Jan Stary To: sox-users@lists.sourceforge.net Message-ID: <20171106190645.GA61378@www.stare.cz> Mail-Followup-To: sox-users@lists.sourceforge.net References: <20171106111001.GA80730@www.stare.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-Headers-End: 1eBmjW-0001Vd-6C Subject: Re: how to interpret tell_off, and the right way to use sox_seek X-BeenThere: sox-users@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sox-users@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: sox-users-bounces@lists.sourceforge.net > 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!! > :) There is a difference between SoX the utility and libsox the library. I am not sure if SoX itself ever reads a block of audio more than once (I can imagina situations where it would), but that's not a constraint on what the libsox library can do. If it has a sox_seek(), then I suppose it does what the name says; in particular, it lets you read the same block of audio over ano over again as long as you keep seekign back. (Disclaimer: I have never used libsox directly, I only use SoX the binary.) > 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. Well, that changes the whole premise. Is there anything left of the original problem then? > However it would have been easier not to do any buffering, and just > seek, and use the implicit buffering of the system. Using the same data again does not imply any buffering by itself. You sox_read() into an array and then use it as you wish (such as play it seven times). > 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. You already _have_ the data in memory once you have sox_read() them, so I fail to see the analogy. Why would you seek back and read it again _from_the_file_ once you have it in an array? > (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.) What makes you think that writing your own code will make your use of SoX more "correct"? > (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. I still have no idea about what you want to do, eventually. You are asking about technicalities; what are you actually _doing_ ? > (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. I still have no idea about what you want to do. 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sox-users