- wavetable using Waldorf Microwave "wave.bin" (16bit) is broken

- wavetable uses "wave2.bin" (8bit) Waveforms
-
This commit is contained in:
2025-08-05 19:36:59 +02:00
parent 12783fdfdb
commit 4a4d67f5f1
4 changed files with 25 additions and 24 deletions
+10 -24
View File
@@ -4,6 +4,7 @@
#include <math.h>
#include "synth_defs.h"
#include "synth_types.h"
#include "vector_utils.h"
#include "wavetable.h"
@@ -60,7 +61,8 @@ const wt_descr_t _g_wt_descr[WT_NUM_WAVETABLES] =
void WT_ModInit(wt_common_t *pCom)
{
UINT32 i, j, k, offset, last_pos, distance;
INT16 sample, wave[WT_WAVE_SIZE];
INT16 sample;
char wave[WT_WAVE_SIZE];
wt_descr_t const *pDesc;
synth_float_t kmix;
synth_float_t x, dx, wave_tri[WT_WAVE_SIZE], wave_sqr[WT_WAVE_SIZE], wave_saw[WT_WAVE_SIZE];
@@ -80,32 +82,16 @@ void WT_ModInit(wt_common_t *pCom)
for (j=0; j < 64; j++)
{
sample = ((INT16)pCom->wave_rawdata[128*i + 2*j + 0] << 8) + pCom->wave_rawdata[128*i + 2*j + 1];
#if 0
if (sample & 0x8000)
{
sample = 0xFFFF - sample + 1;
}
wave[j] = sample;
#endif
sample = (INT16)(pCom->wave_rawdata[64*i + j]);
wave[j] = sample - 127;
sample = (INT16)(pCom->wave_rawdata[64*i + 63 - j]);
wave[j + 64] = -(sample - 127);
}
// Possible assembly 1
wave[64] = 0;
for (j=0; j < 63; j++)
{
wave[65+j] = -wave[63-j];
}
// Possible assembly 2
// for (j=0; j < 64; j++)
// {
// wave[64+j] = -wave[63-j];
// }
for (j=0; j < WT_WAVE_SIZE; j++)
{
pCom->waves[offset+i][j] = (synth_float_t)wave[j]/8192;
pCom->waves[offset+i][j] = (synth_float_t)wave[j]/256;
}
#ifdef WAVE_EXPORT_FILE
@@ -117,7 +103,7 @@ void WT_ModInit(wt_common_t *pCom)
pFile = fopen(filename, "wb");
if (pFile)
{
fwrite(wave, 2, WT_WAVE_SIZE, pFile);
fwrite(wave, 1, WT_WAVE_SIZE, pFile);
fclose(pFile);
}
}
@@ -129,7 +115,7 @@ void WT_ModInit(wt_common_t *pCom)
for (i=0; i < 20; i++)
{
fwrite(wave, 2, WT_WAVE_SIZE, pFileAll);
fwrite(wave, 1, WT_WAVE_SIZE, pFileAll);
}
}
}
+3
View File
@@ -10,6 +10,9 @@
#define WT_NUM_WAVETABLES 40
#define WT_WAVETABLE_SIZE 64
// see
// https://jacajack.github.io/music/2019/12/10/PPG-EPROM.html
// --------------------------------------------------------------
// Types
// --------------------------------------------------------------