Page 1 of 1

arbitrary wavetables

Permanent link to this postPosted: Mon Feb 12, 2018 9:27 am
Posted by DERF
Hello.
My question concerns the wavetables other than *sine-table*, *saw-table* and tri-table*.In the case of a creation of a wavetable by the user, the principle is it the following one:
1. Take in a sample (a sound of trumpet for exemple) a quite small fragment (a period of the sound wave).
Code: Select all
(setf a-snd (s-read "demo-snd.aiff" :srate 22050.0))
 (setf "trumpet-table" (list (extract 0.110204 0.13932 (cue a-snd)) 24.84822 T))

In this example the file "demo-snd.aiff" is a recording of a trumpet.

2. Apply it to the second sample (a sound of clarinet for exemple):
Code: Select all
(abs-env ("clsound" dur *trumpet-table* bias))

Is it exact?

Thank you for your help.

Re: arbitrary wavetables

Permanent link to this postPosted: Mon Feb 12, 2018 10:51 am
Posted by steve
The "Latest version" of "High Quality (no alias) Tone generator" has examples of generating tones from custom wavetables.
https://forum.audacityteam.org/viewtopi ... 31#p156631

Example: In the "square-wav" function, a waveform "wave" is built (line 35) using "build-harmonic", and then converted to a wavetable and used to generate the tone in line 36.

(Line 37 just applies a bit of filtering to reduce overshoot of the waveform to make it look more "square",
Line 38 trims the start so that the tone starts cleanly.
Line 39 Normalizes and amplifies to the required peak level.)