[Signal PKG] limited slope

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

[Signal PKG] limited slope

yamane
Hi,

Regarding the code below, someone have an idea why I have this limit
in low frequencies?

Please, see the frequency response on image available in: https://ibb.co/cgwOqG

Detail: when I use a crest factor of 12dB instead 6dB, I don´t have
this problem.

==============
pkg load signal;
pkg load ltfat;

sampling_rate = 44100;
lenght = 30;
hpf = 400;
lpf = 4000;
crest_factor = 6;

typenoise = noise((lenght)*sampling_rate, 1, 'pink');
[b,a] = butter(2, [hpf/(sampling_rate/2), lpf/(sampling_rate/2)]);
filtered = filter(b, a, typenoise);
filtered = filtered / (rms(filtered) / 10^(-crest_factor/20));
audiowrite ('signal.wav', filtered, 44100);
==============

Best regards,
Renato

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

Maynard Wright
On Thursday, December 14, 2017 08:39:08 AM Renato S. Yamane wrote:

> Hi,
>
> Regarding the code below, someone have an idea why I have this limit
> in low frequencies?
>
> Please, see the frequency response on image available in:
> https://ibb.co/cgwOqG
>
> Detail: when I use a crest factor of 12dB instead 6dB, I don´t have
> this problem.
>
> ==============
> pkg load signal;
> pkg load ltfat;
>
> sampling_rate = 44100;
> lenght = 30;
> hpf = 400;
> lpf = 4000;
> crest_factor = 6;
>
> typenoise = noise((lenght)*sampling_rate, 1, 'pink');
> [b,a] = butter(2, [hpf/(sampling_rate/2), lpf/(sampling_rate/2)]);
> filtered = filter(b, a, typenoise);
> filtered = filtered / (rms(filtered) / 10^(-crest_factor/20));
> audiowrite ('signal.wav', filtered, 44100);
> ==============
>
> Best regards,
> Renato
>

At first glance, I notice that "length" is misspelled as "lenght" in the
function noise().

Best regards,

Maynard


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

yamane
2017-12-14 14:41 GMT+01:00 Maynard Wright <[hidden email]>:
> On Thursday, December 14, 2017 08:39:08 AM Renato S. Yamane wrote:
>>
>> Regarding the code below, someone have an idea why I have this limit
>> in low frequencies?
>>
>> [...]
>
> At first glance, I notice that "length" is misspelled as "lenght" in the
> function noise().

But, of course, this is not the problem...
You can write it even as "lengghhttyy" if it's defined in the
beggining of the code.

Thanks,
Renato

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

Maynard Wright
On Thursday, December 14, 2017 03:25:47 PM Renato S. Yamane wrote:

> 2017-12-14 14:41 GMT+01:00 Maynard Wright <[hidden email]>:
> > On Thursday, December 14, 2017 08:39:08 AM Renato S. Yamane wrote:
> >> Regarding the code below, someone have an idea why I have this limit
> >> in low frequencies?
> >>
> >> [...]
> >
> > At first glance, I notice that "length" is misspelled as "lenght" in the
> > function noise().
>
> But, of course, this is not the problem...
> You can write it even as "lengghhttyy" if it's defined in the
> beggining of the code.
>
> Thanks,
> Renato

True: maybe it's just the proofreader coming out in me.

Thanks,

Maynard



_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

Robert T. Short
In reply to this post by yamane
On 12/13/2017 11:39 PM, Renato S. Yamane wrote:

> Hi,
>
> Regarding the code below, someone have an idea why I have this limit
> in low frequencies?
>
> Please, see the frequency response on image available in: https://ibb.co/cgwOqG
>
> Detail: when I use a crest factor of 12dB instead 6dB, I don´t have
> this problem.
>
> ==============
> pkg load signal;
> pkg load ltfat;
>
> sampling_rate = 44100;
> lenght = 30;
> hpf = 400;
> lpf = 4000;
> crest_factor = 6;
>
> typenoise = noise((lenght)*sampling_rate, 1, 'pink');
> [b,a] = butter(2, [hpf/(sampling_rate/2), lpf/(sampling_rate/2)]);
> filtered = filter(b, a, typenoise);
> filtered = filtered / (rms(filtered) / 10^(-crest_factor/20));
> audiowrite ('signal.wav', filtered, 44100);
> ==============
>
> Best regards,
> Renato
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/help-octave

I don't get the same spectral plots you show here.  My results are much
more like your "expected" slope.


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

