Real-time IFFT or additive synthesis from OSC data
Date | 2017-08-23 22:41 |
From | Julien Verneuil <0000026dc0c33c5b-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Real-time IFFT or additive synthesis from OSC data |
Hello, is it possible to do real-time IFFT or additive synthesis from received OSC data with cSound ? My data is frequencies/bins index along with amplitude values for each channels and phase value. Which opcode would be useful to do that, what would be the performances impact ? Thank! 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 |
Date | 2017-08-25 19:11 |
From | Nathan Holmes |
Subject | Re: Real-time IFFT or additive synthesis from OSC data |
Let me start with a disclaimer that I haven't used these opcodes extensively myself. Nonetheless, I think you will want pol2rect (to convert magnitude and phase to an interleaved real-imaginary array), then rifft to do the actual transform, and then lastly the shiftout opcode to put the final array values into an audio signal. The documentation for rifft and rfft have some examples of how to set it all up. See here: http://www.csounds.com/manual/html/rfft.html Note that, assuming rifft expects an array in the same format that rfft produces, the first two entries of the array you pass to rifft should represent DC (0 Hz) and Nyquist (sr/2). Specifically just the real coefficients, I think, since I don't believe real FFT/IFFT transforms typically include imaginary coefficients for DC or Nyquist---although the opcode documentation could stand to be a little clearer on that point. So anyhow, if the OSC data you're receiving has the Nyquist bin at the last index, for example, you'll need to reassign that one "by hand". I don't know anything about the performance impact, I'm afraid. On Wed, Aug 23, 2017 at 2:41 PM, Julien Verneuil <0000026dc0c33c5b-dmarc-request@listserv.heanet.ie> wrote: Hello, |