From f82db2334c125b14df2b4cbfc35784812daae04a Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Fri, 29 Dec 2006 00:37:39 +0100 Subject: [PATCH] Add a README. --- README | 35 +++++++++++++++++++++++++++++++++++ gen-random-skew.c | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 README diff --git a/README b/README new file mode 100644 index 0000000..903da7d --- /dev/null +++ b/README @@ -0,0 +1,35 @@ +Random assorted programs to sync multiple audio streams. Very useful when you +have two sound cards each capable of recording eight channels each, but they're +not in sync, since real-life oscillators are non-ideal. (I'm sure this is a +really common use case.) Using a sync channel (yes, that means you're "wasting" +one channel on each card) it can "stretch" the channels using a phase-locked +loop (PLL) so they are reasonably in sync all the time. (It won't neccessarily +help you getting the _start_ right, but once you've lined the recordings up +they will _stay_ lined up and not drift apart.) + +VERY UNPOLISHED. Needed them once, probably will never again. + +Basically, the tools are, in semi-logical order: + + - gen-random-skew: Generate semi-random skew; used for testing only. + + - gen-sine SAMPLES FREQUENCY: Generate a FREQUENCY Hz sine running + for SAMPLES samples. Not generally used anymore. + + - gen-square SAMPLES FREQUENCY: The same, only with a square wave. + This will be your sync channel; output it from one of the sound + cards (if you can) or from an external machine. You'll need the + sync signal on one channel of each card. Don't worry about clipping, + it's all just max/min anyhow. + + - estimate-skew REFSYNC INPSYNC SKEW: Compare the sync channel from + REFSYNC with that from INPSYNC and output the estimated skew (or + rather, recommended normalized resampling frequency) to SKEW. + + - do-skew INPUT SKEW OUTPUT: Take sound data from INPUT, resample it + using the information from SKEW (usually from estimate-skew) and + write it to OUTPUT. + +Copyright 2006 Steinar H. Gunderson . Licensed under +the GNU General Public License, version 2. + diff --git a/gen-random-skew.c b/gen-random-skew.c index 1ca4fcd..59d3fb6 100644 --- a/gen-random-skew.c +++ b/gen-random-skew.c @@ -10,7 +10,7 @@ int main(int argc, char **argv) double r = 1.005; // some overall skew just to be evil for (unsigned i = 0; i < num_samples; ++i) { - double r_delta = 3e-3 * (rand() / (RAND_MAX+1.0) - .5); + double r_delta = 3e-6 * (rand() / (RAND_MAX+1.0) - .5); r += r_delta; fwrite(&r, sizeof(double), 1, stdout); -- 2.39.2