Maynard Wright
In reply to this post by Maynard Wright
On Thursday, December 14, 2017 07:42:28 AM Maynard Wright wrote:

> On Thursday, December 14, 2017 03:25:47 PM Renato S. Yamane wrote:
> > 2017-12-14 14:41 GMT+01:00 Maynard Wright <[hidden email]>:
> > > On Thursday, December 14, 2017 08:39:08 AM Renato S. Yamane wrote:
> > >> Regarding the code below, someone have an idea why I have this limit
> > >> in low frequencies?
> > >>
> > >> [...]
> > >
> > > At first glance, I notice that "length" is misspelled as "lenght" in the
> > > function noise().
> >
> > But, of course, this is not the problem...
> > You can write it even as "lengghhttyy" if it's defined in the
> > beggining of the code.
> >
> > Thanks,
> > Renato
>
> True: maybe it's just the proofreader coming out in me.
>
> Thanks,
>
> Maynard
>

I suppose that I get concerned that the code might later be turned into a
function or imported into a longer program in which the call is made with the
correct spelling.   Happened to me once, years ago.   Not usually hard to find,
but exasperating when you're trying to concentrate on making things work.

Regards,

Maynard



_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

yamane
In reply to this post by Robert T. Short
2017-12-14 20:25 GMT+01:00 Robert T. Short <[hidden email]>:

> On 12/13/2017 11:39 PM, Renato S. Yamane wrote:
>> Regarding the code below, someone have an idea why I have this limit
>> in low frequencies?
>>
>> Please, see the frequency response on image available in:
>> https://ibb.co/cgwOqG
>>
>> Detail: when I use a crest factor of 12dB instead 6dB, I don´t have
>> this problem.
>>
>> ==============
>> pkg load signal;
>> pkg load ltfat;
>>
>> sampling_rate = 44100;
>> lenght = 30;
>> hpf = 400;
>> lpf = 4000;
>> crest_factor = 6;
>>
>> typenoise = noise((lenght)*sampling_rate, 1, 'pink');
>> [b,a] = butter(2, [hpf/(sampling_rate/2), lpf/(sampling_rate/2)]);
>> filtered = filter(b, a, typenoise);
>> filtered = filtered / (rms(filtered) / 10^(-crest_factor/20));
>> audiowrite ('signal.wav', filtered, 44100);
>> ==============
>
>
> I don't get the same spectral plots you show here.  My results are much more
> like your "expected" slope.
>

Wowww!
Can you tell me how you plot it? Just to be possible I make the same
check here in my side...

Thanks,
Renato

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

Robert T. Short
On 12/15/2017 12:27 AM, Renato S. Yamane wrote:

> 2017-12-14 20:25 GMT+01:00 Robert T. Short <[hidden email]>:
>> On 12/13/2017 11:39 PM, Renato S. Yamane wrote:
>>> Regarding the code below, someone have an idea why I have this limit
>>> in low frequencies?
>>>
>>> Please, see the frequency response on image available in:
>>> https://ibb.co/cgwOqG
>>>
>>> Detail: when I use a crest factor of 12dB instead 6dB, I don´t have
>>> this problem.
>>>
>>> ==============
>>> pkg load signal;
>>> pkg load ltfat;
>>>
>>> sampling_rate = 44100;
>>> lenght = 30;
>>> hpf = 400;
>>> lpf = 4000;
>>> crest_factor = 6;
>>>
>>> typenoise = noise((lenght)*sampling_rate, 1, 'pink');
>>> [b,a] = butter(2, [hpf/(sampling_rate/2), lpf/(sampling_rate/2)]);
>>> filtered = filter(b, a, typenoise);
>>> filtered = filtered / (rms(filtered) / 10^(-crest_factor/20));
>>> audiowrite ('signal.wav', filtered, 44100);
>>> ==============
>>
>> I don't get the same spectral plots you show here.  My results are much more
>> like your "expected" slope.
>>
> Wowww!
> Can you tell me how you plot it? Just to be possible I make the same
> check here in my side...
>
> Thanks,
> Renato
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/help-octave

Well, I used a Welch's method estimator to get the spectral density.  I
used a Hamming window, but just about any window should do.  I didn't
use any overlap.  There is such an estimator as part of octave.  Then I
just plotted it.  I did a semilogx just like you did and only for
frequencies > 1Hz.


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

