Lines Matching full:echo

1 /* libSoX Echo effect             August 24, 1998
30 * echo gain-in gain-out delay-1 decay-1 [delay-2 decay-2 ... delay-n decay-n]
72 priv_t * echo = (priv_t *) effp->priv; in sox_echo_getopts() local
76 echo->num_delays = 0; in sox_echo_getopts()
82 sscanf(argv[i++], "%f", &echo->in_gain); in sox_echo_getopts()
83 sscanf(argv[i++], "%f", &echo->out_gain); in sox_echo_getopts()
85 if ( echo->num_delays >= MAX_ECHOS ) in sox_echo_getopts()
86 lsx_fail("echo: to many delays, use less than %i delays", in sox_echo_getopts()
89 sscanf(argv[i++], "%f", &echo->delay[echo->num_delays]); in sox_echo_getopts()
90 sscanf(argv[i++], "%f", &echo->decay[echo->num_delays]); in sox_echo_getopts()
91 echo->num_delays++; in sox_echo_getopts()
101 priv_t * echo = (priv_t *) effp->priv; in sox_echo_start() local
106 echo->maxsamples = 0; in sox_echo_start()
107 if ( echo->in_gain < 0.0 ) in sox_echo_start()
109 lsx_fail("echo: gain-in must be positive!"); in sox_echo_start()
112 if ( echo->in_gain > 1.0 ) in sox_echo_start()
114 lsx_fail("echo: gain-in must be less than 1.0!"); in sox_echo_start()
117 if ( echo->out_gain < 0.0 ) in sox_echo_start()
119 lsx_fail("echo: gain-in must be positive!"); in sox_echo_start()
122 for ( i = 0; i < echo->num_delays; i++ ) { in sox_echo_start()
123 echo->samples[i] = echo->delay[i] * effp->in_signal.rate / 1000.0; in sox_echo_start()
124 if ( echo->samples[i] < 1 ) in sox_echo_start()
126 lsx_fail("echo: delay must be positive!"); in sox_echo_start()
129 if ( echo->samples[i] > (ptrdiff_t)DELAY_BUFSIZ ) in sox_echo_start()
131 lsx_fail("echo: delay must be less than %g seconds!", in sox_echo_start()
135 if ( echo->decay[i] < 0.0 ) in sox_echo_start()
137 lsx_fail("echo: decay must be positive!" ); in sox_echo_start()
140 if ( echo->decay[i] > 1.0 ) in sox_echo_start()
142 lsx_fail("echo: decay must be less than 1.0!" ); in sox_echo_start()
145 if ( echo->samples[i] > echo->maxsamples ) in sox_echo_start()
146 echo->maxsamples = echo->samples[i]; in sox_echo_start()
148 echo->delay_buf = lsx_malloc(sizeof (double) * echo->maxsamples); in sox_echo_start()
149 for ( j = 0; j < echo->maxsamples; ++j ) in sox_echo_start()
150 echo->delay_buf[j] = 0.0; in sox_echo_start()
153 for ( i = 0; i < echo->num_delays; i++ ) in sox_echo_start()
154 sum_in_volume += echo->decay[i]; in sox_echo_start()
155 if ( sum_in_volume * echo->in_gain > 1.0 / echo->out_gain ) in sox_echo_start()
156 lsx_warn("echo: warning >>> gain-out can cause saturation of output <<<"); in sox_echo_start()
157 echo->counter = 0; in sox_echo_start()
158 echo->fade_out = echo->maxsamples; in sox_echo_start()
172 priv_t * echo = (priv_t *) effp->priv; in sox_echo_flow() local
183 d_out = d_in * echo->in_gain; in sox_echo_flow()
184 for ( j = 0; j < echo->num_delays; j++ ) { in sox_echo_flow()
185 d_out += echo->delay_buf[ in sox_echo_flow()
186 (echo->counter + echo->maxsamples - echo->samples[j]) % echo->maxsamples] in sox_echo_flow()
187 * echo->decay[j]; in sox_echo_flow()
190 d_out = d_out * echo->out_gain; in sox_echo_flow()
194 echo->delay_buf[echo->counter] = d_in; in sox_echo_flow()
196 echo->counter = ( echo->counter + 1 ) % echo->maxsamples; in sox_echo_flow()
207 priv_t * echo = (priv_t *) effp->priv; in sox_echo_drain() local
215 while ( ( done < *osamp ) && ( done < echo->fade_out ) ) { in sox_echo_drain()
218 for ( j = 0; j < echo->num_delays; j++ ) { in sox_echo_drain()
219 d_out += echo->delay_buf[ in sox_echo_drain()
220 (echo->counter + echo->maxsamples - echo->samples[j]) % echo->maxsamples] in sox_echo_drain()
221 * echo->decay[j]; in sox_echo_drain()
224 d_out = d_out * echo->out_gain; in sox_echo_drain()
228 echo->delay_buf[echo->counter] = d_in; in sox_echo_drain()
230 echo->counter = ( echo->counter + 1 ) % echo->maxsamples; in sox_echo_drain()
232 echo->fade_out--; in sox_echo_drain()
236 if (echo->fade_out == 0) in sox_echo_drain()
244 priv_t * echo = (priv_t *) effp->priv; in sox_echo_stop() local
246 free(echo->delay_buf); in sox_echo_stop()
247 echo->delay_buf = NULL; in sox_echo_stop()
252 "echo",