I made a simple script referring to the article of Hack Audio.
A script for GNU Octave that creates a Wavetable by duplicating and crossfading two SCWs.
Put two SCWs and the following m flie in the same folder.
Note: Only 16 bit files can be created
Summary
%CrossFade
%Load waveforms
[x, FS] = audioread('1.wav');
[y, FS] = audioread('2.wav');
%Waveform length read
wavelength = length(y);
%Number of waveforms to copy
tnumber = 256 ; %Change the length freely
A = repmat(x,tnumber);
B = repmat(y,tnumber);
%Wavetable length
tablelength = wavelength * tnumber ;
%Linear FadeIn
linFadeIn = linspace(0,1,tablelength);
linFadeIn = linFadeIn(:);
for sample = 1 : length(linFadeIn)
FI(sample,1) = A(sample,1) * linFadeIn(sample,1);
end
%Linear FadeOut
linFadeOut = linspace(1,0,tablelength);
linFadeOut = linFadeOut(:);
for sample = 1 : length(linFadeOut)
FO(sample,1) = B(sample,1) * linFadeOut(sample,1);
end
%Fade In + Fade Out
out = FI + FO;
audiowrite('file.wav',out, FS);
Reference source