yamane
2017-12-15 16:34 GMT+01:00 Robert T. Short <[hidden email]>:

> On 12/15/2017 12:27 AM, Renato S. Yamane wrote:
>> 2017-12-14 20:25 GMT+01:00 Robert T. Short
>>> On 12/13/2017 11:39 PM, Renato S. Yamane wrote:
>>>> Please, see the frequency response on image available in:
>>>> https://ibb.co/cgwOqG
>>>>
>>>> Detail: when I use a crest factor of 12dB instead 6dB, I don´t have
>>>> this problem.
>>>>
>>>> ==============
>>>> pkg load signal;
>>>> pkg load ltfat;
>>>>
>>>> sampling_rate = 44100;
>>>> lenght = 30;
>>>> hpf = 400;
>>>> lpf = 4000;
>>>> crest_factor = 6;
>>>>
>>>> typenoise = noise((lenght)*sampling_rate, 1, 'pink');
>>>> [b,a] = butter(2, [hpf/(sampling_rate/2), lpf/(sampling_rate/2)]);
>>>> filtered = filter(b, a, typenoise);
>>>> filtered = filtered / (rms(filtered) / 10^(-crest_factor/20));
>>>> audiowrite ('signal.wav', filtered, 44100);
>>>> ==============
>>>
>>>
>>> I don't get the same spectral plots you show here.  My results are much
>>> more
>>> like your "expected" slope.
>>
>>
>> Wowww!
>> Can you tell me how you plot it? Just to be possible I make the same
>> check here in my side...
>
>
> Well, I used a Welch's method estimator to get the spectral density.  I used
> a Hamming window, but just about any window should do.  I didn't use any
> overlap.  There is such an estimator as part of octave.  Then I just plotted
> it.  I did a semilogx just like you did and only for frequencies > 1Hz.

Sorry, but can you help me with this "coding" that you did?

Have a good day,
Renato

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

Robert T. Short
On 12/16/2017 06:25 AM, Renato S. Yamane wrote:

> 2017-12-15 16:34 GMT+01:00 Robert T. Short <[hidden email]>:
>> On 12/15/2017 12:27 AM, Renato S. Yamane wrote:
>>> 2017-12-14 20:25 GMT+01:00 Robert T. Short
>>>> On 12/13/2017 11:39 PM, Renato S. Yamane wrote:
>>>>> Please, see the frequency response on image available in:
>>>>> https://ibb.co/cgwOqG
>>>>>
>>>>> Detail: when I use a crest factor of 12dB instead 6dB, I don´t have
>>>>> this problem.
>>>>>
>>>>> ==============
>>>>> pkg load signal;
>>>>> pkg load ltfat;
>>>>>
>>>>> sampling_rate = 44100;
>>>>> lenght = 30;
>>>>> hpf = 400;
>>>>> lpf = 4000;
>>>>> crest_factor = 6;
>>>>>
>>>>> typenoise = noise((lenght)*sampling_rate, 1, 'pink');
>>>>> [b,a] = butter(2, [hpf/(sampling_rate/2), lpf/(sampling_rate/2)]);
>>>>> filtered = filter(b, a, typenoise);
>>>>> filtered = filtered / (rms(filtered) / 10^(-crest_factor/20));
>>>>> audiowrite ('signal.wav', filtered, 44100);
>>>>> ==============
>>>>
>>>> I don't get the same spectral plots you show here.  My results are much
>>>> more
>>>> like your "expected" slope.
>>>
>>> Wowww!
>>> Can you tell me how you plot it? Just to be possible I make the same
>>> check here in my side...
>>
>> Well, I used a Welch's method estimator to get the spectral density.  I used
>> a Hamming window, but just about any window should do.  I didn't use any
>> overlap.  There is such an estimator as part of octave.  Then I just plotted
>> it.  I did a semilogx just like you did and only for frequencies > 1Hz.
> Sorry, but can you help me with this "coding" that you did?
>
> Have a good day,
> Renato
>
>
[Tn,f] = pwelch(typenoise, hamming(2^12));
[Fn,f] = pwelch(filtered, hamming(2^12));

idx = f>0;
figure(1);
semilogx(f(idx),10*log10(Tn(idx)));
figure(2);
semilogx(f(idx),10*log10(Fn(idx)));


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

Robert T. Short
On 12/17/2017 09:48 AM, Robert T. Short wrote:

> On 12/16/2017 06:25 AM, Renato S. Yamane wrote:
>> 2017-12-15 16:34 GMT+01:00 Robert T. Short
>> <[hidden email]>:
>>> On 12/15/2017 12:27 AM, Renato S. Yamane wrote:
>>>> 2017-12-14 20:25 GMT+01:00 Robert T. Short
>>>>> On 12/13/2017 11:39 PM, Renato S. Yamane wrote:
>>>>>> Please, see the frequency response on image available in:
>>>>>> https://ibb.co/cgwOqG
>>>>>>
>>>>>> Detail: when I use a crest factor of 12dB instead 6dB, I don´t have
>>>>>> this problem.
>>>>>>
>>>>>> ==============
>>>>>> pkg load signal;
>>>>>> pkg load ltfat;
>>>>>>
>>>>>> sampling_rate = 44100;
>>>>>> lenght = 30;
>>>>>> hpf = 400;
>>>>>> lpf = 4000;
>>>>>> crest_factor = 6;
>>>>>>
>>>>>> typenoise = noise((lenght)*sampling_rate, 1, 'pink');
>>>>>> [b,a] = butter(2, [hpf/(sampling_rate/2), lpf/(sampling_rate/2)]);
>>>>>> filtered = filter(b, a, typenoise);
>>>>>> filtered = filtered / (rms(filtered) / 10^(-crest_factor/20));
>>>>>> audiowrite ('signal.wav', filtered, 44100);
>>>>>> ==============
>>>>>
>>>>> I don't get the same spectral plots you show here.  My results are
>>>>> much
>>>>> more
>>>>> like your "expected" slope.
>>>>
>>>> Wowww!
>>>> Can you tell me how you plot it? Just to be possible I make the same
>>>> check here in my side...
>>>
>>> Well, I used a Welch's method estimator to get the spectral
>>> density.  I used
>>> a Hamming window, but just about any window should do.  I didn't use
>>> any
>>> overlap.  There is such an estimator as part of octave.  Then I just
>>> plotted
>>> it.  I did a semilogx just like you did and only for frequencies > 1Hz.
>> Sorry, but can you help me with this "coding" that you did?
>>
>> Have a good day,
>> Renato
>>
>>
> [Tn,f] = pwelch(typenoise, hamming(2^12));
> [Fn,f] = pwelch(filtered, hamming(2^12));
>
> idx = f>0;
> figure(1);
> semilogx(f(idx),10*log10(Tn(idx)));
> figure(2);
> semilogx(f(idx),10*log10(Fn(idx)));
>
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/help-octave

If I am interpreting audiowrite correctly, it expects a max absolute
value of unity and your signal is much greater than that.  I think you
are clipping the snot out of the signal in the audio file.



_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

yamane
In reply to this post by Robert T. Short
2017-12-17 18:48 GMT+01:00 Robert T. Short <[hidden email]>:

> On 12/16/2017 06:25 AM, Renato S. Yamane wrote:
>> 2017-12-15 16:34 GMT+01:00 Robert T. Short
>>> On 12/15/2017 12:27 AM, Renato S. Yamane wrote:
>>>> 2017-12-14 20:25 GMT+01:00 Robert T. Short
>>>>> On 12/13/2017 11:39 PM, Renato S. Yamane wrote:
>>>>>>
>>>>>> Please, see the frequency response on image available in:
>>>>>> https://ibb.co/cgwOqG
>>>>>>
>>>>>> Detail: when I use a crest factor of 12dB instead 6dB, I don´t have
>>>>>> this problem.
>>>>>>
>>>>>> ==============
>>>>>> pkg load signal;
>>>>>> pkg load ltfat;
>>>>>>
>>>>>> sampling_rate = 44100;
>>>>>> lenght = 30;
>>>>>> hpf = 400;
>>>>>> lpf = 4000;
>>>>>> crest_factor = 6;
>>>>>>
>>>>>> typenoise = noise((lenght)*sampling_rate, 1, 'pink');
>>>>>> [b,a] = butter(2, [hpf/(sampling_rate/2), lpf/(sampling_rate/2)]);
>>>>>> filtered = filter(b, a, typenoise);
>>>>>> filtered = filtered / (rms(filtered) / 10^(-crest_factor/20));
>>>>>> audiowrite ('signal.wav', filtered, 44100);
>>>>>> ==============
>>>>>
>>>>>
>>>>> I don't get the same spectral plots you show here.  My results are much
>>>>> more
>>>>> like your "expected" slope.
>>>>
>>>>
>>>> Wowww!
>>>> Can you tell me how you plot it? Just to be possible I make the same
>>>> check here in my side...
>>>
>>>
>>> Well, I used a Welch's method estimator to get the spectral density.  I
>>> used
>>> a Hamming window, but just about any window should do.  I didn't use any
>>> overlap.  There is such an estimator as part of octave.  Then I just
>>> plotted
>>> it.  I did a semilogx just like you did and only for frequencies > 1Hz.
>>
>>
>> Sorry, but can you help me with this "coding" that you did?
>>
>>
> [Tn,f] = pwelch(typenoise, hamming(2^12));
> [Fn,f] = pwelch(filtered, hamming(2^12));
>
> idx = f>0;
> figure(1);
> semilogx(f(idx),10*log10(Tn(idx)));
> figure(2);
> semilogx(f(idx),10*log10(Fn(idx)));
>
> If I am interpreting audiowrite correctly, it expects a max absolute value of unity and your signal is much greater than that.  I think you are clipping the snot out of the signal in the audio file.

