spandsp 3.0.0
private/time_scale.h
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * private/time_scale.h - Time scaling for linear speech data
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2004 Steve Underwood
9 *
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 2.1,
14 * as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#if !defined(_SPANDSP_PRIVATE_TIME_SCALE_H_)
27#define _SPANDSP_PRIVATE_TIME_SCALE_H_
28
29#define TIME_SCALE_MAX_SAMPLE_RATE 48000
30#define TIME_SCALE_MIN_PITCH 60
31#define TIME_SCALE_MAX_PITCH 250
32#define TIME_SCALE_BUF_LEN (2*TIME_SCALE_MAX_SAMPLE_RATE/TIME_SCALE_MIN_PITCH)
33
34/*! Audio time scaling descriptor. */
36{
37 /*! \brief The sample rate of both the incoming and outgoing signal */
39 /*! \brief The minimum pitch we will search for, in samples per cycle */
41 /*! \brief The maximum pitch we will search for, in samples per cycle */
43 /*! \brief The playout speed, as the fraction output time/input time.
44 (i.e. >1.0 == slow down, 1.0 == no speed change, <1.0 == speed up) */
46 /*! \brief */
47 double rcomp;
48 /*! \brief The fractional sample adjustment, to allow for non-integer values of lcp. */
49 double rate_nudge;
50 /*! \brief */
51 int lcp;
52 /*! \brief The active length of buf at the current sample rate. */
54 /*! \brief The number of samples in buf */
55 int fill;
56 /*! \brief Buffer for residual samples kept over from one call of time_scale() to
57 the next. */
58 int16_t buf[TIME_SCALE_BUF_LEN];
59};
60
61#endif
62/*- End of file ------------------------------------------------------------*/
Definition private/time_scale.h:36
int min_pitch
The minimum pitch we will search for, in samples per cycle.
Definition private/time_scale.h:40
int buf_len
The active length of buf at the current sample rate.
Definition private/time_scale.h:53
double rate_nudge
The fractional sample adjustment, to allow for non-integer values of lcp.
Definition private/time_scale.h:49
int fill
The number of samples in buf.
Definition private/time_scale.h:55
int16_t buf[(2 *48000/60)]
Buffer for residual samples kept over from one call of time_scale() to the next.
Definition private/time_scale.h:58
float playout_rate
The playout speed, as the fraction output time/input time. (i.e. >1.0 == slow down,...
Definition private/time_scale.h:45
int sample_rate
The sample rate of both the incoming and outgoing signal.
Definition private/time_scale.h:38
int max_pitch
The maximum pitch we will search for, in samples per cycle.
Definition private/time_scale.h:42