reface DX style FM Feedback (Saw, Square)

I have long avoided FM (Frequency Modulation) synthesis in my own musical practice as I never felt connected with the results I was able to get myself. However, I recently had the great pleasure to attend a talk about the 50th anniversary of FM synthesis, given by its creator, John Chowning, and I was very inspired to explore FM once again. In so doing, I came across the Yamaha reface DX synthesizer and became fascinated with reproducing its feedback system to morph an operator’s output from a Sine to either Saw or Square waveform.

Now, I do not own a reface DX, so most of my research into it was through looking at manuals and watching video demonstrations on YouTube to try to get an idea of how it might be done. I knew from going through literature on FM and PM (Phase Modulation) that using PM with feedback could get an operator’s signal to move from a Sine to Sawtooth wave, depending upon the amount of feedback. I was quickly able to setup a PM instrument in Csound and test this out and it sounded much like what I had heard for the reface DX.

;; feedback PM - feedback moves towards saw
instr PMFBSaw
ifreq = p4
iamp = p5

kfb = linseg(0, p3 * .5, 0.3, p3 * .5, 0)

aphs = phasor(ifreq)

; init for feedback
acar init 0
acar = tablei(aphs+(acar*kfb), 1, 1, 0, 1)
acar *= linen:a(1, 0.1, p3, 0.1) * iamp

outc(acar, acar)
endin

In the code above, one can see that the acar output from tablei is also used as input into the opcode. The code above runs in a single-sample context (in Csound parlance, with ksmps=1).

Now, the part I could not find anywhere in literature or discussion online was how to use operator feedback to morph from Sine to Square. (This is done by using 0 to -127 range for feedback on the reface DX.) After a couple days of research and exploration, I stumbled upon a calculation that sounded to my ears very much like what I had heard on the reface DX videos.

The code below shows the entire instrument:

;; feedback PM - feedback moves towards square
instr PMFBSquare 
  ifreq = p4 
  iamp = p5

  kfb = linseg(0, p3 * .5, 0.3, p3 * .5, 0)
  
  aphs = phasor(ifreq)

  ; init for feedback
  acar init 0 
  acar = tablei(aphs+(acar*acar*kfb), 1, 1, 0, 1)
  acar *= linen:a(1, 0.1, p3, 0.1) * iamp

  outc(acar, acar)
endin

This instrument is virtually the same as the first instrument with the exception of one additional calculation: the multiplication of the acar feedback by itself. (This is seen in the acar*acar calculation.) Adding this one additional multiplication made the signal move from Sine to Square.

I posted this to the Csound User list and Iain McCurdy gave great feedback that the waveform could be morphed between Saw and Square by interpolating between acar and 1. This made a lot of sense as when one of the acar‘s becomes 1, it reduces back down to the normal feedback addition to produce a Saw sound. After some further emails, I did some experiments to use a cosine-based mapping for the interpolation that resulted in a nice transition.

;; feedback PM - feedback moves from square to saw 
;; Based on Iain McCurdy's comments on Csound User List
instr PMFBSquareSaw 
  ifreq = p4 
  iamp = p5

  kfb = 0.25 
  ;;kfb = linseg(0, p3 * .5, 0.5, p3 * .5, 0)
  kwaveshape = linseg(0, p3 * .5, 1, p3 * .5, 0) ;; range 0-1 for saw->square
  kwaveshape *= kwaveshape ;; adjust curve
  kwaveshape = $M_PI * (kwaveshape + 1) ;; adjust from PI->2PI
  kwaveshape = (cos(kwaveshape) * 0.5) + 0.5  ;; adjust to 0-1
  
  aphs = phasor(ifreq)

  ; init for feedback
  acar init 0 
  acar = tablei(aphs+(ntrpol(acar, a(1), kwaveshape)*acar*kfb), 1, 1, 0, 1)
  acar *= linen:a(1, 0.1, p3, 0.1) * iamp

  outc(acar, acar)
endin

I do not know if these calculations are what are used in the reface DX, but regardless, the sine->square sounded good to my ear and I felt it was usable for the kind of sound work I was interested in doing. For now, I have posted the Csound CSD project file here. The audio example at the top of this post is an MP3 version of the output rendered from this project.

Cheers!
Steven

Published
Categorized as csound