From: Rob Sykes <aquegg@yahoo.co.uk>
To: "sox-users@lists.sourceforge.net" <sox-users@lists.sourceforge.net>
Subject: Re: Help with fractions re: resampling
Date: Thu, 8 Jan 2015 06:28:20 +0000 (UTC) [thread overview]
Message-ID: <462914311.6213910.1420698501004.JavaMail.yahoo@jws11175.mail.ir2.yahoo.com> (raw)
In-Reply-To: <9285E5E6-B775-49E0-A62F-730AAF861575@farski.com>
[-- Attachment #1.1: Type: text/plain, Size: 1364 bytes --]
On Tuesday, 6 January 2015, 22:18, Christopher Paul Kalafarski <chris@farski.com> wrote:
I’m really struggling with what I thought would be relatively simple process of reading a file (with libsndfile), resampling it (using soxr), and writing it back to disk (with sndfile again). I realize this list is for neither of those libraries, but afaik soxr is extracted from SoX just with a different API, and I think my issue is in dealing with the resulting data, and not the API.
My main confusion is that if I pass in, e.g., 4096 frames at 48000, and resample to 44100, mathematically I would expect to get back 3763.2 frames. What is the proper way to handle the 0.2 frames in this case?
Conceptually, the 0.2 is buffered within the resampler, so consecutive inputs of 4096 could result in 3763, 3763, 3763, 3763, 3764, 3763, ... being output. In practice though, there can be a lot more variation in the output pattern, due to internal buffering and block processing. For this reason, it often makes sense for resampling to be output driven. E.g., if every 10ms, you need to present 441 samples to your output hardware, then every 10ms, resample as much input data as is needed to get (at least) 441 samples needed for the output. soxr supports this paradigm via the soxr_set_input_fn() and soxr_output() functions. HTH.
[-- Attachment #1.2: Type: text/html, Size: 2780 bytes --]
[-- Attachment #2: Type: text/plain, Size: 440 bytes --]
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
[-- Attachment #3: Type: text/plain, Size: 158 bytes --]
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users
prev parent reply other threads:[~2015-01-08 6:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 21:58 Help with fractions re: resampling Christopher Paul Kalafarski
2015-01-07 6:37 ` Erich Eckner
2015-01-07 14:37 ` Christopher Paul Kalafarski
2015-01-08 6:28 ` Rob Sykes [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=462914311.6213910.1420698501004.JavaMail.yahoo@jws11175.mail.ir2.yahoo.com \
--to=sox-users@lists.sourceforge.net \
--cc=aquegg@yahoo.co.uk \
/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).