Author Topic: Non-linear waveshaping on the PreenFM2  (Read 11905 times)

noyzelab

  • Team member
  • *
  • Posts: 7
    • View Profile
Non-linear waveshaping on the PreenFM2
« on: February 21, 2018, 01:00:24 PM »
Apologies if this has been discussed already? Have not seen anything about it so thought would post.

It is possible and very simple to do non-linear waveshaping on the PreenFM2 by setting carrier oscillators to 0Hz, and the selected waveform becomes the non-linear transfer / shaping function.

Its detailed in section 5.6 in this great little FM programming book by Herbert Janssen =>

http://www.herbert-janssen.de/doc/sy-prog.pdf

Be sure to check out his main page here =>

http://www.herbert-janssen.de/sy.html

This can be done on any FM synth where the osc's can be set to 0Hz.

noyzelab

  • Team member
  • *
  • Posts: 7
    • View Profile
Re: Non-linear waveshaping on the PreenFM2
« Reply #1 on: February 22, 2018, 12:01:48 AM »
Enclosed is a quick example as a sysex file.

This uses ALG1, op1 set to 0Hz. The mod wheel is mapped to IM1, which will give an example of the timbral change. Also try changing both operators waveshape.

To get classic waveshaping, I would suggest making some user text wavetables of Chebyshev polynomials =>

https://en.wikipedia.org/wiki/Chebyshev_polynomials

https://courses.cs.washington.edu/courses/cse490s/11au/lectures/E-Non-linearSynthesis.pdf

from the pdf =>
Cheby0 = 1
Cheby1 = x
Cheby2 = 2x^2 - 1
Cheby3 = 4x^3 - 3x
Cheby4 = 8x^4 - 8x^2 + 1
Cheby5 = 16x^5 - 20x^3 + 5x

...

Also see this paper for all the classic refs =>
A Tutorial on Non-Linear Distortion or Waveshaping Synthesis
C. Roads
Computer Music Journal
Vol. 3, No. 2 (Jun., 1979), pp. 29-34

can be read online free =>
https://www.jstor.org/stable/3680281?seq=1#page_scan_tab_contents


« Last Edit: February 24, 2018, 05:56:38 AM by noyzelab »

prephylve1

  • Team member
  • *
  • Posts: 23
    • View Profile
Re: Non-linear waveshaping on the PreenFM2
« Reply #2 on: February 25, 2018, 11:17:25 AM »
I made up my own preset with Alg4 using this technique on two operators with LFO’s at differentfrequencies and bias’ and it creates a great pwm effect! Thank you so much!

lokki

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
Re: Non-linear waveshaping on the PreenFM2
« Reply #3 on: February 26, 2018, 11:43:01 AM »
can you post your preset?

prephylve1

  • Team member
  • *
  • Posts: 23
    • View Profile
Re: Non-linear waveshaping on the PreenFM2
« Reply #4 on: February 26, 2018, 11:17:29 PM »
can you post your preset?

It's pseudo PWM so it still sounds somewhat FM but I think it's believable. I'm using ALG4 to enable two "oscillators" with PWM. Turn OP2 to SQUA to here both at the same time. It's currently off so it's easier to here the PWM effect. ENJOY!

Patch in a nutshell

ALGO4

OP1  OP4
  |       |
OP3  OP2
 
IM1 1.86
IM2 0.00
IM3 1.73
IM4 0.00

Op's
FTyp Keyb for all
OP1 & OP2 = 0.00
OP3 = 1.00
OP4 = 2.00

Matrix
LFO1 2.09 IM1
LFO2 0.67 IM3

LFO1 SIN 0.13 0.00 0.00
LFO2 SIN 0.22 0.00 0.00

prephylve1

  • Team member
  • *
  • Posts: 23
    • View Profile
Re: Non-linear waveshaping on the PreenFM2
« Reply #5 on: February 27, 2018, 03:17:17 AM »
Enclosed is a quick example as a sysex file.

This uses ALG1, op1 set to 0Hz. The mod wheel is mapped to IM1, which will give an example of the timbral change. Also try changing both operators waveshape.

To get classic waveshaping, I would suggest making some user text wavetables of Chebyshev polynomials =>

https://en.wikipedia.org/wiki/Chebyshev_polynomials

https://courses.cs.washington.edu/courses/cse490s/11au/lectures/E-Non-linearSynthesis.pdf

from the pdf =>
Cheby0 = 1
Cheby1 = x
Cheby2 = 2x^2 - 1
Cheby3 = 4x^3 - 3x
Cheby4 = 8x^4 - 8x^2 + 1
Cheby5 = 16x^5 - 20x^3 + 5x

...

Also see this paper for all the classic refs =>
A Tutorial on Non-Linear Distortion or Waveshaping Synthesis
C. Roads
Computer Music Journal
Vol. 3, No. 2 (Jun., 1979), pp. 29-34

can be read online free =>
https://www.jstor.org/stable/3680281?seq=1#page_scan_tab_contents

