wave shaping query

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

wave shaping query

This post has NOT been accepted by the mailing list yet.

Short time Csound user, first time poster here.

I am currently undertaking a project for college, however I am very much a noob when it comes to gen tables in Csound, and I have encountered a problem.

Quick background of my project. The project is an analysis and recreation of a non-linear distortion/unipolar distortion pedal - The Harmonic Percolator. The analysis has been done to the best of my abilities. I am now at the stage that I need to build a patch in Csound to recreate this type of distortion.

I was originally planning on using using coefficients in a Chebyshev polynomial, however the output wasn't the same. I then used a Gen 9 table to reproduce the waveform, with various coefficients at different amplitudes and phases to approximate the Harmonic Percolator's output. This got me in the ball park for the output waveform I wanted but it wasn't quite on the money.

Having discovered I can use gen 16 to (more or less) plot a waveform, I decided this was a better way of doing things, as I can 'map' values, spacings, and curvature, at discreet points and "simply" plot a transfer function.  

I was able to dial in a few points which approximated the waveform output I wanted. However the output was mirrored within the cycle, as in, it completes it's cycle by reversing the transfer function, and is unlike the analysed waveform I want to emulate.

What I'm hoping to reduce is the mirroring effect I'm getting, as you can see from the image I have attached.
(the bottom waveform is the original Harmonic Percolator, the top my Gen 16 table output)

I am also attaching the code for the gen 16 table. I have begun the table a 0 and 1 in amplitude values and at several different start points e.g. 0, 256, 512, 1024 etc. The output always mirrors within the cycle.

If anyone can pinpoint something I am missing I would be very grateful. I'm sure it is something I am leaving out in the gen table itself. I'm just not sure what that is.

Thank you in advance.


giTF3 ftgen 0,0,4097,16,   -0.125, 786, -4, 0, 256, -20, 1, 1024, -5, 0.125, 1024, 5, -0.3, 1023, -5, -0.125

;giTF3 is a table I am using to try to plot a transfer function to graph like point, ie starting amplitude, samples travelled, curvature, next value.

instr 1
aSig poscil 1,110
aSig tablei (aSig*0.5)+0.5, giTF3, 1 ;plotted transfer function
aSig dcblock2 aSig
out aSig