Hi Robert, your graph have the same problem than mine.
The attenuation stops in low frequency and keep limited.
Please, take a look: https://ibb.co/h20qVR
Regarding the clipping. Yes, it´s true, it´s clipping, but I need to
solve the problem of the attenuation on low frequencies first.

Have a good day!
Renato

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

Ozzy Lash


On Sun, Dec 17, 2017 at 1:13 PM, Renato S. Yamane <[hidden email]> wrote:
2017-12-17 18:48 GMT+01:00 Robert T. Short <[hidden email]>:
> On 12/16/2017 06:25 AM, Renato S. Yamane wrote:
>> 2017-12-15 16:34 GMT+01:00 Robert T. Short
>>> On 12/15/2017 12:27 AM, Renato S. Yamane wrote:
>>>> 2017-12-14 20:25 GMT+01:00 Robert T. Short
>>>>> On 12/13/2017 11:39 PM, Renato S. Yamane wrote:
>>>>>>
>>>>>> Please, see the frequency response on image available in:
>>>>>> https://ibb.co/cgwOqG
>>>>>>
>>>>>> Detail: when I use a crest factor of 12dB instead 6dB, I don´t have
>>>>>> this problem.
>>>>>>
>>>>>> ==============
>>>>>> pkg load signal;
>>>>>> pkg load ltfat;
>>>>>>
>>>>>> sampling_rate = 44100;
>>>>>> lenght = 30;
>>>>>> hpf = 400;
>>>>>> lpf = 4000;
>>>>>> crest_factor = 6;
>>>>>>
>>>>>> typenoise = noise((lenght)*sampling_rate, 1, 'pink');
>>>>>> [b,a] = butter(2, [hpf/(sampling_rate/2), lpf/(sampling_rate/2)]);
>>>>>> filtered = filter(b, a, typenoise);
>>>>>> filtered = filtered / (rms(filtered) / 10^(-crest_factor/20));
>>>>>> audiowrite ('signal.wav', filtered, 44100);
>>>>>> ==============
>>>>>
>>>>>
>>>>> I don't get the same spectral plots you show here.  My results are much
>>>>> more
>>>>> like your "expected" slope.
>>>>
>>>>
>>>> Wowww!
>>>> Can you tell me how you plot it? Just to be possible I make the same
>>>> check here in my side...
>>>
>>>
>>> Well, I used a Welch's method estimator to get the spectral density.  I
>>> used
>>> a Hamming window, but just about any window should do.  I didn't use any
>>> overlap.  There is such an estimator as part of octave.  Then I just
>>> plotted
>>> it.  I did a semilogx just like you did and only for frequencies > 1Hz.
>>
>>
>> Sorry, but can you help me with this "coding" that you did?
>>
>>
> [Tn,f] = pwelch(typenoise, hamming(2^12));
> [Fn,f] = pwelch(filtered, hamming(2^12));
>
> idx = f>0;
> figure(1);
> semilogx(f(idx),10*log10(Tn(idx)));
> figure(2);
> semilogx(f(idx),10*log10(Fn(idx)));
>
> If I am interpreting audiowrite correctly, it expects a max absolute value of unity and your signal is much greater than that.  I think you are clipping the snot out of the signal in the audio file.

Hi Robert, your graph have the same problem than mine.
The attenuation stops in low frequency and keep limited.
Please, take a look: https://ibb.co/h20qVR
Regarding the clipping. Yes, it´s true, it´s clipping, but I need to
solve the problem of the attenuation on low frequencies first.

