WaveShaper saved shapes

Post Reply
User avatar
monoben
Posts: 125
Joined: Wed Feb 26, 2014 11:09 am

WaveShaper saved shapes

Post by monoben » Thu Oct 16, 2014 6:42 am

Hi, sorry about the tongue twister title! :D What can you guys tell me about the files saved by the WaveShaper? Like its 16bit 44100 pcm audio right? I want to be able to generate more accurate shapes. Maybe there are files available for download that are mathematically perfect? I just don't seem to be able to draw what I need. So I was thinking maybe if I understood how to generate the shape I want that I could have precise to the sample control. Has anyone of you guys generated a wave and used it in the WaveShaper? If so did you do that for a reason? I'm trying to get perfect rectification of the signal.

User avatar
NightRadio
Site Admin
Posts: 3493
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: WaveShaper saved shapes

Post by NightRadio » Thu Oct 16, 2014 11:27 am

What can you guys tell me about the files saved by the WaveShaper? Like its 16bit 44100 pcm audio right?
256 of Unsigned 16bit samples. Without the 44100, because the frequency does not matter in this case.
For example, you can create this shape in Pixilang programming language http://warmplace.ru/soft/pixilang
The generator's source is very simple:

Code: Select all

f = fopen( "shape.raw", "wb" )
if f
{
    i = 0 while i < 256
    {
        value = i * 256 //Value must be from 0 to 65535

        //Save the value:
        fputc( value & 255, f ) fputc( ( value >> 8 ) & 255, f )

        //Next:
        i + 1
    }
    fclose( f )
}
Just replace the line "value = i * 256" by your own code

User avatar
monoben
Posts: 125
Joined: Wed Feb 26, 2014 11:09 am

Re: WaveShaper saved shapes

Post by monoben » Thu Oct 16, 2014 12:35 pm

Well I just made something :D .. Is i * 256 the value for the default WaveShaper shape? I changed the number to 2566 and got some zig zag thing. I'm still a bit confused but hey at least I can make WaveShaper shapes now :D so thank you once again NR! If you could point me in the right direction of how to get different harmonics from different values I would be most grateful :D

DaedalusYoung
Posts: 32
Joined: Sat Jan 28, 2012 7:07 am

Re: WaveShaper saved shapes

Post by DaedalusYoung » Tue Dec 30, 2014 7:03 pm

i * 256 will make a linear shape that starts at 0 and ramps up to 65535, which would indeed be the default shape. By changing 256 to a higher number, the calculation will eventually yield numbers higher than 65535. I assume this just wraps around to 0 again, so the zig-zag shape is expected. Try something like value = (i ^ 3) / 256 for a more interesting result. (assuming the notation is correct, I have no Pixilang experience)

Post Reply