arbitrary wavetables

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).
(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.

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

Is it exact?

Thank you for your help.

The “Latest version” of “High Quality (no alias) Tone generator” has examples of generating tones from custom wavetables.
https://forum.audacityteam.org/t/high-quality-no-alias-tone-generator/20889/1

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.)