I found a Puredata patch that calculates Chebyshev Polynomials!
I first tried using the output of the array to quickly get 1024 plot points but it totally failed. >:( The waveform represented in the GUI for the array isn't the same as the output. I did get a really awesome ramp waveform that I'm going to use.

Next, I recorded the each polynomial at 46.87hz to get exactly 1024 samples and the waveforms sound amazing! ;D As you suspected the aliasing is greatly diminished. I'll post user waveform txt files tomorrow. In the meantime poke around the Pd file.

Credit for the Pd file goes to Simon2:
https://forum.pdpatchrepo.info/topic/4083/chebyshev-polynomials

Here's another great explanation of Chebyshev Polynomials just for reference:
http://sites.music.columbia.edu/cmc/MusicAndComputers/chapter4/04_06.php


noyzelab

  • Team member
  • *
  • Posts: 7
    • View Profile
Re: Non-linear waveshaping on the PreenFM2
« Reply #6 on: February 27, 2018, 05:11:03 AM »
>>>
I found a Puredata patch that calculates Chebyshev Polynomials!
I first tried using the output of the array to quickly get 1024 plot points but it totally failed. >:( The waveform represented in the GUI for the array isn't the same as the output. I did get a really awesome ramp waveform that I'm going to use.

Next, I recorded the each polynomial at 46.87hz to get exactly 1024 samples and the waveforms sound amazing! ;D As you suspected the aliasing is greatly diminished. I'll post user waveform txt files tomorrow. In the meantime poke around the Pd file.
<<<

Great stuff!

I'm doing a bunch of Chebyshev tables in Mathematica + the ones in Daniel Arfib's paper. Here are some quick tests at 1024 samples => T2 to T13 with graphic plots of the table function. I'll try a few at smaller sizes at some point too. Note that T11 has a big click [which I like of course!] as interpreted by Preen, and I think this is something to do with how the import works. ?? It will be interesting to hear the differences in table sizes too.


EDIT

Refs to Arfib's paper  =>

this is a free pdf, but is an early version with lot of handwritten bits =>

https://quod.lib.umich.edu/i/icmc/bbp2372.1978.009/1/--digital-synthesis-of-complex-spectra?page=root;size=100;view=text

and an even earlier one here =>

https://quod.lib.umich.edu/i/icmc/bbp2372.1977.001/--digital-synthesis-of-complex-spectra?rgn=main;view=fulltext

the full paper ended up in AES, but its behind the dreaded academic paywall =>

http://www.aes.org/e-lib/browse.cfm?elib=3178

with a slim chance of being able to maybe view online here for free? =>

https://www.researchgate.net/publication/243764314_Digital_Synthesis_of_Complex_Spectra_by_means_of_Multiplication_of_Non-linear_Distorted_Sine_Waves

+

I just spotted in my little example preset that OP1 is set to keybd, which would also normally be set to fixed for classic waveshaping. Having it track the keyboard will push it more or less away from zero hertz, depending on tuning table.

Which also reminded me that there is a little section on low frequency carriers in Chowning & Bristow, FM Theory and Applications: By Musicians for Musicians p97 - 102. 


EDIT 2

Marc Le Brun's classic AES paper Digital Waveshaping Synthesis is also behind paywall, have not located a readable version of this online => http://www.aes.org/e-lib/browse.cfm?elib=3212

I've got copies of both Arfib and Le Brun's papers, from photocopies I made in the 90s, but as they are copyrighted I obviously can't scan & upload them..


« Last Edit: February 27, 2018, 11:09:48 AM by noyzelab »

noyzelab

  • Team member
  • *
  • Posts: 7
    • View Profile
Re: Non-linear waveshaping on the PreenFM2
« Reply #7 on: February 27, 2018, 12:30:02 PM »
its probably ok to post this little photo snippet from Le Brun's AES paper =>

prephylve1

  • Team member
  • *
  • Posts: 23
    • View Profile
Re: Non-linear waveshaping on the PreenFM2
« Reply #8 on: February 28, 2018, 01:45:49 AM »
I noticed the clicking in my own tests when using the plot points of array in puredata. I come up with an entirely different waveset when I create tables based on audio snippets recorded from the output of puredata which seem to be more accurate for waveshaping purposes. I'll post my waveforms with jpegs below. I'll give your waveshapes a try as well :)

I also modified the puredata patch to include an oscilloscope and a more accurate way to input pitch, amplitude, and the amplitude of each polynomial. Enjoy :)

prephylve1

  • Team member
  • *
  • Posts: 23
    • View Profile
Re: Non-linear waveshaping on the PreenFM2
« Reply #9 on: February 28, 2018, 02:16:18 AM »
I'm doing a bunch of Chebyshev tables in Mathematica + the ones in Daniel Arfib's paper. Here are some quick tests at 1024 samples => T2 to T13 with graphic plots of the table function. I'll try a few at smaller sizes at some point too. Note that T11 has a big click [which I like of course!] as interpreted by Preen, and I think this is something to do with how the import works. ?? It will be interesting to hear the differences in table sizes too.

&

I just spotted in my little example preset that OP1 is set to keybd, which would also normally be set to fixed for classic waveshaping. Having it track the keyboard will push it more or less away from zero hertz, depending on tuning table.

I tried out your waveforms! It's interesting to hear the different results. Your's are more buzzy which makes me think the amplitude of your output is maybe too high? Mine was set just below the maximum threshold around 90% and as a result my waveforms are less buzzy. Either way this is all really great stuff!

I'll mess around with that fixed/keybd on OP1. Should be interesting.

Also as a note waveform Tx5 in my zip file has an incorrect header at the top of the text file. Forgot to add:
Tx5
1024
0