Re: [LAD] Zita Resampler unexpected output
Thank you very much, guys You really helped a lot =) greets 2014-02-13 17:19 GMT-02:00 Fons Adriaensen : > On Thu, Feb 13, 2014 at 01:32:47PM -0200, André Garnier Coutinho wrote: > > > I have only one doubt: will this little 'transient' disturb the result > if I > > use it for a real-time application, like a lv2 distortion plugin? > > No, why should it ? It's the correct result, not some error. > > Going back to the original message: there is really *no point* > in doing the resampling in double precision. It won't be 'better'. > And if your intent is to generate distortion it makes even less > sense. > > 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 > ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] Zita Resampler unexpected output
On Thu, Feb 13, 2014 at 01:32:47PM -0200, André Garnier Coutinho wrote: > I have only one doubt: will this little 'transient' disturb the result if I > use it for a real-time application, like a lv2 distortion plugin? No, why should it ? It's the correct result, not some error. Going back to the original message: there is really *no point* in doing the resampling in double precision. It won't be 'better'. And if your intent is to generate distortion it makes even less sense. 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
Re: [LAD] Zita Resampler unexpected output
On Thu, Feb 13, 2014 at 05:24:52PM +0100, Jörn Nettingsmeier wrote: > On 02/12/2014 10:25 PM, Fons Adriaensen wrote: > >On Wed, Feb 12, 2014 at 09:37:01PM +0100, Robin Gareus wrote: > > > >>/me crawls back under his stone. > > > >(C) stackingdwarves.net IIRC :-) > > you mean i own the rights to being stupid in public? > > wow, i'll be rich as standard oil :-D > > cue evil laugh with cheesy reverb IIRC, you tend to use this phrase on the sursound list, after having stated your (possibly controversial) opinion in very clear terms :-) 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
Re: [LAD] Zita Resampler unexpected output
On 02/12/2014 10:25 PM, Fons Adriaensen wrote: On Wed, Feb 12, 2014 at 09:37:01PM +0100, Robin Gareus wrote: /me crawls back under his stone. (C) stackingdwarves.net IIRC :-) you mean i own the rights to being stupid in public? wow, i'll be rich as standard oil :-D cue evil laugh with cheesy reverb -- Jörn Nettingsmeier Lortzingstr. 11, 45128 Essen, Tel. +49 177 7937487 Meister für Veranstaltungstechnik (Bühne/Studio) Tonmeister VDT http://stackingdwarves.net ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] Zita Resampler unexpected output
Thank you very much, guys, you helped a lot. Now it's working well, with the little 'transient' at the end. I have only one doubt: will this little 'transient' disturb the result if I use it for a real-time application, like a lv2 distortion plugin? greets 2014-02-12 19:25 GMT-02:00 Fons Adriaensen : > On Wed, Feb 12, 2014 at 09:37:01PM +0100, Robin Gareus wrote: > > > /me crawls back under his stone. > > (C) stackingdwarves.net IIRC :-) > > -- > 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 > ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] Zita Resampler unexpected output
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 > say what I am doing wrong. #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
Re: [LAD] Zita Resampler unexpected output
On Wed, Feb 12, 2014 at 09:37:01PM +0100, Robin Gareus wrote: > /me crawls back under his stone. (C) stackingdwarves.net IIRC :-) -- 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
Re: [LAD] Zita Resampler unexpected output
On Wed, Feb 12, 2014 at 09:34:14PM +0100, Robin Gareus wrote: > On 02/12/2014 09:29 PM, André Garnier Coutinho wrote: > [..] > > over.inp_data = 0; > [..] > > You cannot use a NULL pointer. It needs to point to an array filled with > zeroes. Wrong, you *can* use a NULL pointer. TRY1 _looks_ OK to me, I'll try it myself and report back. -- 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
Re: [LAD] Zita Resampler unexpected output
On 02/12/2014 09:34 PM, Robin Gareus wrote: > On 02/12/2014 09:29 PM, André Garnier Coutinho wrote: > [..] >> over.inp_data = 0; > [..] > > You cannot use a NULL pointer. It needs to point to an array filled with > zeroes. mmh. I'm sorry. I was too quck and wrong, again :( zita-resampler-1.3.0/libs/resampler.cc:193 does catch that. /me crawls back under his stone. ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] Zita Resampler unexpected output
On 02/12/2014 09:29 PM, André Garnier Coutinho wrote: [..] > over.inp_data = 0; [..] You cannot use a NULL pointer. It needs to point to an array filled with zeroes. ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] Zita Resampler unexpected output
Hey guys, I've read the API documentation and I realize that I wasn't completing the input buffer with some zeros. So, I tried to add those zeros, but I'm still having an unexpected output. I'm attaching the code that I wrote, I would be very happy if anyone could say what I am doing wrong. greets, André 2014-02-07 21:50 GMT-02:00 Fons Adriaensen : > On Sat, Feb 08, 2014 at 12:00:56AM +0100, Robin Gareus wrote: > > > I'm sorry. It turns out, I only got this half right (wrong number of > > samples to line things up). Just read the API documenation, explains it > > all: > > > http://kokkinizita.linuxaudio.org/linuxaudio/zita-resampler/resampler.html > > I've just updated this with the latest version (which comes > with the sources as well). > > Indeed, the API documentation explains it all. > > 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 > #include #include #include #include #include #include #include "resampler.h" #define TRY1 //#define TRY2 //#define TRY3 using namespace std; typedef float sample_t; int main(void) { cout << "OverSample Test" << endl; const uint32_t samplerate = 44100, n_over = 2; const uint32_t n_samples = 256; sample_t *buffer, *buffer_over, freq_Hz = 1000; buffer = (sample_t *) malloc(sizeof(sample_t) * n_samples); buffer_over = (sample_t *) malloc(sizeof(sample_t) * n_samples * n_over); //SinWave for (uint32_t i = 0; i< n_samples ; i++) { buffer[i] = sin(2*M_PI*freq_Hz*i/samplerate); } for (uint32_t i = 0; i___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] Zita Resampler unexpected output
On Sat, Feb 08, 2014 at 12:00:56AM +0100, Robin Gareus wrote: > I'm sorry. It turns out, I only got this half right (wrong number of > samples to line things up). Just read the API documenation, explains it > all: > http://kokkinizita.linuxaudio.org/linuxaudio/zita-resampler/resampler.html I've just updated this with the latest version (which comes with the sources as well). Indeed, the API documentation explains it all. 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
Re: [LAD] Zita Resampler unexpected output
On 02/07/2014 11:49 PM, Robin Gareus wrote: >> I'm attaching my code. > > I'm attaching a quick diff :) I'm sorry. It turns out, I only got this half right (wrong number of samples to line things up). Just read the API documenation, explains it all: http://kokkinizita.linuxaudio.org/linuxaudio/zita-resampler/resampler.html ciao, robin ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] Zita Resampler unexpected output
On 02/07/2014 11:26 PM, André Garnier Coutinho wrote: > Hi Guys! > > I was doing some tests to learn how to use zita resampler and I got an > unexpected output. All the last positions of my output vector were 0 and I > don't know why. > [..] > Does anyone know what I am doing wrong? Fons may have a detailed explanation. In code where I use zita-resampler I do initially feed it with a cycle of zeroes. Doing the same fixes the behaviour in your code. see also /apps/zresample.cc it also has a // Insert zero samples at start. > I'm attaching my code. I'm attaching a quick diff :) Cheers! robin PS. over.setup(..., 16) is rather poor quality. --- a/main.cpp 2014-02-07 23:38:34.479692524 +0100 +++ b/main.cpp 2014-02-07 23:47:45.346424129 +0100 @@ -34,8 +34,22 @@ cout << "buffer[" << i << "] = " << buffer[i] << endl; } + Resampler over; over.setup(samplerate, n_over*samplerate, 1, 16); + + /* initialize resampler */ +#define RSZ_INIT_SIZE (n_samples) + float *zeroes = (float*) calloc(RSZ_INIT_SIZE, sizeof(float)); + float *scratch = (float*) calloc(n_over * RSZ_INIT_SIZE, sizeof(float)); + over.inp_count = RSZ_INIT_SIZE; + over.inp_data = zeroes; + over.out_count = RSZ_INIT_SIZE * n_over; + over.out_data = scratch; + over.process (); + free(zeroes); + free(scratch); + over.inp_count = n_samples; over.out_count = n_samples*n_over; over.inp_data = buffer; ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev