Csound Csound-dev Csound-tekno Search About

fft, r2c and c2r

Date2015-08-20 15:46
FromAnders Genell
Subjectfft, r2c and c2r
AttachmentsNone  None  
Dear list (and perhaps especially Dr Lazzarini as the resposible creator)!

As I am exploring avenues to plot fft:s in real time using Ed brilliant websockets opcode and HTML5/Javascript I have been trying to understand the also newly added fft opcode and accompanying c2r and r2c opcodes.

I normally work with the fft implementation in GNU/Octave (or Matlab) where the transform is appied to a real time signal and results in a complex signal where the real and the imaginary parts are not used as much a their polar coordinates counterparts radius and angle, such that the radius is the amplitude and the angle is the phase of the signal.

The csound implementation expects a complex signal upon which the fft would act, and one can be created using r2c, but the the imaginary part is said to be zero. Likewise to get a real signal from the complex result of the fft, using c2r will throw away the imaginary part. 

I am just trying to wrap my head around how to obtain an array of amplitude values that I can plot. Any hints?

Regards,
Anders

Date2015-08-20 16:08
FromVictor Lazzarini
SubjectRe: fft, r2c and c2r
I think the best way is to use rfft() and then mags().

kSpec[] mags rfft(kInput)

then you get the magnitude. Look at

http://csound.github.io/docs/manual/rfft.html
http://csound.github.io/docs/manual/mags.html

========================
Dr 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 20 Aug 2015, at 15:46, Anders Genell  wrote:
> 
> Dear list (and perhaps especially Dr Lazzarini as the resposible creator)!
> 
> As I am exploring avenues to plot fft:s in real time using Ed brilliant websockets opcode and HTML5/Javascript I have been trying to understand the also newly added fft opcode and accompanying c2r and r2c opcodes.
> 
> I normally work with the fft implementation in GNU/Octave (or Matlab) where the transform is appied to a real time signal and results in a complex signal where the real and the imaginary parts are not used as much a their polar coordinates counterparts radius and angle, such that the radius is the amplitude and the angle is the phase of the signal.
> 
> The csound implementation expects a complex signal upon which the fft would act, and one can be created using r2c, but the the imaginary part is said to be zero. Likewise to get a real signal from the complex result of the fft, using c2r will throw away the imaginary part. 
> 
> I am just trying to wrap my head around how to obtain an array of amplitude values that I can plot. Any hints?
> 
> Regards,
> Anders
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-20 16:12
FromAnders Genell
SubjectRe: fft, r2c and c2r
AttachmentsNone  None  
Ah! mags!
I tries abs, but it didn't like arrays as argument...

Thank you!!

Regrads,
Anders

On Thu, Aug 20, 2015 at 5:08 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
I think the best way is to use rfft() and then mags().

kSpec[] mags rfft(kInput)

then you get the magnitude. Look at

http://csound.github.io/docs/manual/rfft.html
http://csound.github.io/docs/manual/mags.html

========================
Dr 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 20 Aug 2015, at 15:46, Anders Genell <anders.genell@gmail.com> wrote:
>
> Dear list (and perhaps especially Dr Lazzarini as the resposible creator)!
>
> As I am exploring avenues to plot fft:s in real time using Ed brilliant websockets opcode and HTML5/Javascript I have been trying to understand the also newly added fft opcode and accompanying c2r and r2c opcodes.
>
> I normally work with the fft implementation in GNU/Octave (or Matlab) where the transform is appied to a real time signal and results in a complex signal where the real and the imaginary parts are not used as much a their polar coordinates counterparts radius and angle, such that the radius is the amplitude and the angle is the phase of the signal.
>
> The csound implementation expects a complex signal upon which the fft would act, and one can be created using r2c, but the the imaginary part is said to be zero. Likewise to get a real signal from the complex result of the fft, using c2r will throw away the imaginary part.
>
> I am just trying to wrap my head around how to obtain an array of amplitude values that I can plot. Any hints?
>
> Regards,
> Anders
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here


Date2015-08-20 16:16
From"Dr. Richard Boulanger"
SubjectRe: fft, r2c and c2r
AttachmentsNone  None  

NOTE: Can't run the examples from the manual in CsoundQt because of a parsing error.


STARTING FILE

Creating options

Creating orchestra

Creating score

rtaudio: PortAudio module enabled ...

using blocking interface

error: syntax error, unexpected T_IDENT, expecting T_OPCODE or T_FUNCTION or ',' (token "irfft") from file /Library/Frameworks/CsoundLib64.framework/Resources/Manual/examples/mags.csd (1)

line 59:

>>> kRow[] irfft <<<

Parsing failed due to invalid input!

Stopping on parser failure

cannot compile orchestra



_____________________________________________
Dr. Richard Boulanger
Professor of Electronic Production and Design
Professional Writing and Music Technology Division
Berklee College of Music
1140 Boylston Street, FB-75
Boston, MA 02215-3693
Office @ 161 Mass Ave - 4th Floor
617-747-2384 (office)  774-488-9166 (cell)
______________________________________________
rboulanger@berklee.edu (email)
https://www.facebook.com/richard.boulanger.58 (facebook)
______________________________________________
President of Boulanger Labs - http://boulangerlabs.com
Director of Csounds.com - http://csounds.com
Author & Editor: The Csound Book - http://mitpress.mit.edu/books/csound-book
Author & Editor: The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
______________________________________________
about: http://www.boulangerlabs.com/about/richardboulanger/
about: http://www.csounds.com/community/developers/dr-richard-boulanger/
______________________________________________
music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/


On Thu, Aug 20, 2015 at 11:08 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
I think the best way is to use rfft() and then mags().

kSpec[] mags rfft(kInput)

then you get the magnitude. Look at

http://csound.github.io/docs/manual/rfft.html
http://csound.github.io/docs/manual/mags.html

========================
Dr 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 20 Aug 2015, at 15:46, Anders Genell <anders.genell@gmail.com> wrote:
>
> Dear list (and perhaps especially Dr Lazzarini as the resposible creator)!
>
> As I am exploring avenues to plot fft:s in real time using Ed brilliant websockets opcode and HTML5/Javascript I have been trying to understand the also newly added fft opcode and accompanying c2r and r2c opcodes.
>
> I normally work with the fft implementation in GNU/Octave (or Matlab) where the transform is appied to a real time signal and results in a complex signal where the real and the imaginary parts are not used as much a their polar coordinates counterparts radius and angle, such that the radius is the amplitude and the angle is the phase of the signal.
>
> The csound implementation expects a complex signal upon which the fft would act, and one can be created using r2c, but the the imaginary part is said to be zero. Likewise to get a real signal from the complex result of the fft, using c2r will throw away the imaginary part.
>
> I am just trying to wrap my head around how to obtain an array of amplitude values that I can plot. Any hints?
>
> Regards,
> Anders
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here


Date2015-08-20 16:19
FromVictor Lazzarini
SubjectRe: fft, r2c and c2r
Just note that:

1) mags() is designed for rfft() out format (not fft()). 
2) its output array is N/2 + 1 (half the input size + 1), to accommodate the Nyquist bin.

Regards
========================
Dr 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 20 Aug 2015, at 16:12, Anders Genell  wrote:
> 
> Ah! mags!
> I tries abs, but it didn't like arrays as argument...
> 
> Thank you!!
> 
> Regrads,
> Anders
> 
> On Thu, Aug 20, 2015 at 5:08 PM, Victor Lazzarini  wrote:
> I think the best way is to use rfft() and then mags().
> 
> kSpec[] mags rfft(kInput)
> 
> then you get the magnitude. Look at
> 
> http://csound.github.io/docs/manual/rfft.html
> http://csound.github.io/docs/manual/mags.html
> 
> ========================
> Dr 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 20 Aug 2015, at 15:46, Anders Genell  wrote:
> >
> > Dear list (and perhaps especially Dr Lazzarini as the resposible creator)!
> >
> > As I am exploring avenues to plot fft:s in real time using Ed brilliant websockets opcode and HTML5/Javascript I have been trying to understand the also newly added fft opcode and accompanying c2r and r2c opcodes.
> >
> > I normally work with the fft implementation in GNU/Octave (or Matlab) where the transform is appied to a real time signal and results in a complex signal where the real and the imaginary parts are not used as much a their polar coordinates counterparts radius and angle, such that the radius is the amplitude and the angle is the phase of the signal.
> >
> > The csound implementation expects a complex signal upon which the fft would act, and one can be created using r2c, but the the imaginary part is said to be zero. Likewise to get a real signal from the complex result of the fft, using c2r will throw away the imaginary part.
> >
> > I am just trying to wrap my head around how to obtain an array of amplitude values that I can plot. Any hints?
> >
> > Regards,
> > Anders
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Csound-users mailing list
> > Csound-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/csound-users
> > Send bugs reports to
> >        https://github.com/csound/csound/issues
> > Discussions of bugs and features can be posted here
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-20 16:20
FromVictor Lazzarini
SubjectRe: fft, r2c and c2r
Spelling error, irfft => rifft. I think it has been fixed in the manual sources already.
========================
Dr 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 20 Aug 2015, at 16:16, Dr. Richard Boulanger  wrote:
> 
> NOTE: Can't run the examples from the manual in CsoundQt because of a parsing error.
> 
> STARTING FILE
> Creating options
> Creating orchestra
> Creating score
> rtaudio: PortAudio module enabled ...
> using blocking interface
> error: syntax error, unexpected T_IDENT, expecting T_OPCODE or T_FUNCTION or ',' (token "irfft") from file /Library/Frameworks/CsoundLib64.framework/Resources/Manual/examples/mags.csd (1)
> line 59:
> >>> kRow[] irfft <<<
> Parsing failed due to invalid input!
> Stopping on parser failure
> cannot compile orchestra
> 
> 
> _____________________________________________
> Dr. Richard Boulanger
> Professor of Electronic Production and Design
> Professional Writing and Music Technology Division
> Berklee College of Music
> 1140 Boylston Street, FB-75
> Boston, MA 02215-3693
> Office @ 161 Mass Ave - 4th Floor
> 617-747-2384 (office)  774-488-9166 (cell)
> ______________________________________________
> rboulanger@berklee.edu (email)
> https://www.facebook.com/richard.boulanger.58 (facebook)
> ______________________________________________
> President of Boulanger Labs - http://boulangerlabs.com
> Director of Csounds.com - http://csounds.com
> Author & Editor: The Csound Book - http://mitpress.mit.edu/books/csound-book
> Author & Editor: The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
> ______________________________________________
> about: http://www.boulangerlabs.com/about/richardboulanger/
> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
> ______________________________________________
> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
> 
> On Thu, Aug 20, 2015 at 11:08 AM, Victor Lazzarini  wrote:
> I think the best way is to use rfft() and then mags().
> 
> kSpec[] mags rfft(kInput)
> 
> then you get the magnitude. Look at
> 
> http://csound.github.io/docs/manual/rfft.html
> http://csound.github.io/docs/manual/mags.html
> 
> ========================
> Dr 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 20 Aug 2015, at 15:46, Anders Genell  wrote:
> >
> > Dear list (and perhaps especially Dr Lazzarini as the resposible creator)!
> >
> > As I am exploring avenues to plot fft:s in real time using Ed brilliant websockets opcode and HTML5/Javascript I have been trying to understand the also newly added fft opcode and accompanying c2r and r2c opcodes.
> >
> > I normally work with the fft implementation in GNU/Octave (or Matlab) where the transform is appied to a real time signal and results in a complex signal where the real and the imaginary parts are not used as much a their polar coordinates counterparts radius and angle, such that the radius is the amplitude and the angle is the phase of the signal.
> >
> > The csound implementation expects a complex signal upon which the fft would act, and one can be created using r2c, but the the imaginary part is said to be zero. Likewise to get a real signal from the complex result of the fft, using c2r will throw away the imaginary part.
> >
> > I am just trying to wrap my head around how to obtain an array of amplitude values that I can plot. Any hints?
> >
> > Regards,
> > Anders
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Csound-users mailing list
> > Csound-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/csound-users
> > Send bugs reports to
> >        https://github.com/csound/csound/issues
> > Discussions of bugs and features can be posted here
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-20 18:11
FromEd Costello
SubjectRe: fft, r2c and c2r
AttachmentsNone  None  
Here is an instrument that should do what you want,
It sends audio from a vco2 opcode with the frequency altered by an lfo to an fft, gets the magnitudes and sends these on to the websocket, it also uses the new framebuffer opcode, but if you've built from sources you should have that. 
Ed

instr 1


isize init 4096

ioverlaps init 4

klfo lfo 1, 1

kfreq = 10

asig vco2 0.5, 2000 + (1000 * klfo)

kframe[] framebuffer asig, isize

kwindowedFrame[] window kframe

kspectrum[] rfft kwindowedFrame

kmagnitudes[] mags kspectrum

;outs asig, asig

iport init 8888

kinput websocket iport, kmagnitudes

endin


On Thu, 20 Aug 2015 at 17:21 Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Spelling error, irfft => rifft. I think it has been fixed in the manual sources already.
========================
Dr 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 20 Aug 2015, at 16:16, Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
>
> NOTE: Can't run the examples from the manual in CsoundQt because of a parsing error.
>
> STARTING FILE
> Creating options
> Creating orchestra
> Creating score
> rtaudio: PortAudio module enabled ...
> using blocking interface
> error: syntax error, unexpected T_IDENT, expecting T_OPCODE or T_FUNCTION or ',' (token "irfft") from file /Library/Frameworks/CsoundLib64.framework/Resources/Manual/examples/mags.csd (1)
> line 59:
> >>> kRow[] irfft <<<
> Parsing failed due to invalid input!
> Stopping on parser failure
> cannot compile orchestra
>
>
> _____________________________________________
> Dr. Richard Boulanger
> Professor of Electronic Production and Design
> Professional Writing and Music Technology Division
> Berklee College of Music
> 1140 Boylston Street, FB-75
> Boston, MA 02215-3693
> Office @ 161 Mass Ave - 4th Floor
> 617-747-2384 (office)  774-488-9166 (cell)
> ______________________________________________
> rboulanger@berklee.edu (email)
> https://www.facebook.com/richard.boulanger.58 (facebook)
> ______________________________________________
> President of Boulanger Labs - http://boulangerlabs.com
> Director of Csounds.com - http://csounds.com
> Author & Editor: The Csound Book - http://mitpress.mit.edu/books/csound-book
> Author & Editor: The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
> ______________________________________________
> about: http://www.boulangerlabs.com/about/richardboulanger/
> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
> ______________________________________________
> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
>
> On Thu, Aug 20, 2015 at 11:08 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> I think the best way is to use rfft() and then mags().
>
> kSpec[] mags rfft(kInput)
>
> then you get the magnitude. Look at
>
> http://csound.github.io/docs/manual/rfft.html
> http://csound.github.io/docs/manual/mags.html
>
> ========================
> Dr 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 20 Aug 2015, at 15:46, Anders Genell <anders.genell@gmail.com> wrote:
> >
> > Dear list (and perhaps especially Dr Lazzarini as the resposible creator)!
> >
> > As I am exploring avenues to plot fft:s in real time using Ed brilliant websockets opcode and HTML5/Javascript I have been trying to understand the also newly added fft opcode and accompanying c2r and r2c opcodes.
> >
> > I normally work with the fft implementation in GNU/Octave (or Matlab) where the transform is appied to a real time signal and results in a complex signal where the real and the imaginary parts are not used as much a their polar coordinates counterparts radius and angle, such that the radius is the amplitude and the angle is the phase of the signal.
> >
> > The csound implementation expects a complex signal upon which the fft would act, and one can be created using r2c, but the the imaginary part is said to be zero. Likewise to get a real signal from the complex result of the fft, using c2r will throw away the imaginary part.
> >
> > I am just trying to wrap my head around how to obtain an array of amplitude values that I can plot. Any hints?
> >
> > Regards,
> > Anders
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Csound-users mailing list
> > Csound-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/csound-users
> > Send bugs reports to
> >        https://github.com/csound/csound/issues
> > Discussions of bugs and features can be posted here
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
--
Edward Costello

Date2015-08-20 18:27
FromAnders Genell
SubjectRe: fft, r2c and c2r
AttachmentsNone  None  
Ha!
I have almost the identical code here after having mashed together your we sockets example with the examples for rfft and mags :-)

But your code is better structured and more versatile with the overlap option, so thank you very much!!

I have a JavaScript plotting the raw mags on a <canvas> in HTML5 and can see the peak moving up and down, so now I just need to polish a bit to get proper decibel amplitudes and logarithmic frequency axis. 

Is it possible to send more than one array btw? It looks like the HTML5 end allows naming the incoming variable name used in the csd, so I assume it should be possible?
I was thinking it would be good to be able to send more than just the raw magnitudes. Perhaps even create the frequency axis array  in csound (expseg perhaps?) and send both?

Regards, 
Anders



20 aug 2015 kl. 19:11 skrev Ed Costello <phasereset@gmail.com>:

Here is an instrument that should do what you want,
It sends audio from a vco2 opcode with the frequency altered by an lfo to an fft, gets the magnitudes and sends these on to the websocket, it also uses the new framebuffer opcode, but if you've built from sources you should have that. 
Ed

instr 1


isize init 4096

ioverlaps init 4

klfo lfo 1, 1

kfreq = 10

asig vco2 0.5, 2000 + (1000 * klfo)

kframe[] framebuffer asig, isize

kwindowedFrame[] window kframe

kspectrum[] rfft kwindowedFrame

kmagnitudes[] mags kspectrum

;outs asig, asig

iport init 8888

kinput websocket iport, kmagnitudes

endin


On Thu, 20 Aug 2015 at 17:21 Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Spelling error, irfft => rifft. I think it has been fixed in the manual sources already.
========================
Dr 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 20 Aug 2015, at 16:16, Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
>
> NOTE: Can't run the examples from the manual in CsoundQt because of a parsing error.
>
> STARTING FILE
> Creating options
> Creating orchestra
> Creating score
> rtaudio: PortAudio module enabled ...
> using blocking interface
> error: syntax error, unexpected T_IDENT, expecting T_OPCODE or T_FUNCTION or ',' (token "irfft") from file /Library/Frameworks/CsoundLib64.framework/Resources/Manual/examples/mags.csd (1)
> line 59:
> >>> kRow[] irfft <<<
> Parsing failed due to invalid input!
> Stopping on parser failure
> cannot compile orchestra
>
>
> _____________________________________________
> Dr. Richard Boulanger
> Professor of Electronic Production and Design
> Professional Writing and Music Technology Division
> Berklee College of Music
> 1140 Boylston Street, FB-75
> Boston, MA 02215-3693
> Office @ 161 Mass Ave - 4th Floor
> 617-747-2384 (office)  774-488-9166 (cell)
> ______________________________________________
> rboulanger@berklee.edu (email)
> https://www.facebook.com/richard.boulanger.58 (facebook)
> ______________________________________________
> President of Boulanger Labs - http://boulangerlabs.com
> Director of Csounds.com - http://csounds.com
> Author & Editor: The Csound Book - http://mitpress.mit.edu/books/csound-book
> Author & Editor: The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
> ______________________________________________
> about: http://www.boulangerlabs.com/about/richardboulanger/
> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
> ______________________________________________
> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
>
> On Thu, Aug 20, 2015 at 11:08 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> I think the best way is to use rfft() and then mags().
>
> kSpec[] mags rfft(kInput)
>
> then you get the magnitude. Look at
>
> http://csound.github.io/docs/manual/rfft.html
> http://csound.github.io/docs/manual/mags.html
>
> ========================
> Dr 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 20 Aug 2015, at 15:46, Anders Genell <anders.genell@gmail.com> wrote:
> >
> > Dear list (and perhaps especially Dr Lazzarini as the resposible creator)!
> >
> > As I am exploring avenues to plot fft:s in real time using Ed brilliant websockets opcode and HTML5/Javascript I have been trying to understand the also newly added fft opcode and accompanying c2r and r2c opcodes.
> >
> > I normally work with the fft implementation in GNU/Octave (or Matlab) where the transform is appied to a real time signal and results in a complex signal where the real and the imaginary parts are not used as much a their polar coordinates counterparts radius and angle, such that the radius is the amplitude and the angle is the phase of the signal.
> >
> > The csound implementation expects a complex signal upon which the fft would act, and one can be created using r2c, but the the imaginary part is said to be zero. Likewise to get a real signal from the complex result of the fft, using c2r will throw away the imaginary part.
> >
> > I am just trying to wrap my head around how to obtain an array of amplitude values that I can plot. Any hints?
> >
> > Regards,
> > Anders
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Csound-users mailing list
> > Csound-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/csound-users
> > Send bugs reports to
> >        https://github.com/csound/csound/issues
> > Discussions of bugs and features can be posted here
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
--
Edward Costello
------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-20 18:42
FromEd Costello
SubjectRe: fft, r2c and c2r
AttachmentsNone  None  
Yeah the opcode accepts any number of inputs and outputs. There may be a limit as to how much data can be sent over websockets before it gets congested and you get buffer overruns, but I have made the buffers quite large so I wouldn't imagine there would be much of a problem.
Ed

On Thu, 20 Aug 2015 at 19:28 Anders Genell <anders.genell@gmail.com> wrote:
Ha!
I have almost the identical code here after having mashed together your we sockets example with the examples for rfft and mags :-)

But your code is better structured and more versatile with the overlap option, so thank you very much!!

I have a JavaScript plotting the raw mags on a <canvas> in HTML5 and can see the peak moving up and down, so now I just need to polish a bit to get proper decibel amplitudes and logarithmic frequency axis. 

Is it possible to send more than one array btw? It looks like the HTML5 end allows naming the incoming variable name used in the csd, so I assume it should be possible?
I was thinking it would be good to be able to send more than just the raw magnitudes. Perhaps even create the frequency axis array  in csound (expseg perhaps?) and send both?

Regards, 
Anders



20 aug 2015 kl. 19:11 skrev Ed Costello <phasereset@gmail.com>:

Here is an instrument that should do what you want,
It sends audio from a vco2 opcode with the frequency altered by an lfo to an fft, gets the magnitudes and sends these on to the websocket, it also uses the new framebuffer opcode, but if you've built from sources you should have that. 
Ed

instr 1


isize init 4096

ioverlaps init 4

klfo lfo 1, 1

kfreq = 10

asig vco2 0.5, 2000 + (1000 * klfo)

kframe[] framebuffer asig, isize

kwindowedFrame[] window kframe

kspectrum[] rfft kwindowedFrame

kmagnitudes[] mags kspectrum

;outs asig, asig

iport init 8888

kinput websocket iport, kmagnitudes

endin


On Thu, 20 Aug 2015 at 17:21 Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Spelling error, irfft => rifft. I think it has been fixed in the manual sources already.
========================
Dr 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 20 Aug 2015, at 16:16, Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
>
> NOTE: Can't run the examples from the manual in CsoundQt because of a parsing error.
>
> STARTING FILE
> Creating options
> Creating orchestra
> Creating score
> rtaudio: PortAudio module enabled ...
> using blocking interface
> error: syntax error, unexpected T_IDENT, expecting T_OPCODE or T_FUNCTION or ',' (token "irfft") from file /Library/Frameworks/CsoundLib64.framework/Resources/Manual/examples/mags.csd (1)
> line 59:
> >>> kRow[] irfft <<<
> Parsing failed due to invalid input!
> Stopping on parser failure
> cannot compile orchestra
>
>
> _____________________________________________
> Dr. Richard Boulanger
> Professor of Electronic Production and Design
> Professional Writing and Music Technology Division
> Berklee College of Music
> 1140 Boylston Street, FB-75
> Boston, MA 02215-3693
> Office @ 161 Mass Ave - 4th Floor
> 617-747-2384 (office)  774-488-9166 (cell)
> ______________________________________________
> rboulanger@berklee.edu (email)
> https://www.facebook.com/richard.boulanger.58 (facebook)
> ______________________________________________
> President of Boulanger Labs - http://boulangerlabs.com
> Director of Csounds.com - http://csounds.com
> Author & Editor: The Csound Book - http://mitpress.mit.edu/books/csound-book
> Author & Editor: The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
> ______________________________________________
> about: http://www.boulangerlabs.com/about/richardboulanger/
> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
> ______________________________________________
> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
>
> On Thu, Aug 20, 2015 at 11:08 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> I think the best way is to use rfft() and then mags().
>
> kSpec[] mags rfft(kInput)
>
> then you get the magnitude. Look at
>
> http://csound.github.io/docs/manual/rfft.html
> http://csound.github.io/docs/manual/mags.html
>
> ========================
> Dr 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 20 Aug 2015, at 15:46, Anders Genell <anders.genell@gmail.com> wrote:
> >
> > Dear list (and perhaps especially Dr Lazzarini as the resposible creator)!
> >
> > As I am exploring avenues to plot fft:s in real time using Ed brilliant websockets opcode and HTML5/Javascript I have been trying to understand the also newly added fft opcode and accompanying c2r and r2c opcodes.
> >
> > I normally work with the fft implementation in GNU/Octave (or Matlab) where the transform is appied to a real time signal and results in a complex signal where the real and the imaginary parts are not used as much a their polar coordinates counterparts radius and angle, such that the radius is the amplitude and the angle is the phase of the signal.
> >
> > The csound implementation expects a complex signal upon which the fft would act, and one can be created using r2c, but the the imaginary part is said to be zero. Likewise to get a real signal from the complex result of the fft, using c2r will throw away the imaginary part.
> >
> > I am just trying to wrap my head around how to obtain an array of amplitude values that I can plot. Any hints?
> >
> > Regards,
> > Anders
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Csound-users mailing list
> > Csound-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/csound-users
> > Send bugs reports to
> >        https://github.com/csound/csound/issues
> > Discussions of bugs and features can be posted here
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
--
Edward Costello
------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
--
Edward Costello

Date2015-08-21 09:07
FromAnders Genell
SubjectRe: fft, r2c and c2r
AttachmentsNone  None  
I'll give it a try, thanks!
Oh, I can also report it is quite stable as I now have had it running for some 20 hours without a glitch...

Regards,
Anders

On Thu, Aug 20, 2015 at 7:42 PM, Ed Costello <phasereset@gmail.com> wrote:
Yeah the opcode accepts any number of inputs and outputs. There may be a limit as to how much data can be sent over websockets before it gets congested and you get buffer overruns, but I have made the buffers quite large so I wouldn't imagine there would be much of a problem.
Ed

On Thu, 20 Aug 2015 at 19:28 Anders Genell <anders.genell@gmail.com> wrote:
Ha!
I have almost the identical code here after having mashed together your we sockets example with the examples for rfft and mags :-)

But your code is better structured and more versatile with the overlap option, so thank you very much!!

I have a JavaScript plotting the raw mags on a <canvas> in HTML5 and can see the peak moving up and down, so now I just need to polish a bit to get proper decibel amplitudes and logarithmic frequency axis. 

Is it possible to send more than one array btw? It looks like the HTML5 end allows naming the incoming variable name used in the csd, so I assume it should be possible?
I was thinking it would be good to be able to send more than just the raw magnitudes. Perhaps even create the frequency axis array  in csound (expseg perhaps?) and send both?

Regards, 
Anders



20 aug 2015 kl. 19:11 skrev Ed Costello <phasereset@gmail.com>:

Here is an instrument that should do what you want,
It sends audio from a vco2 opcode with the frequency altered by an lfo to an fft, gets the magnitudes and sends these on to the websocket, it also uses the new framebuffer opcode, but if you've built from sources you should have that. 
Ed

instr 1


isize init 4096

ioverlaps init 4

klfo lfo 1, 1

kfreq = 10

asig vco2 0.5, 2000 + (1000 * klfo)

kframe[] framebuffer asig, isize

kwindowedFrame[] window kframe

kspectrum[] rfft kwindowedFrame

kmagnitudes[] mags kspectrum

;outs asig, asig

iport init 8888

kinput websocket iport, kmagnitudes

endin


On Thu, 20 Aug 2015 at 17:21 Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Spelling error, irfft => rifft. I think it has been fixed in the manual sources already.
========================
Dr 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 20 Aug 2015, at 16:16, Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
>
> NOTE: Can't run the examples from the manual in CsoundQt because of a parsing error.
>
> STARTING FILE
> Creating options
> Creating orchestra
> Creating score
> rtaudio: PortAudio module enabled ...
> using blocking interface
> error: syntax error, unexpected T_IDENT, expecting T_OPCODE or T_FUNCTION or ',' (token "irfft") from file /Library/Frameworks/CsoundLib64.framework/Resources/Manual/examples/mags.csd (1)
> line 59:
> >>> kRow[] irfft <<<
> Parsing failed due to invalid input!
> Stopping on parser failure
> cannot compile orchestra
>
>
> _____________________________________________
> Dr. Richard Boulanger
> Professor of Electronic Production and Design
> Professional Writing and Music Technology Division
> Berklee College of Music
> 1140 Boylston Street, FB-75
> Boston, MA 02215-3693
> Office @ 161 Mass Ave - 4th Floor
> 617-747-2384 (office)  774-488-9166 (cell)
> ______________________________________________
> rboulanger@berklee.edu (email)
> https://www.facebook.com/richard.boulanger.58 (facebook)
> ______________________________________________
> President of Boulanger Labs - http://boulangerlabs.com
> Director of Csounds.com - http://csounds.com
> Author & Editor: The Csound Book - http://mitpress.mit.edu/books/csound-book
> Author & Editor: The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
> ______________________________________________
> about: http://www.boulangerlabs.com/about/richardboulanger/
> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
> ______________________________________________
> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
>
> On Thu, Aug 20, 2015 at 11:08 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> I think the best way is to use rfft() and then mags().
>
> kSpec[] mags rfft(kInput)
>
> then you get the magnitude. Look at
>
> http://csound.github.io/docs/manual/rfft.html
> http://csound.github.io/docs/manual/mags.html
>
> ========================
> Dr 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 20 Aug 2015, at 15:46, Anders Genell <anders.genell@gmail.com> wrote:
> >
> > Dear list (and perhaps especially Dr Lazzarini as the resposible creator)!
> >
> > As I am exploring avenues to plot fft:s in real time using Ed brilliant websockets opcode and HTML5/Javascript I have been trying to understand the also newly added fft opcode and accompanying c2r and r2c opcodes.
> >
> > I normally work with the fft implementation in GNU/Octave (or Matlab) where the transform is appied to a real time signal and results in a complex signal where the real and the imaginary parts are not used as much a their polar coordinates counterparts radius and angle, such that the radius is the amplitude and the angle is the phase of the signal.
> >
> > The csound implementation expects a complex signal upon which the fft would act, and one can be created using r2c, but the the imaginary part is said to be zero. Likewise to get a real signal from the complex result of the fft, using c2r will throw away the imaginary part.
> >
> > I am just trying to wrap my head around how to obtain an array of amplitude values that I can plot. Any hints?
> >
> > Regards,
> > Anders
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Csound-users mailing list
> > Csound-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/csound-users
> > Send bugs reports to
> >        https://github.com/csound/csound/issues
> > Discussions of bugs and features can be posted here
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
--
Edward Costello
------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
--
Edward Costello

------------------------------------------------------------------------------

_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here



Date2015-08-21 09:56
FromEd Costello
SubjectRe: fft, r2c and c2r
AttachmentsNone  None  
Wow thats great, I never got to test it for very long, seems to be pretty solid then if it runs for 20hrs :)
Cheers
Ed

On Fri, 21 Aug 2015 at 10:09 Anders Genell <anders.genell@gmail.com> wrote:
I'll give it a try, thanks!
Oh, I can also report it is quite stable as I now have had it running for some 20 hours without a glitch...

Regards,
Anders

On Thu, Aug 20, 2015 at 7:42 PM, Ed Costello <phasereset@gmail.com> wrote:
Yeah the opcode accepts any number of inputs and outputs. There may be a limit as to how much data can be sent over websockets before it gets congested and you get buffer overruns, but I have made the buffers quite large so I wouldn't imagine there would be much of a problem.
Ed

On Thu, 20 Aug 2015 at 19:28 Anders Genell <anders.genell@gmail.com> wrote:
Ha!
I have almost the identical code here after having mashed together your we sockets example with the examples for rfft and mags :-)

But your code is better structured and more versatile with the overlap option, so thank you very much!!

I have a JavaScript plotting the raw mags on a <canvas> in HTML5 and can see the peak moving up and down, so now I just need to polish a bit to get proper decibel amplitudes and logarithmic frequency axis. 

Is it possible to send more than one array btw? It looks like the HTML5 end allows naming the incoming variable name used in the csd, so I assume it should be possible?
I was thinking it would be good to be able to send more than just the raw magnitudes. Perhaps even create the frequency axis array  in csound (expseg perhaps?) and send both?

Regards, 
Anders



20 aug 2015 kl. 19:11 skrev Ed Costello <phasereset@gmail.com>:

Here is an instrument that should do what you want,
It sends audio from a vco2 opcode with the frequency altered by an lfo to an fft, gets the magnitudes and sends these on to the websocket, it also uses the new framebuffer opcode, but if you've built from sources you should have that. 
Ed

instr 1


isize init 4096

ioverlaps init 4

klfo lfo 1, 1

kfreq = 10

asig vco2 0.5, 2000 + (1000 * klfo)

kframe[] framebuffer asig, isize

kwindowedFrame[] window kframe

kspectrum[] rfft kwindowedFrame

kmagnitudes[] mags kspectrum

;outs asig, asig

iport init 8888

kinput websocket iport, kmagnitudes

endin


On Thu, 20 Aug 2015 at 17:21 Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Spelling error, irfft => rifft. I think it has been fixed in the manual sources already.
========================
Dr 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 20 Aug 2015, at 16:16, Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
>
> NOTE: Can't run the examples from the manual in CsoundQt because of a parsing error.
>
> STARTING FILE
> Creating options
> Creating orchestra
> Creating score
> rtaudio: PortAudio module enabled ...
> using blocking interface
> error: syntax error, unexpected T_IDENT, expecting T_OPCODE or T_FUNCTION or ',' (token "irfft") from file /Library/Frameworks/CsoundLib64.framework/Resources/Manual/examples/mags.csd (1)
> line 59:
> >>> kRow[] irfft <<<
> Parsing failed due to invalid input!
> Stopping on parser failure
> cannot compile orchestra
>
>
> _____________________________________________
> Dr. Richard Boulanger
> Professor of Electronic Production and Design
> Professional Writing and Music Technology Division
> Berklee College of Music
> 1140 Boylston Street, FB-75
> Boston, MA 02215-3693
> Office @ 161 Mass Ave - 4th Floor
> 617-747-2384 (office)  774-488-9166 (cell)
> ______________________________________________
> rboulanger@berklee.edu (email)
> https://www.facebook.com/richard.boulanger.58 (facebook)
> ______________________________________________
> President of Boulanger Labs - http://boulangerlabs.com
> Director of Csounds.com - http://csounds.com
> Author & Editor: The Csound Book - http://mitpress.mit.edu/books/csound-book
> Author & Editor: The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
> ______________________________________________
> about: http://www.boulangerlabs.com/about/richardboulanger/
> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
> ______________________________________________
> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
>
> On Thu, Aug 20, 2015 at 11:08 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
> I think the best way is to use rfft() and then mags().
>
> kSpec[] mags rfft(kInput)
>
> then you get the magnitude. Look at
>
> http://csound.github.io/docs/manual/rfft.html
> http://csound.github.io/docs/manual/mags.html
>
> ========================
> Dr 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 20 Aug 2015, at 15:46, Anders Genell <anders.genell@gmail.com> wrote:
> >
> > Dear list (and perhaps especially Dr Lazzarini as the resposible creator)!
> >
> > As I am exploring avenues to plot fft:s in real time using Ed brilliant websockets opcode and HTML5/Javascript I have been trying to understand the also newly added fft opcode and accompanying c2r and r2c opcodes.
> >
> > I normally work with the fft implementation in GNU/Octave (or Matlab) where the transform is appied to a real time signal and results in a complex signal where the real and the imaginary parts are not used as much a their polar coordinates counterparts radius and angle, such that the radius is the amplitude and the angle is the phase of the signal.
> >
> > The csound implementation expects a complex signal upon which the fft would act, and one can be created using r2c, but the the imaginary part is said to be zero. Likewise to get a real signal from the complex result of the fft, using c2r will throw away the imaginary part.
> >
> > I am just trying to wrap my head around how to obtain an array of amplitude values that I can plot. Any hints?
> >
> > Regards,
> > Anders
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Csound-users mailing list
> > Csound-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/csound-users
> > Send bugs reports to
> >        https://github.com/csound/csound/issues
> > Discussions of bugs and features can be posted here
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
--
Edward Costello
------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
--
Edward Costello

------------------------------------------------------------------------------

_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
--
Edward Costello