]> git.sesse.net Git - audiosync/commitdiff
Add a README. master
authorsgunderson@bigfoot.com <>
Thu, 28 Dec 2006 23:37:39 +0000 (00:37 +0100)
committersgunderson@bigfoot.com <>
Thu, 28 Dec 2006 23:37:39 +0000 (00:37 +0100)
README [new file with mode: 0644]
gen-random-skew.c

diff --git a/README b/README
new file mode 100644 (file)
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 <sgunderson@bigfoot.com>. Licensed under
+the GNU General Public License, version 2.
+
index 1ca4fcddee790e5b1ae4e7dd658ad101088f1f5e..59d3fb6c94c837efede9bd905c8e30ebc2b8e41f 100644 (file)
@@ -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);