Csound Csound-dev Csound-tekno Search About

Re: [Csnd] HRTF-Neutralization of in-file

Date2018-07-12 21:12
FromJohn
SubjectRe: [Csnd] HRTF-Neutralization of in-file
Returning to your earlier question....

>  the manual to it states that it (rfft) returns non negative values
>  only.

The manual states as you quote
> The output is another array containing the transform, non-redundant,
> non-negative spectrum only.

That is not the same as non-negative values.  The opcode  rfft output
is just an array of re-im values containing the non-negative DFT bins.
These complex numbers values may have negative real or imaginary
parts.

I hope that makes it a little clearer.

==John ffitch

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2018-07-18 22:05
FromSteffenE
SubjectRe: [Csnd] HRTF-Neutralization of in-file
jpff wrote
> Returning to your earlier question....
> 
>>  the manual to it states that it (rfft) returns non negative values
>>  only.
> 
> The manual states as you quote
>> The output is another array containing the transform, non-redundant,
>> non-negative spectrum only.
> 
> That is not the same as non-negative values.  The opcode  rfft output
> is just an array of re-im values containing the non-negative DFT bins.
> These complex numbers values may have negative real or imaginary
> parts.
> 
> I hope that makes it a little clearer.
> 
> ==John ffitch

Hey jpff, thank you for the notice.
Yes, that makes it a little clearer. So the output is an interleaved real -
imaginary array. 
Should I rather use r2c and fft commands to get the spectrum on which I run
the reciprocal 
loop and then fftinv and c2r. 
Is that maybe the right approach for what I try to accomplish?






--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2018-07-19 10:56
FromVictor Lazzarini
SubjectRe: [Csnd] HRTF-Neutralization of in-file
you only want fft/fftinv instead of rfft/rifft if for some reason you are dealing with
complex inputs, e.g. analytic signals. The rfft opcode takes in a real time-domain function and
outputs its non-negative spectrum, the rifft takes a non-negative spectrum and
outputs a real time-domain function. That’s all, no tricks.  

The r2c and c2r opcodes are utilities to convert arrays in the formats expected by
the fft/fftinv, but if you are starting from a real function, then you may as well use
rfft instead.
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 18 Jul 2018, at 22:05, SteffenE  wrote:
> 
> jpff wrote
>> Returning to your earlier question....
>> 
>>> the manual to it states that it (rfft) returns non negative values
>>> only.
>> 
>> The manual states as you quote
>>> The output is another array containing the transform, non-redundant,
>>> non-negative spectrum only.
>> 
>> That is not the same as non-negative values.  The opcode  rfft output
>> is just an array of re-im values containing the non-negative DFT bins.
>> These complex numbers values may have negative real or imaginary
>> parts.
>> 
>> I hope that makes it a little clearer.
>> 
>> ==John ffitch
> 
> Hey jpff, thank you for the notice.
> Yes, that makes it a little clearer. So the output is an interleaved real -
> imaginary array. 
> Should I rather use r2c and fft commands to get the spectrum on which I run
> the reciprocal 
> loop and then fftinv and c2r. 
> Is that maybe the right approach for what I try to accomplish?
> 
> 
> 
> 
> 
> 
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2018-07-19 20:20
FromSteffenE
SubjectRe: [Csnd] HRTF-Neutralization of in-file
Hey victor, 

thank you for your reply! 

Based on this insight, I guess rfft and ifft are the right commands to use, 
although I have to derive the spectrum from it manually through something
like 
spec[] sqrt(real^2 + imag^2). 
As you may see I'm a little unexperienced in this domain and just gathering
info 
on what to do from here and there, hoping to be on the right track – as I'm
not confident with the math. 

After doing the reciprocal to the spectrum, can I just ifft it afterwards
and then convolute it with the signal? 




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2018-07-19 20:49
FromVictor Lazzarini
SubjectRe: [Csnd] HRTF-Neutralization of in-file
Just to clarify, rfft gives you the spectrum in rectangular form. If you need the magnitudes, use mags to get them. You can get the phases with phs. You can recover the rect form with pol2rect.

I am not quite sure exactly what you need to do, but I suspect you’d do the convolution as a multiplication in the spectral domain (fast convolution). 

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 19 Jul 2018, at 20:20, SteffenE  wrote:
> 
> Hey victor, 
> 
> thank you for your reply! 
> 
> Based on this insight, I guess rfft and ifft are the right commands to use, 
> although I have to derive the spectrum from it manually through something
> like 
> spec[] sqrt(real^2 + imag^2). 
> As you may see I'm a little unexperienced in this domain and just gathering
> info 
> on what to do from here and there, hoping to be on the right track – as I'm
> not confident with the math. 
> 
> After doing the reciprocal to the spectrum, can I just ifft it afterwards
> and then convolute it with the signal? 
> 
> 
> 
> 
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here