Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- fmt_head = """
- #defaults=no
- #patchname=no
- <?
- int OSC_WAVEFORM_SPECTROBLEND = 3;
- int i;
- float w1[128];
- """
- fmt_el = "w1[%d]=%.03f; "
- fmt_foot = """
- for( i = 1; i <= 1; i++ )
- {
- if (Oscillator[i].WaveForm == OSC_WAVEFORM_SPECTROBLEND)
- {
- Oscillator[i].WaveTable.set(1,w1);
- }
- }
- ?>
- """[:-1]
- if __name__ == "__main__":
- w = sys.stdout.write
- w(fmt_head)
- # Specify first 3 partials by hand (zero indexed)
- w(fmt_el % (0, 142.0/160))
- w(fmt_el % (1, 160.0/160))
- w(fmt_el % (2, 150.0/160))
- w("\n")
- # Partials 4 - 128 follow the 1/n algorithm
- for n in range(3,128):
- partial = 1.0 / (n - 2)
- w(fmt_el % (n, partial))
- if n > 0 and n % 8 == 0:
- w("\n")
- w(fmt_foot)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement