3 * Copyright (C) 2008 Rov Juvano <rovjuvano@users.sourceforge.net>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * SECTION:element-scaletempo
24 * Scale tempo while maintaining pitch
25 * (WSOLA-like technique with cross correlation)
26 * Inspired by SoundTouch library by Olli Parviainen
28 * Use Sceletempo to apply playback rates without the chipmunk effect.
31 * <title>Example pipelines</title>
34 * filesrc location=media.ext ! decodebin name=d \
35 * d. ! queue ! audioconvert ! audioresample ! scaletempo ! audioconvert ! audioresample ! autoaudiosink \
36 * d. ! queue ! ffmpegcolorspace ! autovideosink
40 * playbin uri=... audio_sink="scaletempo ! audioconvert ! audioresample ! autoaudiosink"
42 * When an application sends a seek event with rate != 1.0, Scaletempo applies
43 * the rate change by scaling the tempo without scaling the pitch.
45 * Scaletempo works by producing audio in constant sized chunks
46 * (#GstScaletempo:stride) but consuming chunks proportional to the playback
49 * Scaletempo then smooths the output by blending the end of one stride with
50 * the next (#GstScaletempo:overlap).
52 * Scaletempo smooths the overlap further by searching within the input buffer
53 * for the best overlap position. Scaletempo uses a statistical cross
54 * correlation (roughly a dot-product). Scaletempo consumes most of its CPU
55 * cycles here. One can use the #GstScaletempo:search propery to tune how far
62 * Note: frame = audio key unit (i.e. one sample for each channel)
70 #include <gst/base/gstbasetransform.h>
71 #include <string.h> /* for memset */
73 #include "gstscaletempo.h"
75 GST_DEBUG_CATEGORY_STATIC (gst_scaletempo_debug);
76 #define GST_CAT_DEFAULT gst_scaletempo_debug
78 /* Filter signals and args */
93 #define SUPPORTED_CAPS \
95 "audio/x-raw-float, " \
96 "rate = (int) [ 1, MAX ], " \
97 "channels = (int) [ 1, MAX ], " \
98 "endianness = (int) BYTE_ORDER, " \
100 "audio/x-raw-int, " \
101 "rate = (int) [ 1, MAX ], " \
102 "channels = (int) [ 1, MAX ], " \
103 "endianness = (int) BYTE_ORDER, " \
104 "width = (int) 16, " \
105 "depth = (int) 16, " \
106 "signed = (boolean) true;" \
109 static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
114 static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
119 #define DEBUG_INIT(bla) GST_DEBUG_CATEGORY_INIT (gst_scaletempo_debug, "scaletempo", 0, "scaletempo element");
121 GST_BOILERPLATE_FULL (GstScaletempo, gst_scaletempo, GstBaseTransform,
122 GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
124 typedef struct _GstScaletempoPrivate
129 gdouble percent_overlap;
133 guint samples_per_frame; /* AKA number of channels */
134 guint bytes_per_sample;
135 guint bytes_per_frame;
138 gdouble frames_stride_scaled;
139 gdouble frames_stride_error;
141 gdouble bytes_stride_scaled;
142 guint bytes_queue_max;
144 guint bytes_to_slide;
147 guint samples_overlap;
148 guint samples_standing;
150 guint bytes_standing;
151 gpointer buf_overlap;
152 gpointer table_blend;
153 void (*output_overlap) (GstScaletempo * scaletempo, gpointer out_buf,
157 gpointer buf_pre_corr;
158 gpointer table_window;
159 guint (*best_overlap_offset) (GstScaletempo * scaletempo);
161 gint64 segment_start;
163 gboolean reinit_buffers;
164 } GstScaletempoPrivate;
165 #define GST_SCALETEMPO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_SCALETEMPO, GstScaletempoPrivate))
169 best_overlap_offset_float (GstScaletempo * scaletempo)
171 GstScaletempoPrivate *p = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
172 gfloat *pw, *po, *ppc, *search_start;
173 gfloat best_corr = G_MININT;
177 pw = p->table_window;
179 po += p->samples_per_frame;
180 ppc = p->buf_pre_corr;
181 for (i = p->samples_per_frame; i < p->samples_overlap; i++) {
182 *ppc++ = *pw++ * *po++;
185 search_start = (gfloat *) p->buf_queue + p->samples_per_frame;
186 for (off = 0; off < p->frames_search; off++) {
188 gfloat *ps = search_start;
189 ppc = p->buf_pre_corr;
190 for (i = p->samples_per_frame; i < p->samples_overlap; i++) {
191 corr += *ppc++ * *ps++;
193 if (corr > best_corr) {
197 search_start += p->samples_per_frame;
200 return best_off * p->bytes_per_frame;
203 /* buffer padding for loop optimization: sizeof(gint32) * (loop_size - 1) */
204 #define UNROLL_PADDING (4*3)
206 best_overlap_offset_s16 (GstScaletempo * scaletempo)
208 GstScaletempoPrivate *p = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
210 gint16 *po, *search_start;
211 gint64 best_corr = G_MININT64;
216 pw = p->table_window;
218 po += p->samples_per_frame;
219 ppc = p->buf_pre_corr;
220 for (i = p->samples_per_frame; i < p->samples_overlap; i++) {
221 *ppc++ = (*pw++ * *po++) >> 15;
224 search_start = (gint16 *) p->buf_queue + p->samples_per_frame;
225 for (off = 0; off < p->frames_search; off++) {
227 gint16 *ps = search_start;
228 ppc = p->buf_pre_corr;
229 ppc += p->samples_overlap - p->samples_per_frame;
230 ps += p->samples_overlap - p->samples_per_frame;
231 i = -((glong) p->samples_overlap - (glong) p->samples_per_frame);
233 corr += ppc[i + 0] * ps[i + 0];
234 corr += ppc[i + 1] * ps[i + 1];
235 corr += ppc[i + 2] * ps[i + 2];
236 corr += ppc[i + 3] * ps[i + 3];
239 if (corr > best_corr) {
243 search_start += p->samples_per_frame;
246 return best_off * p->bytes_per_frame;
250 output_overlap_float (GstScaletempo * scaletempo,
251 gpointer buf_out, guint bytes_off)
253 GstScaletempoPrivate *p = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
254 gfloat *pout = buf_out;
255 gfloat *pb = p->table_blend;
256 gfloat *po = p->buf_overlap;
257 gfloat *pin = (gfloat *) (p->buf_queue + bytes_off);
259 for (i = 0; i < p->samples_overlap; i++) {
260 *pout++ = *po - *pb++ * (*po - *pin++);
266 output_overlap_s16 (GstScaletempo * scaletempo,
267 gpointer buf_out, guint bytes_off)
269 GstScaletempoPrivate *p = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
270 gint16 *pout = buf_out;
271 gint32 *pb = p->table_blend;
272 gint16 *po = p->buf_overlap;
273 gint16 *pin = (gint16 *) (p->buf_queue + bytes_off);
275 for (i = 0; i < p->samples_overlap; i++) {
276 *pout++ = *po - ((*pb++ * (*po - *pin++)) >> 16);
282 fill_queue (GstScaletempo * scaletempo, GstBuffer * buf_in, guint offset)
284 GstScaletempoPrivate *p = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
285 guint bytes_in = GST_BUFFER_SIZE (buf_in) - offset;
286 guint offset_unchanged = offset;
288 if (p->bytes_to_slide > 0) {
289 if (p->bytes_to_slide < p->bytes_queued) {
290 guint bytes_in_move = p->bytes_queued - p->bytes_to_slide;
291 memmove (p->buf_queue, p->buf_queue + p->bytes_to_slide, bytes_in_move);
292 p->bytes_to_slide = 0;
293 p->bytes_queued = bytes_in_move;
296 p->bytes_to_slide -= p->bytes_queued;
297 bytes_in_skip = MIN (p->bytes_to_slide, bytes_in);
299 p->bytes_to_slide -= bytes_in_skip;
300 offset += bytes_in_skip;
301 bytes_in -= bytes_in_skip;
306 guint bytes_in_copy = MIN (p->bytes_queue_max - p->bytes_queued, bytes_in);
307 memcpy (p->buf_queue + p->bytes_queued,
308 GST_BUFFER_DATA (buf_in) + offset, bytes_in_copy);
309 p->bytes_queued += bytes_in_copy;
310 offset += bytes_in_copy;
313 return offset - offset_unchanged;
317 reinit_buffers (GstScaletempo * scaletempo)
319 GstScaletempoPrivate *p = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
321 guint frames_overlap;
324 guint frames_stride = p->ms_stride * p->sample_rate / 1000.0;
325 p->bytes_stride = frames_stride * p->bytes_per_frame;
328 frames_overlap = frames_stride * p->percent_overlap;
329 if (frames_overlap < 1) { /* if no overlap */
330 p->bytes_overlap = 0;
331 p->bytes_standing = p->bytes_stride;
332 p->samples_standing = p->bytes_standing / p->bytes_per_sample;
333 p->output_overlap = NULL;
335 guint prev_overlap = p->bytes_overlap;
336 p->bytes_overlap = frames_overlap * p->bytes_per_frame;
337 p->samples_overlap = frames_overlap * p->samples_per_frame;
338 p->bytes_standing = p->bytes_stride - p->bytes_overlap;
339 p->samples_standing = p->bytes_standing / p->bytes_per_sample;
340 p->buf_overlap = g_realloc (p->buf_overlap, p->bytes_overlap);
341 p->table_blend = g_realloc (p->table_blend, p->samples_overlap * 4); /* sizeof (gint32|gfloat) */
342 if (p->bytes_overlap > prev_overlap) {
343 memset ((guint8 *) p->buf_overlap + prev_overlap, 0,
344 p->bytes_overlap - prev_overlap);
347 gint32 *pb = p->table_blend;
349 for (i = 0; i < frames_overlap; i++) {
350 gint32 v = blend / frames_overlap;
351 for (j = 0; j < p->samples_per_frame; j++) {
354 blend += 65535; /* 2^16 */
356 p->output_overlap = output_overlap_s16;
358 gfloat *pb = p->table_blend;
359 gfloat t = (gfloat) frames_overlap;
360 for (i = 0; i < frames_overlap; i++) {
362 for (j = 0; j < p->samples_per_frame; j++) {
366 p->output_overlap = output_overlap_float;
372 (frames_overlap <= 1) ? 0 : p->ms_search * p->sample_rate / 1000.0;
373 if (p->frames_search < 1) { /* if no search */
374 p->best_overlap_offset = NULL;
376 guint bytes_pre_corr = (p->samples_overlap - p->samples_per_frame) * 4; /* sizeof (gint32|gfloat) */
378 g_realloc (p->buf_pre_corr, bytes_pre_corr + UNROLL_PADDING);
379 p->table_window = g_realloc (p->table_window, bytes_pre_corr);
381 gint64 t = frames_overlap;
382 gint32 n = 8589934588LL / (t * t); /* 4 * (2^31 - 1) / t^2 */
385 memset ((guint8 *) p->buf_pre_corr + bytes_pre_corr, 0, UNROLL_PADDING);
386 pw = p->table_window;
387 for (i = 1; i < frames_overlap; i++) {
388 gint32 v = (i * (t - i) * n) >> 15;
389 for (j = 0; j < p->samples_per_frame; j++) {
393 p->best_overlap_offset = best_overlap_offset_s16;
395 gfloat *pw = p->table_window;
396 for (i = 1; i < frames_overlap; i++) {
397 gfloat v = i * (frames_overlap - i);
398 for (j = 0; j < p->samples_per_frame; j++) {
402 p->best_overlap_offset = best_overlap_offset_float;
407 (p->frames_search + frames_stride + frames_overlap) * p->bytes_per_frame;
408 if (p->bytes_queued > new_size) {
409 if (p->bytes_to_slide > p->bytes_queued) {
410 p->bytes_to_slide -= p->bytes_queued;
413 guint new_queued = MIN (p->bytes_queued - p->bytes_to_slide, new_size);
414 memmove (p->buf_queue,
415 p->buf_queue + p->bytes_queued - new_queued, new_queued);
416 p->bytes_to_slide = 0;
417 p->bytes_queued = new_queued;
420 p->bytes_queue_max = new_size;
421 p->buf_queue = g_realloc (p->buf_queue, p->bytes_queue_max);
423 p->bytes_stride_scaled = p->bytes_stride * p->scale;
424 p->frames_stride_scaled = p->bytes_stride_scaled / p->bytes_per_frame;
427 ("%.3f scale, %.3f stride_in, %i stride_out, %i standing, %i overlap, %i search, %i queue, %s mode",
428 p->scale, p->frames_stride_scaled,
429 (gint) (p->bytes_stride / p->bytes_per_frame),
430 (gint) (p->bytes_standing / p->bytes_per_frame),
431 (gint) (p->bytes_overlap / p->bytes_per_frame), p->frames_search,
432 (gint) (p->bytes_queue_max / p->bytes_per_frame),
433 (p->use_int ? "s16" : "float"));
435 p->reinit_buffers = FALSE;
439 /* GstBaseTransform vmethod implementations */
441 gst_scaletempo_transform (GstBaseTransform * trans,
442 GstBuffer * inbuf, GstBuffer * outbuf)
444 GstScaletempo *scaletempo = GST_SCALETEMPO (trans);
445 GstScaletempoPrivate *p = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
447 gint8 *pout = (gint8 *) GST_BUFFER_DATA (outbuf);
448 guint offset_in = fill_queue (scaletempo, inbuf, 0);
450 while (p->bytes_queued >= p->bytes_queue_max) {
452 gdouble frames_to_slide;
453 guint frames_to_stride_whole;
456 if (p->output_overlap) {
457 if (p->best_overlap_offset) {
458 bytes_off = p->best_overlap_offset (scaletempo);
460 p->output_overlap (scaletempo, pout, bytes_off);
462 memcpy (pout + p->bytes_overlap,
463 p->buf_queue + bytes_off + p->bytes_overlap, p->bytes_standing);
464 pout += p->bytes_stride;
465 bytes_out += p->bytes_stride;
468 memcpy (p->buf_overlap,
469 p->buf_queue + bytes_off + p->bytes_stride, p->bytes_overlap);
470 frames_to_slide = p->frames_stride_scaled + p->frames_stride_error;
471 frames_to_stride_whole = (gint) frames_to_slide;
472 p->bytes_to_slide = frames_to_stride_whole * p->bytes_per_frame;
473 p->frames_stride_error = frames_to_slide - frames_to_stride_whole;
475 offset_in += fill_queue (scaletempo, inbuf, offset_in);
478 GST_BUFFER_SIZE (outbuf) = bytes_out;
479 GST_BUFFER_TIMESTAMP (outbuf) =
480 (GST_BUFFER_TIMESTAMP (outbuf) - p->segment_start) / p->scale +
482 //GST_BUFFER_DURATION (outbuf) = bytes_out * GST_SECOND / (p->bytes_per_frame * p->sample_rate);
487 gst_scaletempo_transform_size (GstBaseTransform * trans,
488 GstPadDirection direction,
489 GstCaps * caps, guint size, GstCaps * othercaps, guint * othersize)
491 if (direction == GST_PAD_SINK) {
492 GstScaletempo *scaletempo = GST_SCALETEMPO (trans);
493 GstScaletempoPrivate *priv = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
496 if (priv->reinit_buffers)
497 reinit_buffers (scaletempo);
499 bytes_to_out = size + priv->bytes_queued - priv->bytes_to_slide;
500 if (bytes_to_out < (gint) priv->bytes_queue_max) {
503 /* while (total_buffered - stride_length * n >= queue_max) n++ */
504 *othersize = priv->bytes_stride * ((guint) (
505 (bytes_to_out - priv->bytes_queue_max +
506 /* rounding protection */ priv->bytes_per_frame)
507 / priv->bytes_stride_scaled) + 1);
516 gst_scaletempo_sink_event (GstBaseTransform * trans, GstEvent * event)
518 if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
519 GstScaletempo *scaletempo = GST_SCALETEMPO (trans);
520 GstScaletempoPrivate *priv = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
523 gdouble rate, applied_rate;
525 gint64 start, stop, position;
527 gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
528 &format, &start, &stop, &position);
530 if (priv->scale != rate) {
531 if (ABS (rate - 1.0) < 1e-10) {
533 gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (scaletempo),
536 gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (scaletempo),
539 priv->bytes_stride_scaled = priv->bytes_stride * priv->scale;
540 priv->frames_stride_scaled =
541 priv->bytes_stride_scaled / priv->bytes_per_frame;
542 GST_DEBUG ("%.3f scale, %.3f stride_in, %i stride_out", priv->scale,
543 priv->frames_stride_scaled,
544 (gint) (priv->bytes_stride / priv->bytes_per_frame));
546 priv->bytes_to_slide = 0;
550 if (priv->scale != 1.0) {
551 priv->segment_start = start;
552 applied_rate = priv->scale;
554 //gst_event_unref (event);
557 stop = (stop - start) / applied_rate + start;
560 event = gst_event_new_new_segment_full (update, rate, applied_rate,
561 format, start, stop, position);
562 gst_pad_push_event (GST_BASE_TRANSFORM_SRC_PAD (trans), event);
566 return parent_class->event (trans, event);
570 gst_scaletempo_set_caps (GstBaseTransform * trans,
571 GstCaps * incaps, GstCaps * outcaps)
573 GstScaletempo *scaletempo = GST_SCALETEMPO (trans);
574 GstScaletempoPrivate *priv = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
575 GstStructure *s = gst_caps_get_structure (incaps, 0);
577 gint width, bps, nch, rate;
579 const gchar *type = gst_structure_get_name (s);
580 if (g_str_equal (type, "audio/x-raw-int")) {
582 gst_structure_get_int (s, "depth", &width);
583 } else if (g_str_equal (type, "audio/x-raw-float")) {
585 gst_structure_get_int (s, "width", &width);
591 gst_structure_get_int (s, "channels", &nch);
592 gst_structure_get_int (s, "rate", &rate);
594 GST_DEBUG ("caps: %s seek, "
595 "%5" G_GUINT32_FORMAT " rate, "
596 "%2" G_GUINT32_FORMAT " nch, "
597 "%2" G_GUINT32_FORMAT " bps", type, rate, nch, bps);
599 if (rate != priv->sample_rate
600 || nch != priv->samples_per_frame
601 || bps != priv->bytes_per_sample || use_int != priv->use_int) {
602 priv->sample_rate = rate;
603 priv->samples_per_frame = nch;
604 priv->bytes_per_sample = bps;
605 priv->bytes_per_frame = nch * bps;
606 priv->use_int = use_int;
607 priv->reinit_buffers = TRUE;
614 /* GObject vmethod implementations */
616 gst_scaletempo_get_property (GObject * object,
617 guint prop_id, GValue * value, GParamSpec * pspec)
619 GstScaletempo *scaletempo = GST_SCALETEMPO (object);
620 GstScaletempoPrivate *priv = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
624 g_value_set_double (value, priv->scale);
627 g_value_set_uint (value, priv->ms_stride);
630 g_value_set_double (value, priv->percent_overlap);
633 g_value_set_uint (value, priv->ms_search);
636 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
642 gst_scaletempo_set_property (GObject * object,
643 guint prop_id, const GValue * value, GParamSpec * pspec)
645 GstScaletempo *scaletempo = GST_SCALETEMPO (object);
646 GstScaletempoPrivate *priv = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
650 guint new_value = g_value_get_uint (value);
651 if (priv->ms_stride != new_value) {
652 priv->ms_stride = new_value;
653 priv->reinit_buffers = TRUE;
658 gdouble new_value = g_value_get_double (value);
659 if (priv->percent_overlap != new_value) {
660 priv->percent_overlap = new_value;
661 priv->reinit_buffers = TRUE;
666 guint new_value = g_value_get_uint (value);
667 if (priv->ms_search != new_value) {
668 priv->ms_search = new_value;
669 priv->reinit_buffers = TRUE;
674 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
680 gst_scaletempo_base_init (gpointer klass)
683 GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
685 gst_element_class_add_static_pad_template (element_class, &src_template);
686 gst_element_class_add_static_pad_template (element_class,
688 gst_element_class_set_details_simple (element_class, "Scaletempo",
689 "Filter/Effect/Rate",
690 "Sync audio tempo with playback rate",
691 "Rov Juvano <rovjuvano@users.sourceforge.net>");
695 gst_scaletempo_class_init (GstScaletempoClass * klass)
697 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
698 GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass);
700 g_type_class_add_private (klass, sizeof (GstScaletempoPrivate));
702 gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_scaletempo_get_property);
703 gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_scaletempo_set_property);
705 g_object_class_install_property (gobject_class, PROP_RATE,
706 g_param_spec_double ("rate", "Playback Rate", "Current playback rate",
707 G_MININT, G_MAXINT, 1.0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
709 g_object_class_install_property (gobject_class, PROP_STRIDE,
710 g_param_spec_uint ("stride", "Stride Length",
711 "Length in milliseconds to output each stride", 1, 5000, 30,
712 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
714 g_object_class_install_property (gobject_class, PROP_OVERLAP,
715 g_param_spec_double ("overlap", "Overlap Length",
716 "Percentage of stride to overlap", 0, 1, .2,
717 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
719 g_object_class_install_property (gobject_class, PROP_SEARCH,
720 g_param_spec_uint ("search", "Search Length",
721 "Length in milliseconds to search for best overlap position", 0, 500,
722 14, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
724 basetransform_class->event = GST_DEBUG_FUNCPTR (gst_scaletempo_sink_event);
725 basetransform_class->set_caps = GST_DEBUG_FUNCPTR (gst_scaletempo_set_caps);
726 basetransform_class->transform_size =
727 GST_DEBUG_FUNCPTR (gst_scaletempo_transform_size);
728 basetransform_class->transform = GST_DEBUG_FUNCPTR (gst_scaletempo_transform);
732 gst_scaletempo_init (GstScaletempo * scaletempo, GstScaletempoClass * klass)
734 GstScaletempoPrivate *priv = GST_SCALETEMPO_GET_PRIVATE (scaletempo);
736 priv->ms_stride = 30;
737 priv->percent_overlap = .2;
738 priv->ms_search = 14;
742 priv->sample_rate = 0;
743 priv->frames_stride_error = 0;
744 priv->bytes_stride = 0;
745 priv->bytes_queued = 0;
746 priv->bytes_to_slide = 0;
747 priv->segment_start = 0;