romain-pattyn / FAUST-FrequencyResponseTracer

A Faust function and a python script that traces the frequency response of any Faust-implemented filter.
1 stars 0 forks source link

Could frequencyResponse function be contributed to Faust libraries ? #1

Open sletz opened 3 years ago

sletz commented 3 years ago

The Faust analyzers.lib library contains a bunch a analysis functions. Could the frequencyResponse function be contributed to it?

romain-pattyn commented 3 years ago

Hello, yes of course, I would be proud to make a contribution to the Faust language. I remember seeing a long time ago somewhere on the Faust website, the template that must be followed in order to make a contribution, but I didn't manage to find it back. If you could give me a link to that webpage, I would be happy to make everything needed for it to be added to the Faust analyzers.lib library.

sletz commented 3 years ago

Thanks for your answer. In the meantime I asked @josmithiii about his advice on the subject, here are his answers:


I think something like that could be nice to have, but I would break it up into useful pieces and have a demo show how to use it, etc. It would be nice to have the sine-sweep test, for example.

I already do frequency-response analysis with less work using faust2octave followed by an fft. They are only doing a sine sweep, and losing phase information, so it's not technically a frequency-response measurement or display.

Maybe there needs to be a tutorial on measuring frequency response? My own coverage is in the 2nd and 3rd pages of this:

https://ccrma.stanford.edu/~jos/aspf/Verifying_Testing_FAUST_Programs.html


Then another one:


P.S. Here would be my answer to frequencyReponseTester (attached)

faust2octave irt.dsp

(then take the fft in Octave as I documented)

import("stdfaust.lib");

impulseResponse(bd) = 1-1' : bd;

//--------------------`Example of Use`----------------
//
// The impulse response tracer is applied to various filters available in the FAUST library.
//
//-------------------------------------------------------------------------------------------

// High shelf with bit of resonance in the low frequencies
highShelf(f) = fi.highshelf(5, -6, f);

// Simple peakEQ
peakEQ(f) = fi.peak_eq(2, f, 500);

// Also in highpass an bandpass: resonhp and resonbp (Remark : the bandpass version is like a peakEQ with the gain at zero for ther frequencies that the one wanted. So it's not possible to actually produce a band between two frequencies. See fi.bandpass)
resonanceLowPass(f) = fi.resonlp(f, 1, 1);

lowPassSimple(f) = fi.lowpass(5, f); // A little bit more vertical than lowpass3e but the impulse parameter isn't at the top of the curve, it is at -3dB.
lowPassAdvanced(f) = fi.lowpass6e(f); // Also highpass : highpass6e (Both available in 3th order which make the cut less vertical)

// Also available in bandstop
butterworthBandpass(nH, fl, fu) = fi.bandpass(nH, fl, fu); // Increasing nH makes the cut more vertical.
ellipticBandPass(fl, fu) = fi.bandpass12e(fl, fu);

process =   impulseResponse(highShelf(1000)),
            impulseResponse(peakEQ(2000)),
            impulseResponse(resonanceLowPass(3000)),
            impulseResponse(lowPassSimple(6000)),
            impulseResponse(lowPassAdvanced(7500)),
            impulseResponse(butterworthBandpass(2, 10000, 13000)),
            impulseResponse(butterworthBandpass(6, 10000, 13000)),
            impulseResponse(ellipticBandPass(10000, 13000));

irt

Then I suggest discussion continuing here to see if a contribution to the libraries finally makes sense ?

josmithiii commented 3 years ago

That looks nice!

On Thu, Jul 29, 2021 at 3:20 AM Stéphane Letz @.***> wrote:

Thanks for your answer. In the meantime I asked @josmithiii https://github.com/josmithiii about his advice an on the subject, here are his answers:

I think something like that could be nice to have, but I would break it up into useful pieces and have a demo show how to use it, etc. It would be nice to have the sine-sweep test, for example.

I already do frequency-response analysis with less work using faust2octave followed by an fft. They are only doing a sine sweep, and losing phase information, so it's not technically a frequency-response measurement or display.

Maybe there needs to be a tutorial on measuring frequency response? My own coverage is in the 2nd and 3rd pages of this:

https://ccrma.stanford.edu/~jos/aspf/Verifying_Testing_FAUST_Programs.html

Then another one:

P.S. Here would be my answer to frequencyReponseTester (attached)

faust2octave irt.dsp

(then take the fft in Octave as I documented)

import("stdfaust.lib");

impulseResponse(bd) = 1-1' : bd;

//--------------------Example of Use---------------- // // The impulse response tracer is applied to various filters available in the FAUST library. // //-------------------------------------------------------------------------------------------

// High shelf with bit of resonance in the low frequencies highShelf(f) = fi.highshelf(5, -6, f);

// Simple peakEQ peakEQ(f) = fi.peak_eq(2, f, 500);

// Also in highpass an bandpass: resonhp and resonbp (Remark : the bandpass version is like a peakEQ with the gain at zero for ther frequencies that the one wanted. So it's not possible to actually produce a band between two frequencies. See fi.bandpass) resonanceLowPass(f) = fi.resonlp(f, 1, 1);

lowPassSimple(f) = fi.lowpass(5, f); // A little bit more vertical than lowpass3e but the impulse parameter isn't at the top of the curve, it is at -3dB. lowPassAdvanced(f) = fi.lowpass6e(f); // Also highpass : highpass6e (Both available in 3th order which make the cut less vertical)

// Also available in bandstop butterworthBandpass(nH, fl, fu) = fi.bandpass(nH, fl, fu); // Increasing nH makes the cut more vertical. ellipticBandPass(fl, fu) = fi.bandpass12e(fl, fu);

process = impulseResponse(highShelf(1000)), impulseResponse(peakEQ(2000)), impulseResponse(resonanceLowPass(3000)), impulseResponse(lowPassSimple(6000)), impulseResponse(lowPassAdvanced(7500)), impulseResponse(butterworthBandpass(2, 10000, 13000)), impulseResponse(butterworthBandpass(6, 10000, 13000)), impulseResponse(ellipticBandPass(10000, 13000));

[image: irt] https://user-images.githubusercontent.com/1430487/127474990-70520ab8-2dc4-4be8-aa37-e6fae4b9d71b.jpg

Then I suggest discussion continuing here to see if a contribution to the libraries finally makes sense ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/romain-pattyn/FAUST-FrequencyResponseTracer/issues/1#issuecomment-888995491, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQZKFNNASY3QJUKQGBIILLT2ETOXANCNFSM46TBMW7A .

-- Julius O. Smith III @.***> Professor of Music and, by courtesy, Electrical Engineering CCRMA, Stanford University http://ccrma.stanford.edu/~jos/

sletz commented 3 years ago

So @josmithiii do you think some new analysis fonction should be added ?

josmithiii commented 3 years ago

I guess it could make sense to provide a script, say "faust2spectrumdisplay" or the like

On Thu, Jul 29, 2021 at 11:46 AM Stéphane Letz @.***> wrote:

So @josmithiii https://github.com/josmithiii do you think some new analysis fonction should be added ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/romain-pattyn/FAUST-FrequencyResponseTracer/issues/1#issuecomment-889376560, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQZKFJJHUHPINM6PJGTUXDT2GOZPANCNFSM46TBMW7A .

-- Julius O. Smith III @.***> Professor of Music and, by courtesy, Electrical Engineering CCRMA, Stanford University http://ccrma.stanford.edu/~jos/