Have a good day!
Renato

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave


Looking at figure 1 from Robert's plot, it seems to me that the pink noise input has a steeper slope at low frequency and isn't following the 1/f pattern for low frequency.  This corresponds to where the slope deviates from the expected.

Bill

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: [Signal PKG] limited slope

yamane
2017-12-18 4:05 GMT+01:00 Ozzy Lash <[hidden email]>:

> On Sun, Dec 17, 2017 at 1:13 PM, Renato S. Yamane wrote:
>> 2017-12-17 18:48 GMT+01:00 Robert T. Short
>> > On 12/16/2017 06:25 AM, Renato S. Yamane wrote:
>> >> 2017-12-15 16:34 GMT+01:00 Robert T. Short
>> >>> On 12/15/2017 12:27 AM, Renato S. Yamane wrote:
>> >>>> 2017-12-14 20:25 GMT+01:00 Robert T. Short
>> >>>>> On 12/13/2017 11:39 PM, Renato S. Yamane wrote:
>> >>>>>>
>> >>>>>> Please, see the frequency response on image available in:
>> >>>>>> https://ibb.co/cgwOqG
>> >>>>>>
>> >>>>>> Detail: when I use a crest factor of 12dB instead 6dB, I don´t have
>> >>>>>> this problem.
>> >>>>>>
>> >>>>>> ==============
>> >>>>>> pkg load signal;
>> >>>>>> pkg load ltfat;
>> >>>>>>
>> >>>>>> sampling_rate = 44100;
>> >>>>>> lenght = 30;
>> >>>>>> hpf = 400;
>> >>>>>> lpf = 4000;
>> >>>>>> crest_factor = 6;
>> >>>>>>
>> >>>>>> typenoise = noise((lenght)*sampling_rate, 1, 'pink');
>> >>>>>> [b,a] = butter(2, [hpf/(sampling_rate/2), lpf/(sampling_rate/2)]);
>> >>>>>> filtered = filter(b, a, typenoise);
>> >>>>>> filtered = filtered / (rms(filtered) / 10^(-crest_factor/20));
>> >>>>>> audiowrite ('signal.wav', filtered, 44100);
>> >>>>>> ==============
>> >>>>>
>> >>>>>
>> >>>>> I don't get the same spectral plots you show here.  My results are
>> >>>>> much
>> >>>>> more
>> >>>>> like your "expected" slope.
>> >>>>
>> >>>>
>> >>>> Wowww!
>> >>>> Can you tell me how you plot it? Just to be possible I make the same
>> >>>> check here in my side...
>> >>>
>> >>>
>> >>> Well, I used a Welch's method estimator to get the spectral density.
>> >>> I
>> >>> used
>> >>> a Hamming window, but just about any window should do.  I didn't use
>> >>> any
>> >>> overlap.  There is such an estimator as part of octave.  Then I just
>> >>> plotted
>> >>> it.  I did a semilogx just like you did and only for frequencies >
>> >>> 1Hz.
>> >>
>> >>
>> >> Sorry, but can you help me with this "coding" that you did?
>> >>
>> >>
>> > [Tn,f] = pwelch(typenoise, hamming(2^12));
>> > [Fn,f] = pwelch(filtered, hamming(2^12));
>> >
>> > idx = f>0;
>> > figure(1);
>> > semilogx(f(idx),10*log10(Tn(idx)));
>> > figure(2);
>> > semilogx(f(idx),10*log10(Fn(idx)));
>> >
>> > If I am interpreting audiowrite correctly, it expects a max absolute
>> > value of unity and your signal is much greater than that.  I think you are
>> > clipping the snot out of the signal in the audio file.
>>
>>
>> Hi Robert, your graph have the same problem than mine.
>> The attenuation stops in low frequency and keep limited.
>> Please, take a look: https://ibb.co/h20qVR
>> Regarding the clipping. Yes, it´s true, it´s clipping, but I need to
>> solve the problem of the attenuation on low frequencies first.
>
>
> Looking at figure 1 from Robert's plot, it seems to me that the pink noise
> input has a steeper slope at low frequency and isn't following the 1/f
> pattern for low frequency.  This corresponds to where the slope deviates
> from the expected.

Hi Ozzy, the input signal is OK. It follows the 1/f pattern.
Thanks and have a good day!
Renato

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave