Re: [LAD] Zita Resampler unexpected output

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-dev@...>
Date: Wednesday, February 12, 2014 - 9:22 pm

On Wed, Feb 12, 2014 at 06:29:24PM -0200, André Garnier Coutinho wrote:

> I'm attaching the code that I wrote, I would be very happy if anyone could

#ifdef TRY1
int z1 = over.inpsize()/2 - 1;
int z2 = over.inpsize()/2;

over.inp_count = z1;
over.inp_data = 0;
over.out_count = n_samples * n_over;
over.out_data = buffer_over;
over.process ();

over.inp_count = n_samples;
over.inp_data = buffer;

// The following line is not necessary, but it doesn't
// harm since no output samples have been produced yet.
// If you keep this line, it would be logical to write
// 'out_count' as well. But neither is necessary.
over.out_data = buffer_over;

over.process();

over.inp_count = z2;
over.inp_data = 0;

// This is wrong: you _overwrite_ the samples already
// output. Just delete this line.
over.out_data = buffer_over;

over.process ();
#endif

With the line indicated above deleted you will get the
correct output. The strange looking transient at the end
*is* correct, you get this because the input signal stops
with a sharp step. The 'ringing' is just the result of
the bandwidth being lower than Fs_out / 2.

Note: process() modifies 'inp_data' and 'out_data'. On
return both will point to the first unused sample. If
either buffer is not fully used, you can just continue
with it for the next process(). Or you can provide a
new one, that's up to you. But if you reset the output
buffer as you did, you need of course to read it first.

Ciao,

--
FA

A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAD] Zita Resampler unexpected output, André Garnier Coutinho, (Fri Feb 7, 10:26 pm)
Re: [LAD] Zita Resampler unexpected output, Robin Gareus, (Fri Feb 7, 10:49 pm)
Re: [LAD] Zita Resampler unexpected output, Robin Gareus, (Fri Feb 7, 11:01 pm)
Re: [LAD] Zita Resampler unexpected output, Fons Adriaensen, (Fri Feb 7, 11:50 pm)
Re: [LAD] Zita Resampler unexpected output, André Garnier Coutinho, (Wed Feb 12, 8:29 pm)
Re: [LAD] Zita Resampler unexpected output, Fons Adriaensen, (Wed Feb 12, 9:22 pm)
Re: [LAD] Zita Resampler unexpected output, Robin Gareus, (Wed Feb 12, 8:34 pm)
Re: [LAD] Zita Resampler unexpected output, Fons Adriaensen, (Wed Feb 12, 8:40 pm)
Re: [LAD] Zita Resampler unexpected output, Robin Gareus, (Wed Feb 12, 8:37 pm)
Re: [LAD] Zita Resampler unexpected output, Fons Adriaensen, (Wed Feb 12, 9:25 pm)
Re: [LAD] Zita Resampler unexpected output, Jörn Nettingsmeier, (Thu Feb 13, 4:25 pm)
Re: [LAD] Zita Resampler unexpected output, Fons Adriaensen, (Thu Feb 13, 5:53 pm)
Re: [LAD] Zita Resampler unexpected output, André Garnier Coutinho, (Thu Feb 13, 3:33 pm)
Re: [LAD] Zita Resampler unexpected output, Fons Adriaensen, (Thu Feb 13, 7:19 pm)
Re: [LAD] Zita Resampler unexpected output, André Garnier Coutinho, (Fri Feb 14, 6:26 pm)