Single cycle wavetable, transients and spiking.

Status
Not open for further replies.

RABB17

Well-known member
Hello all,

So I have been working to get the wavetable object to properly recreate single cycle... initially the high pass filter on the SGTL5000 was injecting so much noise I couldn't properly visually assess the issue. Following forum advice I disabled this and was able to get a much nicer waverform on my scope. Alas, artifacts remain. However, by examining the output of the scope I noticed that large transient spikes were present. These transients do not occur using this same wavetable on other wavetable synthesizers, nor do they occur in the Sf2 font played through PC midi mapper. I have included a picture, any ideas what might be causing this? In order to perform FM modulation of these single cycles I need them to be clean... not to mention the transient spikes add a nasty frequency-dependent clicking.

Thanks for your time!

spikes.jpg
IMG_20200124_095123_kindlephoto-53272586.jpg
 
Last edited:
Just ran the this test with 127 diff single cycles, all exhibit this transient spiking. The waveforms differ in their curvature eg sines vs fm waves vs ramps etc, and they are dumped directly to pow2 multiples of the audio samples. Out of curiosity has anyone had any success with single cycles?
 
I came across something interesting... I lowered the clock speed to 150 MHz on a hunch and the waveform is free from noise now, outside of the very distinct transient voltage spike.
waveform.jpg
 
I'm feeling optimistic with the noise removed. I'll post an update here if get it solved. I have a hunch that the reason other established soundfonts don't exhibit this behavior due to ADSR stage.
 
Last edited:
Ok so I'm imagining things the cpu freq doesn't affect the wave noise. Playing with the samples I have more closely it looks like it is only occuring in waveforms with sharp corners, and it looks very much like a Gibbs artifact.
 
It might be that also the headphone amplifier is another possible source of noise, see

https://forum.pjrc.com/threads/27215-24-bit-audio-boards?p=78831&viewfull=1#post78831

Sometimes on some clock domains there may be artefacts caused by jitter. There are means how to tune the clock generation so that the frequencies will not interfere audio band but are pushed above it, that called noise shaping. Not sure if that related to your problems though, but check the headphone amp as well, glad to hear that disabling the HPF helped some.
 
It might be that also the headphone amplifier is another possible source of noise, see

https://forum.pjrc.com/threads/27215-24-bit-audio-boards?p=78831&viewfull=1#post78831

Sometimes on some clock domains there may be artefacts caused by jitter. There are means how to tune the clock generation so that the frequencies will not interfere audio band but are pushed above it, that called noise shaping. Not sure if that related to your problems though, but check the headphone amp as well, glad to hear that disabling the HPF helped some.

I'll do some investigating today. I spent some time reading Digital Waveform Generation, by Pete Symons yesterday. These transients seem to appear at the start of the generated waveform. I am beginning to wonder if it has something to do with interpolation step in the wavetable code. Unfortunately, I don't think anyone else on the board has posted anything regarding single cycle generation of waveforms. They all appear to be using pre rolled soundfounts. It's showing up even on very smooth rounded waveforms. I've been avoiding it but I may just rewrite the wavetable object, using some methods I've found outlined in the referenced book.
 
Here is another waveform, smooth, differentiable at all points ringing artifact persists. The artifacts present themselves as freq dep clicking. Very annoying.

thumbnail_IMG_20200125_094232_kindlephoto-138620387.jpg
 
Here is another waveform, smooth, differentiable at all points ringing artifact persists. The artifacts present themselves as freq dep clicking. Very annoying.

View attachment 18864

Please be more specific, which code are you running? Have you tried running the other Teensy audio library demos, do they have this same problem. Soundfonts also have loops which are kind of single cycle waveforms so that's not problem. If you have some own implementation please post you're code (it's the forum rule).
 
Please be more specific, which code are you running? Have you tried running the other Teensy audio library demos, do they have this same problem. Soundfonts also have loops which are kind of single cycle waveforms so that's not problem. If you have some own implementation please post you're code (it's the forum rule).

Sorry if it wasn't clear: http://github.com/PaulStoffregen/Audio/blob/master/synth_wavetable.h

It is just the audio library wavetable object. As to specifically single cycle soundfonts I am unaware of any readily available sf2 packages of them, however I could be mistaken. Most soundfonts I've opened up have the ASDR set and consist of longer samples with a set loop over the portion of the waveform. Here the single cycles are ripped directly from commercial wavetable synths at multiples of 2 of the audioblock size eg 256 or 2048, they don't have the ASDR set. None of the other soundfont extras either. Just the cycle sampled at the required frequency for the audio block size.
 
Last edited:
This particular waveform is exported directly from a commercial wavetable synthesizer. I have done a similar process from other commercial wavetable synths, as well as well known single cycle collections from the net, and all are exhibiting this behavior.

waave.jpg
 
wav.png

If you compare this image and the first very first one posted at the top of the thread, you can see the artifact is occurring at the end of the cycle. Exactly, and duplicated in every octave up eg 1 2 3 4 5 times depending on the octave.

I mentioned the audio library object used but neglected to state I am using the midisynth example code from audio/synthesis/wavetable/ in the drop down menu in the ide. The only code I have changed is the wavetables included.
 
Last edited:
At any rate, the very same soundfonts encoded that are then ripped through the decoder do not exhibit this behavior when played through any pc midi. So it is something specific happening with the teensy 4 + audio itself. Or possibly the way the code treats the wavetables, I'm not sure. If anyone is interested I can throw the .sf2 on my google drive and they can try it themselves.
 
Here is the wavetable decoded by the sf2 decoder for teensy -

AKWF_0001_samples.h:

Code:
#pragma once
#include <Audio.h>
extern const AudioSynthWavetable::instrument_data AKWF_0001;

AKWF_0001_samples.cpp:

Code:
#include "AKWF_0001_samples.h"

static const uint32_t sample_0_AKWF_0001_AKWF_0001[1024] = {
0x93029302,0x93039303,0x93039304,0x92db92e5,0x92c492d0,0x92ac92b8,0x9294929f,0x927f9288,
0x92709276,0x926b926c,0x9272926c,0x9289927b,0x92b3929b,0x92f492d1,0x9350931f,0x93ca9389,
0x94659414,0x952594c0,0x960a9593,0x99a6967d,0x9d8a9c82,0x9fbd9e9d,0xa17ca0ea,0xa297a20a,
0xa3aaa321,0xa4b5a430,0xa5baa539,0xa6baa63a,0xa7b5a738,0xa8a8a830,0xa99aa921,0xaa87aa0f,
0xab70aafb,0xac55abe2,0xad36acc6,0xae0fada4,0xb75bae5d,0xb8f1b856,0xba1fb989,0xbb43bab3,
0xbc57bbcf,0xbd5dbcdc,0xbe53bdd9,0xbf3dbec9,0xc01dbfaf,0xc0f2c08a,0xc1c1c15b,0xc289c226,
0xc34cc2eb,0xc409c3ac,0xc4c1c465,0xc579c51d,0xc63ec5d7,0xd0f6c75f,0xd182d100,0xd27bd201,
0xd363d2f1,0xd43dd3d2,0xd50bd4a5,0xd5ccd56d,0xd684d62a,0xd730d6dc,0xd7d5d784,0xd873d825,
0xd909d8bf,0xd99ad953,0xda26d9e1,0xdaa9da69,0xdb2cdaeb,0xdb6bdb66,0xe8e0e316,0xea13e984,
0xeb08ea93,0xebd8eb73,0xec92ec38,0xed39ece8,0xedd1ed87,0xee5bee19,0xeeddee9e,0xef55ef1a,
0xefc3ef8e,0xf02ceff9,0xf08ff05e,0xf0eaf0bd,0xf141f115,0xf18ff169,0xf1b9f1b6,0xfdf6fce7,
0xfeb8fe5c,0xff65ff11,0xffffffb4,0x00860045,0x00fc00c4,0x015f0130,0x01b5018b,0x01ff01db,
0x023f0220,0x0278025c,0x02a90292,0x02d302bf,0x02fb02e6,0x031c030c,0x033a032a,0x02480347,
0xfc86fc3d,0xfc68fc7a,0xfc48fc57,0xfc2efc3b,0xfc1dfc25,0xfc0ffc16,0xfc0bfc0d,0xfc0bfc0a,
0xfc10fc0d,0xfc1bfc15,0xfc26fc21,0xfc36fc2e,0xfc4bfc40,0xfc5efc55,0xfc75fc68,0xfc92fc82,
0xff3cfc9f,0x021e01c6,0x02850257,0x02d502af,0x031802f7,0x03530337,0x038c0370,0x03c003a6,
0x03f303db,0x0425040c,0x0455043e,0x0481046c,0x04b00498,0x04db04c6,0x050904f1,0x053b0521,
0x0595055e,0xf0c9064d,0xf21df20f,0xf1adf1f0,0xf121f167,0xf0a2f0de,0xf042f06e,0xf007f021,
0xefe8eff4,0xefe6efe5,0xeffaefef,0xf01af008,0xf049f02e,0xf07df063,0xf0b8f09b,0xf0f8f0d7,
0xf131f116,0xf11df141,0xdb77ef71,0xda82daee,0xda0bda3b,0xd9dbd9ee,0xd9cfd9d1,0xd9d9d9d2,
0xd9f6d9e6,0xda27da0b,0xda65da45,0xdab0da89,0xdb0cdada,0xdb6fdb3b,0xdbdddba4,0xdc55dc19,
0xdcd8dc96,0xdd66dd1e,0xde17ddb1,0xda1edb91,0xda90da5b,0xdafedac6,0xdb79db3a,0xdbfbdbb8,
0xdc87dc3f,0xdd1ddcd0,0xddb6dd68,0xde54de05,0xdef7dea5,0xdf99df46,0xe040dfeb,0xe0e9e095,
0xe192e13d,0xe240e1e9,0xe2eee296,0xe395e349,0xed0febd4,0xee1feda0,0xef12ee9a,0xeff4ef85,
0xf0cbf061,0xf198f132,0xf25af1fa,0xf310f2b5,0xf3c2f369,0xf46cf418,0xf510f4be,0xf5adf560,
0xf64af5fc,0xf6e1f695,0xf773f72a,0xf802f7bb,0xfa0bf842,0x025e029d,0x031702b5,0x03d90379,
0x04900436,0x053a04e5,0x05d8058b,0x06670621,0x06ec06aa,0x0767072b,0x07db07a2,0x08450811,
0x08ab0878,0x090b08db,0x0969093b,0x09c30996,0x0a1c09f0,0x0d900a42,0x11081082,0x11a0115d,
0x121011dc,0x126d1241,0x12c2129a,0x130c12e8,0x1350132d,0x13931373,0x13d013b2,0x140813ec,
0x143d1423,0x146f1457,0x149b1485,0x14c114af,0x14da14cf,0x14c914db,0x2f431433,0x2ec52e91,
0x2fb12f32,0x30b43034,0x31a23130,0x326a320b,0x330832bd,0x337c3347,0x33d633ad,0x341733fa,
0x3440342d,0x3459344e,0x3464345f,0x34653465,0x345c3460,0x344f3455,0x34453445,0x38b134d1,
0x38cd38bb,0x38e538da,0x38f138ec,0x38f138f2,0x38ec38ef,0x38e238e6,0x38d138d9,0x38bb38c6,
0x38a138b0,0x38853893,0x38633875,0x38403852,0x3819382d,0x37ef3804,0x37c037d8,0x377637a8,
0x3e823bb4,0x3ec53eaa,0x3eed3edb,0x3f013ef8,0x3f0b3f07,0x3f0d3f0e,0x3f053f09,0x3ef63eff,
0x3ee23eec,0x3ec73ed5,0x3ea93eb8,0x3e863e98,0x3e633e76,0x3e3a3e4e,0x3e0d3e24,0x3ddd3df7,
0x3d943dc2,0x44d944a8,0x44f844e9,0x45144507,0x4528451f,0x4533452f,0x45304533,0x4524452b,
0x450d4518,0x44f044fe,0x44cd44df,0x44a644b9,0x447a4490,0x444b4463,0x44174430,0x43df43fc,
0x43a343c1,0x42d6437b,0x3e1e3e22,0x3db63de9,0x3d563d84,0x3cfb3d28,0x3ca63cd1,0x3c553c7f,
0x3c053c2c,0x3bb93bdf,0x3b703b94,0x3b2a3b4d,0x3ae63b08,0x3aa63ac6,0x3a643a84,0x3a233a43,
0x39e53a03,0x39aa39c6,0x37b9399f,0x27a936db,0x22bf23a7,0x21892218,0x20902107,0x1fbd2024,
0x1f0c1f62,0x1e751ebd,0x1df01e30,0x1d7e1db4,0x1d191d49,0x1cc31ced,0x1c721c99,0x1c2c1c4e,
0x1bee1c0c,0x1bb91bd3,0x1b8c1ba2,0x1b761b79,0x09c71b8c,0x08fa095b,0x082c0893,0x076c07ca,
0x06c10714,0x06300675,0x05b705f1,0x05550584,0x0507052b,0x04c704e5,0x049204aa,0x046a047e,
0x044c045a,0x0434043f,0x0425042c,0x041c0420,0x05960417,0x0ad10760,0x0ad70ac0,0x0b020aee,
0x0b230b14,0x0b3d0b30,0x0b500b47,0x0b600b58,0x0b6a0b66,0x0b730b6f,0x0b750b72,0x0b750b75,
0x0b720b73,0x0b6d0b6f,0x0b660b6b,0x0b5e0b61,0x0b530b58,0x0ba90b4e,0x058d0842,0x04f90531,
0x04a104c9,0x045d047d,0x0423043f,0x03ef0408,0x03c003d7,0x039503a9,0x036b037f,0x03460358,
0x03240335,0x03050314,0x02e802f7,0x02cc02db,0x02af02bd,0x028e02a3,0x02550275,0x0e180ec9,
0x0e390e1a,0x0e8d0e63,0x0ee40eba,0x0f2e0f0b,0x0f670f4d,0x0f8e0f7e,0x0fa70f9b,0x0fb50faf,
0x0fba0fb9,0x0fb50fb8,0x0fad0fb3,0x0f9f0fa8,0x0f8d0f97,0x0f7d0f85,0x0f6f0f74,0x13d00f67,
0x1c2a1bc5,0x1cb11c79,0x1cfc1cdb,0x1d271d15,0x1d421d36,0x1d4f1d49,0x1d501d50,0x1d491d4d,
0x1d3b1d42,0x1d241d30,0x1d0a1d18,0x1ce81cfb,0x1cbf1cd5,0x1c951cac,0x1c611c7b,0x1c2d1c46,
0x25031c12,0x256e2557,0x258c257f,0x259c2596,0x25a025a0,0x2593259b,0x25792588,0x25532567,
0x2528253f,0x24f2250d,0x24b624d5,0x24752496,0x24302452,0x23e4240c,0x239723bd,0x2347236f,
0x22c7231b,0x2bab272f,0x2b902b8b,0x2b8f2b91,0x2b7d2b88,0x2b5b2b6f,0x2b2d2b47,0x2af52b13,
0x2ab62ad7,0x2a6e2a91,0x2a212a47,0x29ce29f8,0x297529a2,0x291c294a,0x28be28ec,0x285b288c,
0x27f9282a,0x27ac27cb,0x2d262dc0,0x2cdd2cfc,0x2ca22cbf,0x2c642c83,0x2c1e2c42,0x2bd32bf9,
0x2b802baa,0x2b272b54,0x2aca2af8,0x2a672a98,0x29fe2a33,0x299629cb,0x292a2961,0x28bc28f2,
0x284d2884,0x27e32814,0x1fdb25b8,0x1f6d1fc6,0x1ebc1f13,0x1e141e66,0x1d731dc3,0x1cde1d27,
0x1c511c96,0x1bcb1c0e,0x1b4c1b8b,0x1ad41b0f,0x1a5d1a98,0x19ee1a27,0x198219b9,0x1919194d,
0x18c218ee,0x187a1897,0x196f1874,0xad1cc201,0xa6b2a95d,0xa247a45e,0x9eb5a06a,0x9bcc9d2a,
0x99729a8c,0x97969876,0x961f96cf,0x95029586,0x94319491,0x93a193e2,0x9349936d,0x9322932e,
0x9322931d,0x9345932f,0x93829361,0x929d939c,0x8cef8ccc,0x8d248d04,0x8d7e8d4e,0x8df68db6,
0x8e828e39,0x8f208ed0,0x8fcf8f76,0x90869029,0x914990e6,0x921891b0,0x92ec9282,0x93c89359,
0x94a79436,0x958b9519,0x967095fd,0x974996df,0x9e319775,0x9f2d9eb0,0xa0499fb9,0xa170a0dd,
0xa295a203,0xa3afa324,0xa4c2a43a,0xa5caa548,0xa6caa64b,0xa7c7a749,0xa8baa841,0xa9aaa933,
0xaa96aa21,0xab7eab0b,0xac63abf1,0xad48acd5,0xae2badbc,0xb7dfb1c3,0xb933b88a,0xba64b9d0,
0xbb78baf0,0xbc7abbfb,0xbd71bcf7,0xbe5fbde9,0xbf41bed2,0xc020bfb1,0xc0f5c08c,0xc1c4c15d,
0xc28bc228,0xc34fc2ed,0xc40cc3af,0xc4c4c468,0xc580c520,0xc6acc5ec,0xd093d000,0xd1a3d120,
0xd29ad222,0xd37fd30f,0xd454d3ea,0xd51bd4b8,0xd5d8d57b,0xd68dd634,0xd735d6e1,0xd7d7d787,
0xd874d827,0xd908d8be,0xd996d94f,0xda1ed9da,0xdaa8da67,0xdb24dae8,0xe64edb2b,0xe941e890,
0xea4ae9cc,0xeb2ceabf,0xebf6eb93,0xeca9ec52,0xed49ecfb,0xeddded95,0xee64ee21,0xeee0eea3,
0xef53ef1a,0xefbdef89,0xf020efef,0xf07ff050,0xf0d7f0ac,0xf12af100,0xf148f150,0xfd4ff80d,
0xfe61fde9,0xff1efec5,0xffb5ff6d,0x0033fff6,0x009e006a,0x00fe00ce,0x01510129,0x019b0177,
0x01dd01bc,0x021801fc,0x024d0234,0x027c0266,0x02a50291,0x031502b7,0x03350326,0x013c034a,
0xfc3bfc2a,0xfc0ffc25,0xfbf0fbfd,0xfbdbfbe4,0xfbcdfbd4,0xfbc8fbc8,0xfbc3fbc5,0xfbc5fbc4,
0xfbcbfbc7,0xfbd4fbcf,0xfbe0fbd9,0xfbf0fbe8,0xfc02fbf9,0xfc18fc0d,0xfd39fc61,0xfd62fd4c,
0x01e5fdfc,0x01ed01ce,0x02380212,0x0282025e,0x02c802a6,0x030a02ea,0x03440325,0x037d0360,
0x03af0397,0x03de03c7,0x040d03f6,0x04380422,0x0460044c,0x04890473,0x04b2049d,0x04ee04d3,
0x045e050b,0xf13ff023,0xf112f13c,0xf0a3f0dc,0xf038f06d,0xefe5f009,0xefa8efc2,0xef84ef93,
0xef77ef7b,0xef7eef78,0xef96ef88,0xefbdefa9,0xefeeefd4,0xf028f00b,0xf06bf049,0xf0a8f090,
0xefb0ef7c,0xd9a6efc4,0xda4fda51,0xd9fdda2b,0xd9a5d9cf,0xd963d97f,0xd93fd94c,0xd93bd939,
0xd955d944,0xd988d96c,0xd9d5d9ac,0xda31da01,0xda9bda64,0xdb10dad5,0xdb8edb4f,0xdc15dbd2,
0xdc29dc5b,0xdbe3dbae,0xd94dd91c,0xd9c0d986,0xda37d9fa,0xdabada77,0xdb42dafd,0xdbd0db87,
0xdc63dc18,0xdcfbdcad,0xdd9cdd4b,0xde3fdded,0xdee6de92,0xdf8edf39,0xe037dfe1,0xe0e0e08c,
0xe18ce136,0xe23de1e4,0xeb6ee2c0,0xecbbec30,0xedb6ed3a,0xeea2ee2e,0xef7cef11,0xf04fefe8,
0xf117f0b5,0xf1d4f177,0xf28bf231,0xf33af2e3,0xf3e2f38f,0xf484f433,0xf520f4d3,0xf5b8f56c,
0xf64cf602,0xf6e0f695,0xf787f732,0x01560101,0x022701c0,0x02f0028c,0x03a8034e,0x045203ff,
0x04f004a3,0x0582053a,0x060905c7,0x0688064a,0x06ff06c4,0x076c0736,0x07d507a1,0x08350805,
0x08920866,0x08ed08c1,0x09430916,0x10c309af,0x1074104f,0x10e110a7,0x1152111b,0x11be1189,
0x122011f1,0x1278124d,0x12c912a2,0x131012ed,0x13501330,0x1389136c,0x13bc13a2,0x13ea13d3,
0x14161400,0x143f142b,0x146b1455,0x17a0147d,0x2e0b27f5,0x2f2f2e96,0x30302fb6,0x30ff309d,
0x31a83158,0x323331f1,0x32a53270,0x330032d5,0x33473326,0x337d3363,0x33a43392,0x33bb33b0,
0x33ca33c5,0x33d033d0,0x33ce33d0,0x33c233c8,0x333e3391,0x37b3357d,0x381d37fd,0x38423834,
0x384e384b,0x384a384c,0x383e3845,0x382e3837,0x381a3824,0x3802380e,0x37e637f5,0x37c937d7,
0x37a737b8,0x37823795,0x375d3770,0x3735374a,0x36d23720,0x365636a0,0x3daa3c5a,0x3ddd3dc7,
0x3e013df0,0x3e193e0f,0x3e2a3e23,0x3e2f3e2e,0x3e2a3e2e,0x3e203e26,0x3e0f3e17,0x3df53e02,
0x3dd93de8,0x3db93dca,0x3d953da7,0x3d6e3d82,0x3d443d59,0x3cfa3d16,0x3c583cd5,0x440343c6,
0x440243fc,0x441d440f,0x44364429,0x4445443e,0x444c444a,0x4446444a,0x4437443f,0x441e442a,
0x43ff440e,0x43d843eb,0x43af43c6,0x43854399,0x43744371,0x40a24142,0x40604083,0x3f884039,
0x3d2d3d59,0x3cc83cf9,0x3c6e3c9a,0x3c1f3c46,0x3bd33bf9,0x3b8c3baf,0x3b483b69,0x3b053b26,
0x3ac33ae4,0x3a833aa4,0x3a473a65,0x3a0c3a29,0x39e739f0,0x367537f9,0x3636365a,0x3612361d,
0x266c36c2,0x228c235b,0x216c21f5,0x207920ee,0x1fab200e,0x1efd1f51,0x1e6d1eb2,0x1ded1e2a,
0x1d801db4,0x1d221d4f,0x1cd01cf7,0x1c8a1cad,0x1c4c1c6b,0x1c3c1c41,0x1c101c24,0x1be51bfb,
0x1baf1bd1,0x09d91b48,0x096109c2,0x089f08ff,0x07ee0843,0x0750079c,0x06c9070a,0x0655068c,
0x05f80624,0x05ab05d0,0x056d058a,0x053f0555,0x0511052b,0x08340697,0x083e083b,0x083d083f,
0x0838083a,0x082b0833,0x0c4708b5,0x0c0a0c06,0x0c200c14,0x0c370c2d,0x0c4c0c42,0x0c590c53,
0x0c640c5f,0x0c690c67,0x0c6a0c6a,0x0c6b0c6c,0x0c680c6a,0x0d690cee,0x0d7c0d79,0x0d780d7b,
0x0d6c0d72,0x0d5d0d64,0x0d600d57,0x069007a5,0x0618064c,0x05bd05ea,0x056e0594,0x05260549,
0x04e80506,0x04b204cb,0x04810497,0x0453046a,0x042c043f,0x04010414,0x03de03f1,0x03c103d0,
0x03a703b4,0x038b0398,0x0373037f,0x033f0365,0x0e5c0b12,0x0f1b0ed2,0x0f810f52,0x0fc70fa6,
0x0ffb0fe3,0x10211010,0x103a1030,0x104f1046,0x10581055,0x108b108e,0x1089108b,0x10821086,
0x1076107c,0x1066106e,0x1053105d,0x10411049,0x102f103b,0x1c23161b,0x1d0d1cb5,0x1d761d49,
0x1db11d99,0x1dd11dc3,0x1ddf1ddb,0x1de61de4,0x1dd91de3,0x1db51dbe,0x1da11dad,0x1d851d93,
0x1d641d76,0x1d3d1d52,0x1d141d29,0x1ce51cfd,0x1cb81cce,0x1cb01ca7,0x259d1dcc,0x25ed25c7,
0x26122604,0x26182617,0x26092612,0x25f225ff,0x25ce25e1,0x25a325b9,0x2575258f,0x253d2559,
0x25012520,0x24bf24e1,0x247a249e,0x24322456,0x23e4240b,0x239423bc,0x233a2368,0x2b3e22ec,
0x2bb32ba7,0x2bb42bb5,0x2ba62bae,0x2b8e2b9c,0x2b5c2b7b,0x2b2b2b45,0x2aed2b0e,0x2aa82aca,
0x2a5f2a83,0x2a0c2a36,0x29b629e1,0x295b2989,0x28fe292d,0x289d28ce,0x283a286c,0x27d32807,
0x297d2791,0x2cfe2d47,0x2cca2ce3,0x2c932cb0,0x2c552c76,0x2c0b2c30,0x2bbc2be6,0x2b672b92,
0x2b0b2b39,0x2aab2adb,0x2a462a7a,0x29de2a14,0x297529aa,0x290a2940,0x289c28d4,0x282d2865,
0x27bd27f5,0x27532783,0x1fbe2124,0x1ed21f3b,0x1e161e71,0x1d6d1dc1,0x1cd51d21,0x1c441c8b,
0x1bbc1bff,0x1b3a1b79,0x1abe1afc,0x1a471a81,0x19d41a0c,0x1965199c,0x18f6192f,0x189318c7,
0x18461868,0x18121826,0x1869181c,0x9ca61338,0xa719a6f5,0xa450a5ed,0xa0c9a292,0x9d4e9f03,
0x9a459bba,0x97cc98f6,0x95a2969c,0x943794d8,0x935893b8,0x92de9311,0x92a992bc,0x929f929f,
0x92b092a5,0x92ce92be,0x92f192e0,0x93119302,0x92bc931b,0x91bd9190,0x920691e2,0x92489228,
0x92819266,0x92ae9299,0x92d092c1,0x92e892de,0x92f792f1,0x93039304,0x93039303,0x93029302,

};

static const AudioSynthWavetable::sample_data AKWF_0001_samples[1] = {
	{
		(int16_t*)sample_0_AKWF_0001_AKWF_0001, // sample
		true, // LOOP
		12, // LENGTH_BITS
		(1 << (32 - 12)) * WAVETABLE_CENTS_SHIFT(0) * 44100.0 / WAVETABLE_NOTE_TO_FREQUENCY(41) / AUDIO_SAMPLE_RATE_EXACT + 0.5, // PER_HERTZ_PHASE_INCREMENT
		((uint32_t)2048 - 1) << (32 - 12), // MAX_PHASE
		((uint32_t)2047 - 1) << (32 - 12), // LOOP_PHASE_END
		(((uint32_t)2047 - 1) << (32 - 12)) - (((uint32_t)0 - 1) << (32 - 12)), // LOOP_PHASE_LENGTH
		uint16_t(UINT16_MAX * WAVETABLE_DECIBEL_SHIFT(0)), // INITIAL_ATTENUATION_SCALAR
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DELAY_COUNT
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // ATTACK_COUNT
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // HOLD_COUNT
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DECAY_COUNT
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // RELEASE_COUNT
		int32_t((1.0 - WAVETABLE_DECIBEL_SHIFT(0.0)) * AudioSynthWavetable::UNITY_GAIN), // SUSTAIN_MULT
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // VIBRATO_DELAY
		uint32_t(8.2 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // VIBRATO_INCREMENT
		(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // VIBRATO_PITCH_COEFFICIENT_INITIAL
		(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // VIBRATO_COEFFICIENT_SECONDARY
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // MODULATION_DELAY
		uint32_t(8.2 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // MODULATION_INCREMENT
		(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // MODULATION_PITCH_COEFFICIENT_INITIAL
		(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // MODULATION_PITCH_COEFFICIENT_SECOND
		int32_t(UINT16_MAX * (WAVETABLE_DECIBEL_SHIFT(0) - 1.0)) * 4, // MODULATION_AMPLITUDE_INITIAL_GAIN
		int32_t(UINT16_MAX * (1.0 - WAVETABLE_DECIBEL_SHIFT(0))) * 4, // MODULATION_AMPLITUDE_FINAL_GAIN
	},
};

static const uint8_t AKWF_0001_ranges[] = {127, };

const AudioSynthWavetable::instrument_data AKWF_0001 = {1, AKWF_0001_ranges, AKWF_0001_samples };

I even went so far as to pad the head and tail of the table manually to ensure the transition was smooth from that standpoint - (0x93039304, 0x93039303, 0x93029302 mirrored at beginning and end)
 
Last edited:
AKWF_0001_samples.cpp:

Code:
((uint32_t)2048 - 1) << (32 - 12), // MAX_PHASE
((uint32_t)2047 - 1) << (32 - 12), // LOOP_PHASE_END
(((uint32_t)2047 - 1) << (32 - 12)) - (((uint32_t)0 - 1) << (32 - 12)), // LOOP_PHASE_LENGTH
I am wondering if this bit might have something do with it
 
@RABB17 - in a single post could you put all the code that would allow us to reproduce your issue
 
@RABB17 - in a single post could you put all the code that would allow us to reproduce your issue

Apologies, my forum etiquette isn't what it should be I'm afraid.

midisynth.cpp:

Code:
/* Play notes when your computer sends USB MIDI messages.

   To use this example, you must run software on your computer which
   sends MIDI.  Tools > USB Type must be set to MIDI when uploading.

   Requires Teensy 3.6 due to 520 kbytes of wavetable data
   Requires Audio Shield: https://www.pjrc.com/store/teensy3_audio.html
*/

// TODO: smaller samples, to fit in Teensy 3.2 memory
#include "AKWF_0001_samples.h"

#include <Bounce.h>
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

//#define DEBUG_ALLOC

const int TOTAL_VOICES = 64;
const int TOTAL_MIXERS = 21;
const int SECONDARY_MIXERS = 4;

AudioControlSGTL5000 sgtl5000_1;
AudioSynthWavetable wavetable[TOTAL_VOICES];
AudioMixer4 mixer[TOTAL_MIXERS];
AudioOutputI2S i2s1;
AudioConnection patchCord[] = {
  {wavetable[0], 0, mixer[0], 0}, {wavetable[1], 0, mixer[0], 1}, {wavetable[2], 0, mixer[0],  2}, {wavetable[3], 0, mixer[0],  3}, {mixer[0], 0, mixer[TOTAL_MIXERS - 2], 0},
  {wavetable[4], 0, mixer[1], 0}, {wavetable[5], 0, mixer[1], 1}, {wavetable[6], 0, mixer[1],  2}, {wavetable[7], 0, mixer[1],  3}, {mixer[1], 0, mixer[TOTAL_MIXERS - 2], 1},
  {wavetable[8], 0, mixer[2], 0}, {wavetable[9], 0, mixer[2], 1}, {wavetable[10], 0, mixer[2],  2}, {wavetable[11], 0, mixer[2],  3}, {mixer[2], 0, mixer[TOTAL_MIXERS - 2], 2},
  {wavetable[12], 0, mixer[3], 0}, {wavetable[13], 0, mixer[3], 1}, {wavetable[14], 0, mixer[3],  2}, {wavetable[15], 0, mixer[3],  3}, {mixer[3], 0, mixer[TOTAL_MIXERS - 2], 3},
  {wavetable[16], 0, mixer[4], 0}, {wavetable[17], 0, mixer[4], 1}, {wavetable[18], 0, mixer[4],  2}, {wavetable[19], 0, mixer[4],  3}, {mixer[4], 0, mixer[TOTAL_MIXERS - 3], 0},
  {wavetable[20], 0, mixer[5], 0}, {wavetable[21], 0, mixer[5], 1}, {wavetable[22], 0, mixer[5],  2}, {wavetable[23], 0, mixer[5],  3}, {mixer[5], 0, mixer[TOTAL_MIXERS - 3], 1},
  {wavetable[24], 0, mixer[6], 0}, {wavetable[25], 0, mixer[6], 1}, {wavetable[26], 0, mixer[6],  2}, {wavetable[27], 0, mixer[6],  3}, {mixer[6], 0, mixer[TOTAL_MIXERS - 3], 2},
  {wavetable[28], 0, mixer[7], 0}, {wavetable[29], 0, mixer[7], 1}, {wavetable[30], 0, mixer[7],  2}, {wavetable[31], 0, mixer[7],  3}, {mixer[7], 0, mixer[TOTAL_MIXERS - 3], 3},
  {wavetable[32], 0, mixer[8], 0}, {wavetable[33], 0, mixer[8], 1}, {wavetable[34], 0, mixer[8],  2}, {wavetable[35], 0, mixer[8],  3}, {mixer[8], 0, mixer[TOTAL_MIXERS - 4], 0},
  {wavetable[36], 0, mixer[9], 0}, {wavetable[37], 0, mixer[9], 1}, {wavetable[38], 0, mixer[9],  2}, {wavetable[39], 0, mixer[9],  3}, {mixer[9], 0, mixer[TOTAL_MIXERS - 4], 1},
  {wavetable[40], 0, mixer[10], 0}, {wavetable[41], 0, mixer[10], 1}, {wavetable[42], 0, mixer[10], 2}, {wavetable[43], 0, mixer[10], 3}, {mixer[10], 0, mixer[TOTAL_MIXERS - 4], 2},
  {wavetable[44], 0, mixer[11], 0}, {wavetable[45], 0, mixer[11], 1}, {wavetable[46], 0, mixer[11], 2}, {wavetable[47], 0, mixer[11], 3}, {mixer[11], 0, mixer[TOTAL_MIXERS - 4], 3},
  {wavetable[48], 0, mixer[12], 0}, {wavetable[49], 0, mixer[12], 1}, {wavetable[50], 0, mixer[12], 2}, {wavetable[51], 0, mixer[12], 3}, {mixer[12], 0, mixer[TOTAL_MIXERS - 5], 0},
  {wavetable[52], 0, mixer[13], 0}, {wavetable[53], 0, mixer[13], 1}, {wavetable[54], 0, mixer[13], 2}, {wavetable[55], 0, mixer[13], 3}, {mixer[13], 0, mixer[TOTAL_MIXERS - 5], 1},
  {wavetable[56], 0, mixer[14], 0}, {wavetable[57], 0, mixer[14], 1}, {wavetable[58], 0, mixer[14], 2}, {wavetable[59], 0, mixer[14], 3}, {mixer[14], 0, mixer[TOTAL_MIXERS - 5], 2},
  {wavetable[60], 0, mixer[15], 0}, {wavetable[61], 0, mixer[15], 1}, {wavetable[62], 0, mixer[15], 2}, {wavetable[63], 0, mixer[15], 3}, {mixer[15], 0, mixer[TOTAL_MIXERS - 5], 3},
  {mixer[TOTAL_MIXERS - 2], 0, mixer[TOTAL_MIXERS - 1], 0},
  {mixer[TOTAL_MIXERS - 3], 0, mixer[TOTAL_MIXERS - 1], 1},
  {mixer[TOTAL_MIXERS - 4], 0, mixer[TOTAL_MIXERS - 1], 2},
  {mixer[TOTAL_MIXERS - 5], 0, mixer[TOTAL_MIXERS - 1], 3},
  {mixer[TOTAL_MIXERS - 1], 0, i2s1, 0},
  {mixer[TOTAL_MIXERS - 1], 0, i2s1, 1},
};
Bounce buttons[] = { {0, 15}, {1, 15}, {2, 15}, };
const int TOTAL_BUTTONS = sizeof(buttons) / sizeof(Bounce);

void guitarHeroMode();
void printVoices();
void setVolume() {
	sgtl5000_1.volume(0.8*(analogRead(PIN_A2) - 1) / 1022.0);
}

struct voice_t {
	int wavetable_id;
	byte channel;
	byte note;
};
voice_t voices[TOTAL_VOICES];

IntervalTimer midiMapTimer;
IntervalTimer guitarHeroTimer;
IntervalTimer volumeTimer;

void setup() {
	Serial.begin(115200);

	pinMode(0, INPUT_PULLUP);
	pinMode(1, INPUT_PULLUP);
	pinMode(2, INPUT_PULLUP);

	AudioMemory(120);

	sgtl5000_1.enable();
	sgtl5000_1.volume(0.8);

	for (int i = 0; i < TOTAL_VOICES; ++i) {
		wavetable[i].setInstrument(AKWF_0001);
		wavetable[i].amplitude(1);
		voices[i].wavetable_id = i;
		voices[i].channel = voices[i].note = 0xFF;
	}

	for (int i = 0; i < TOTAL_MIXERS - 1; ++i)
		for (int j = 0; j < 4; ++j)
			mixer[i].gain(j, 0.50);
	for (int i = 0; i < 4; ++i)
		mixer[TOTAL_MIXERS - 1].gain(i, i < SECONDARY_MIXERS ? 1.0 / SECONDARY_MIXERS : 0.0);

	usbMIDI.setHandleNoteOn(OnNoteOn);
	usbMIDI.setHandleNoteOff(OnNoteOff);
	//volumeTimer.begin(setVolume, 100000);
	//guitarHeroTimer.begin(guitarHeroMode, 1000000 / 120);
	//midiMapTimer.begin(printVoices, 5000);

	delay(2000);
}

void loop() {
	usbMIDI.read();
	//for (int i = 0; i < TOTAL_BUTTONS; ++i) buttons[i].update();
	//if (buttons[0].fallingEdge()) AudioSynthWavetable::print_performance();
	//if (buttons[1].risingEdge()) {
	//  midiMapTimer.end();
	//  Serial.print('\n');
	//}
	//if (buttons[1].fallingEdge()) midiMapTimer.begin(printVoices, 5000);
	//if (buttons[2].risingEdge()) guitarHeroTimer.end();
	//if (buttons[2].fallingEdge())
	//  guitarHeroTimer.begin(guitarHeroMode, 1000000/60);
}

int allocateVoice(byte channel, byte note);
int findVoice(byte channel, byte note);
void freeVoices();

int used_voices = 0;
int stopped_voices = 0;
int evict_voice = 0;
int notes_played = 0;

void OnPress(int key)
{
	Serial.print("key '");
	Serial.print((char)key);
	Serial.print("'  ");
	Serial.println(key);
	//Serial.print("key ");
	//Serial.print((char)keyboard1.getKey());
	//Serial.print("  ");
	//Serial.print((char)keyboard2.getKey());
	//Serial.println();
}

void OnControlChange(byte channel, byte control, byte value)
{
	Serial.print("Control Change, ch=");
	Serial.print(channel);
	Serial.print(", control=");
	Serial.print(control);
	Serial.print(", value=");
	Serial.print(value);
	Serial.println();
}

void OnNoteOn(byte channel, byte note, byte velocity) {
	notes_played++;
#ifdef DEBUG_ALLOC
	//Serial.printf("**** NoteOn: channel==%hhu,note==%hhu ****\n", channel, note);
	printVoices();
#endif //DEBUG_ALLOC
	freeVoices();
	int wavetable_id = allocateVoice(channel, note);
	switch (channel) {
    /*
	case 1:
		wavetable[wavetable_id].setInstrument(BasicFlute1);
		break;
	case 2:
		wavetable[wavetable_id].setInstrument(FrenchHorns);
		break;
	case 3:
		wavetable[wavetable_id].setInstrument(Ocarina);
		break;
	case 4:
		wavetable[wavetable_id].setInstrument(Ocarina);
		break;
	case 5:
		wavetable[wavetable_id].setInstrument(Pizzicato);
		break;
     */
	default:
		wavetable[wavetable_id].setInstrument(AKWF_0001);
		break;
	}

	wavetable[wavetable_id].playNote(note, velocity);
#ifdef DEBUG_ALLOC
	printVoices();
#endif //DEBUG_ALLOC
}

void OnNoteOff(byte channel, byte note, byte velocity) {
#ifdef DEBUG_ALLOC
	//Serial.printf("\n**** NoteOff: channel==%hhu,note==%hhu ****", channel, note);
	printVoices();
#endif //DEBUG_ALLOC
	int wavetable_id = findVoice(channel, note);
	if (wavetable_id != TOTAL_VOICES)
		wavetable[wavetable_id].stop();
#ifdef DEBUG_ALLOC
	printVoices();
#endif //DEBUG_ALLOC
}

int allocateVoice(byte channel, byte note) {
	int i;
	int nonfree_voices = stopped_voices + used_voices;
	if (nonfree_voices < TOTAL_VOICES) {
		for (i = nonfree_voices; i < TOTAL_VOICES && voices[i].channel != channel; ++i);
		if (i < TOTAL_VOICES) {
			voice_t temp = voices[i];
			voices[i] = voices[nonfree_voices];
			voices[nonfree_voices] = temp;
		}
		i = nonfree_voices;
		used_voices++;
	}
	else {
		if (stopped_voices) {
			i = evict_voice % stopped_voices;
			voice_t temp = voices[i];
			stopped_voices--;
			voices[i] = voices[stopped_voices];
			voices[stopped_voices] = temp;
			used_voices++;
			i = stopped_voices;
		}
		else
			i = evict_voice;
	}

	voices[i].channel = channel;
	voices[i].note = note;

	evict_voice++;
	evict_voice %= TOTAL_VOICES;

	return voices[i].wavetable_id;
}

int findVoice(byte channel, byte note) {
	int i;
	//find match
	int nonfree_voices = stopped_voices + used_voices;
	for (i = stopped_voices; i < nonfree_voices && !(voices[i].channel == channel && voices[i].note == note); ++i);
	//return TOTAL_VOICES if no match
	if (i == (nonfree_voices)) return TOTAL_VOICES;

	voice_t temp = voices[i];
	voices[i] = voices[stopped_voices];
	voices[stopped_voices] = temp;
	--used_voices;

	return voices[stopped_voices++].wavetable_id;
}

void freeVoices() {
	for (int i = 0; i < stopped_voices; i++)
		if (wavetable[voices[i].wavetable_id].isPlaying() == false) {
			voice_t temp = voices[i];
			--stopped_voices;
			voices[i] = voices[stopped_voices];
			int nonfree_voices = stopped_voices + used_voices;
			voices[stopped_voices] = voices[nonfree_voices];
			voices[nonfree_voices] = temp;
		}
}

void guitarHeroMode() { // now unicorn friendly
	const int RESET = 4;
	const int MIDI_NOTES = 128;
	static char line[MIDI_NOTES + 1] = { 0 };
	static int accumulated = 0;
	if (!accumulated) {
		for (int i = 0; i < MIDI_NOTES; ++i) line[i] = '-';
		++accumulated;
	}
	for (int i = stopped_voices; i < used_voices + stopped_voices; ++i) line[voices[i].note] = '*';
	if (accumulated == RESET) {
		Serial.println(line);
		accumulated = 0;
	}
	else {
		++accumulated;
	}
}

const char* note_map[] = {
  "C","C#","D","D#","E","F","F#","G","G#","A","A#","B"
};

void printVoices() {
	static int last_notes_played = notes_played;
	if (last_notes_played == notes_played)
		return;
	last_notes_played = notes_played;
	int usage = AudioProcessorUsage();
	Serial.printf("\nCPU:%03i voices:%02i CPU/Voice:%02i evict:%02i", usage, used_voices, usage / used_voices, evict_voice);
	for (int i = 0; i < used_voices; ++i)
		Serial.printf(" %02hhu %-2s", voices[i].channel, note_map[voices[i].note % 12]);

}

AKWF_0001_samples.h:

Code:
#pragma once
#include <Audio.h>
extern const AudioSynthWavetable::instrument_data AKWF_0001;

AKWF_0001_samples.cpp:

Code:
#include "AKWF_0001_samples.h"

static const uint32_t sample_0_AKWF_0001_AKWF_0001[1024] = {
0x93029302,0x93039303,0x93039304,0x92db92e5,0x92c492d0,0x92ac92b8,0x9294929f,0x927f9288,
0x92709276,0x926b926c,0x9272926c,0x9289927b,0x92b3929b,0x92f492d1,0x9350931f,0x93ca9389,
0x94659414,0x952594c0,0x960a9593,0x99a6967d,0x9d8a9c82,0x9fbd9e9d,0xa17ca0ea,0xa297a20a,
0xa3aaa321,0xa4b5a430,0xa5baa539,0xa6baa63a,0xa7b5a738,0xa8a8a830,0xa99aa921,0xaa87aa0f,
0xab70aafb,0xac55abe2,0xad36acc6,0xae0fada4,0xb75bae5d,0xb8f1b856,0xba1fb989,0xbb43bab3,
0xbc57bbcf,0xbd5dbcdc,0xbe53bdd9,0xbf3dbec9,0xc01dbfaf,0xc0f2c08a,0xc1c1c15b,0xc289c226,
0xc34cc2eb,0xc409c3ac,0xc4c1c465,0xc579c51d,0xc63ec5d7,0xd0f6c75f,0xd182d100,0xd27bd201,
0xd363d2f1,0xd43dd3d2,0xd50bd4a5,0xd5ccd56d,0xd684d62a,0xd730d6dc,0xd7d5d784,0xd873d825,
0xd909d8bf,0xd99ad953,0xda26d9e1,0xdaa9da69,0xdb2cdaeb,0xdb6bdb66,0xe8e0e316,0xea13e984,
0xeb08ea93,0xebd8eb73,0xec92ec38,0xed39ece8,0xedd1ed87,0xee5bee19,0xeeddee9e,0xef55ef1a,
0xefc3ef8e,0xf02ceff9,0xf08ff05e,0xf0eaf0bd,0xf141f115,0xf18ff169,0xf1b9f1b6,0xfdf6fce7,
0xfeb8fe5c,0xff65ff11,0xffffffb4,0x00860045,0x00fc00c4,0x015f0130,0x01b5018b,0x01ff01db,
0x023f0220,0x0278025c,0x02a90292,0x02d302bf,0x02fb02e6,0x031c030c,0x033a032a,0x02480347,
0xfc86fc3d,0xfc68fc7a,0xfc48fc57,0xfc2efc3b,0xfc1dfc25,0xfc0ffc16,0xfc0bfc0d,0xfc0bfc0a,
0xfc10fc0d,0xfc1bfc15,0xfc26fc21,0xfc36fc2e,0xfc4bfc40,0xfc5efc55,0xfc75fc68,0xfc92fc82,
0xff3cfc9f,0x021e01c6,0x02850257,0x02d502af,0x031802f7,0x03530337,0x038c0370,0x03c003a6,
0x03f303db,0x0425040c,0x0455043e,0x0481046c,0x04b00498,0x04db04c6,0x050904f1,0x053b0521,
0x0595055e,0xf0c9064d,0xf21df20f,0xf1adf1f0,0xf121f167,0xf0a2f0de,0xf042f06e,0xf007f021,
0xefe8eff4,0xefe6efe5,0xeffaefef,0xf01af008,0xf049f02e,0xf07df063,0xf0b8f09b,0xf0f8f0d7,
0xf131f116,0xf11df141,0xdb77ef71,0xda82daee,0xda0bda3b,0xd9dbd9ee,0xd9cfd9d1,0xd9d9d9d2,
0xd9f6d9e6,0xda27da0b,0xda65da45,0xdab0da89,0xdb0cdada,0xdb6fdb3b,0xdbdddba4,0xdc55dc19,
0xdcd8dc96,0xdd66dd1e,0xde17ddb1,0xda1edb91,0xda90da5b,0xdafedac6,0xdb79db3a,0xdbfbdbb8,
0xdc87dc3f,0xdd1ddcd0,0xddb6dd68,0xde54de05,0xdef7dea5,0xdf99df46,0xe040dfeb,0xe0e9e095,
0xe192e13d,0xe240e1e9,0xe2eee296,0xe395e349,0xed0febd4,0xee1feda0,0xef12ee9a,0xeff4ef85,
0xf0cbf061,0xf198f132,0xf25af1fa,0xf310f2b5,0xf3c2f369,0xf46cf418,0xf510f4be,0xf5adf560,
0xf64af5fc,0xf6e1f695,0xf773f72a,0xf802f7bb,0xfa0bf842,0x025e029d,0x031702b5,0x03d90379,
0x04900436,0x053a04e5,0x05d8058b,0x06670621,0x06ec06aa,0x0767072b,0x07db07a2,0x08450811,
0x08ab0878,0x090b08db,0x0969093b,0x09c30996,0x0a1c09f0,0x0d900a42,0x11081082,0x11a0115d,
0x121011dc,0x126d1241,0x12c2129a,0x130c12e8,0x1350132d,0x13931373,0x13d013b2,0x140813ec,
0x143d1423,0x146f1457,0x149b1485,0x14c114af,0x14da14cf,0x14c914db,0x2f431433,0x2ec52e91,
0x2fb12f32,0x30b43034,0x31a23130,0x326a320b,0x330832bd,0x337c3347,0x33d633ad,0x341733fa,
0x3440342d,0x3459344e,0x3464345f,0x34653465,0x345c3460,0x344f3455,0x34453445,0x38b134d1,
0x38cd38bb,0x38e538da,0x38f138ec,0x38f138f2,0x38ec38ef,0x38e238e6,0x38d138d9,0x38bb38c6,
0x38a138b0,0x38853893,0x38633875,0x38403852,0x3819382d,0x37ef3804,0x37c037d8,0x377637a8,
0x3e823bb4,0x3ec53eaa,0x3eed3edb,0x3f013ef8,0x3f0b3f07,0x3f0d3f0e,0x3f053f09,0x3ef63eff,
0x3ee23eec,0x3ec73ed5,0x3ea93eb8,0x3e863e98,0x3e633e76,0x3e3a3e4e,0x3e0d3e24,0x3ddd3df7,
0x3d943dc2,0x44d944a8,0x44f844e9,0x45144507,0x4528451f,0x4533452f,0x45304533,0x4524452b,
0x450d4518,0x44f044fe,0x44cd44df,0x44a644b9,0x447a4490,0x444b4463,0x44174430,0x43df43fc,
0x43a343c1,0x42d6437b,0x3e1e3e22,0x3db63de9,0x3d563d84,0x3cfb3d28,0x3ca63cd1,0x3c553c7f,
0x3c053c2c,0x3bb93bdf,0x3b703b94,0x3b2a3b4d,0x3ae63b08,0x3aa63ac6,0x3a643a84,0x3a233a43,
0x39e53a03,0x39aa39c6,0x37b9399f,0x27a936db,0x22bf23a7,0x21892218,0x20902107,0x1fbd2024,
0x1f0c1f62,0x1e751ebd,0x1df01e30,0x1d7e1db4,0x1d191d49,0x1cc31ced,0x1c721c99,0x1c2c1c4e,
0x1bee1c0c,0x1bb91bd3,0x1b8c1ba2,0x1b761b79,0x09c71b8c,0x08fa095b,0x082c0893,0x076c07ca,
0x06c10714,0x06300675,0x05b705f1,0x05550584,0x0507052b,0x04c704e5,0x049204aa,0x046a047e,
0x044c045a,0x0434043f,0x0425042c,0x041c0420,0x05960417,0x0ad10760,0x0ad70ac0,0x0b020aee,
0x0b230b14,0x0b3d0b30,0x0b500b47,0x0b600b58,0x0b6a0b66,0x0b730b6f,0x0b750b72,0x0b750b75,
0x0b720b73,0x0b6d0b6f,0x0b660b6b,0x0b5e0b61,0x0b530b58,0x0ba90b4e,0x058d0842,0x04f90531,
0x04a104c9,0x045d047d,0x0423043f,0x03ef0408,0x03c003d7,0x039503a9,0x036b037f,0x03460358,
0x03240335,0x03050314,0x02e802f7,0x02cc02db,0x02af02bd,0x028e02a3,0x02550275,0x0e180ec9,
0x0e390e1a,0x0e8d0e63,0x0ee40eba,0x0f2e0f0b,0x0f670f4d,0x0f8e0f7e,0x0fa70f9b,0x0fb50faf,
0x0fba0fb9,0x0fb50fb8,0x0fad0fb3,0x0f9f0fa8,0x0f8d0f97,0x0f7d0f85,0x0f6f0f74,0x13d00f67,
0x1c2a1bc5,0x1cb11c79,0x1cfc1cdb,0x1d271d15,0x1d421d36,0x1d4f1d49,0x1d501d50,0x1d491d4d,
0x1d3b1d42,0x1d241d30,0x1d0a1d18,0x1ce81cfb,0x1cbf1cd5,0x1c951cac,0x1c611c7b,0x1c2d1c46,
0x25031c12,0x256e2557,0x258c257f,0x259c2596,0x25a025a0,0x2593259b,0x25792588,0x25532567,
0x2528253f,0x24f2250d,0x24b624d5,0x24752496,0x24302452,0x23e4240c,0x239723bd,0x2347236f,
0x22c7231b,0x2bab272f,0x2b902b8b,0x2b8f2b91,0x2b7d2b88,0x2b5b2b6f,0x2b2d2b47,0x2af52b13,
0x2ab62ad7,0x2a6e2a91,0x2a212a47,0x29ce29f8,0x297529a2,0x291c294a,0x28be28ec,0x285b288c,
0x27f9282a,0x27ac27cb,0x2d262dc0,0x2cdd2cfc,0x2ca22cbf,0x2c642c83,0x2c1e2c42,0x2bd32bf9,
0x2b802baa,0x2b272b54,0x2aca2af8,0x2a672a98,0x29fe2a33,0x299629cb,0x292a2961,0x28bc28f2,
0x284d2884,0x27e32814,0x1fdb25b8,0x1f6d1fc6,0x1ebc1f13,0x1e141e66,0x1d731dc3,0x1cde1d27,
0x1c511c96,0x1bcb1c0e,0x1b4c1b8b,0x1ad41b0f,0x1a5d1a98,0x19ee1a27,0x198219b9,0x1919194d,
0x18c218ee,0x187a1897,0x196f1874,0xad1cc201,0xa6b2a95d,0xa247a45e,0x9eb5a06a,0x9bcc9d2a,
0x99729a8c,0x97969876,0x961f96cf,0x95029586,0x94319491,0x93a193e2,0x9349936d,0x9322932e,
0x9322931d,0x9345932f,0x93829361,0x929d939c,0x8cef8ccc,0x8d248d04,0x8d7e8d4e,0x8df68db6,
0x8e828e39,0x8f208ed0,0x8fcf8f76,0x90869029,0x914990e6,0x921891b0,0x92ec9282,0x93c89359,
0x94a79436,0x958b9519,0x967095fd,0x974996df,0x9e319775,0x9f2d9eb0,0xa0499fb9,0xa170a0dd,
0xa295a203,0xa3afa324,0xa4c2a43a,0xa5caa548,0xa6caa64b,0xa7c7a749,0xa8baa841,0xa9aaa933,
0xaa96aa21,0xab7eab0b,0xac63abf1,0xad48acd5,0xae2badbc,0xb7dfb1c3,0xb933b88a,0xba64b9d0,
0xbb78baf0,0xbc7abbfb,0xbd71bcf7,0xbe5fbde9,0xbf41bed2,0xc020bfb1,0xc0f5c08c,0xc1c4c15d,
0xc28bc228,0xc34fc2ed,0xc40cc3af,0xc4c4c468,0xc580c520,0xc6acc5ec,0xd093d000,0xd1a3d120,
0xd29ad222,0xd37fd30f,0xd454d3ea,0xd51bd4b8,0xd5d8d57b,0xd68dd634,0xd735d6e1,0xd7d7d787,
0xd874d827,0xd908d8be,0xd996d94f,0xda1ed9da,0xdaa8da67,0xdb24dae8,0xe64edb2b,0xe941e890,
0xea4ae9cc,0xeb2ceabf,0xebf6eb93,0xeca9ec52,0xed49ecfb,0xeddded95,0xee64ee21,0xeee0eea3,
0xef53ef1a,0xefbdef89,0xf020efef,0xf07ff050,0xf0d7f0ac,0xf12af100,0xf148f150,0xfd4ff80d,
0xfe61fde9,0xff1efec5,0xffb5ff6d,0x0033fff6,0x009e006a,0x00fe00ce,0x01510129,0x019b0177,
0x01dd01bc,0x021801fc,0x024d0234,0x027c0266,0x02a50291,0x031502b7,0x03350326,0x013c034a,
0xfc3bfc2a,0xfc0ffc25,0xfbf0fbfd,0xfbdbfbe4,0xfbcdfbd4,0xfbc8fbc8,0xfbc3fbc5,0xfbc5fbc4,
0xfbcbfbc7,0xfbd4fbcf,0xfbe0fbd9,0xfbf0fbe8,0xfc02fbf9,0xfc18fc0d,0xfd39fc61,0xfd62fd4c,
0x01e5fdfc,0x01ed01ce,0x02380212,0x0282025e,0x02c802a6,0x030a02ea,0x03440325,0x037d0360,
0x03af0397,0x03de03c7,0x040d03f6,0x04380422,0x0460044c,0x04890473,0x04b2049d,0x04ee04d3,
0x045e050b,0xf13ff023,0xf112f13c,0xf0a3f0dc,0xf038f06d,0xefe5f009,0xefa8efc2,0xef84ef93,
0xef77ef7b,0xef7eef78,0xef96ef88,0xefbdefa9,0xefeeefd4,0xf028f00b,0xf06bf049,0xf0a8f090,
0xefb0ef7c,0xd9a6efc4,0xda4fda51,0xd9fdda2b,0xd9a5d9cf,0xd963d97f,0xd93fd94c,0xd93bd939,
0xd955d944,0xd988d96c,0xd9d5d9ac,0xda31da01,0xda9bda64,0xdb10dad5,0xdb8edb4f,0xdc15dbd2,
0xdc29dc5b,0xdbe3dbae,0xd94dd91c,0xd9c0d986,0xda37d9fa,0xdabada77,0xdb42dafd,0xdbd0db87,
0xdc63dc18,0xdcfbdcad,0xdd9cdd4b,0xde3fdded,0xdee6de92,0xdf8edf39,0xe037dfe1,0xe0e0e08c,
0xe18ce136,0xe23de1e4,0xeb6ee2c0,0xecbbec30,0xedb6ed3a,0xeea2ee2e,0xef7cef11,0xf04fefe8,
0xf117f0b5,0xf1d4f177,0xf28bf231,0xf33af2e3,0xf3e2f38f,0xf484f433,0xf520f4d3,0xf5b8f56c,
0xf64cf602,0xf6e0f695,0xf787f732,0x01560101,0x022701c0,0x02f0028c,0x03a8034e,0x045203ff,
0x04f004a3,0x0582053a,0x060905c7,0x0688064a,0x06ff06c4,0x076c0736,0x07d507a1,0x08350805,
0x08920866,0x08ed08c1,0x09430916,0x10c309af,0x1074104f,0x10e110a7,0x1152111b,0x11be1189,
0x122011f1,0x1278124d,0x12c912a2,0x131012ed,0x13501330,0x1389136c,0x13bc13a2,0x13ea13d3,
0x14161400,0x143f142b,0x146b1455,0x17a0147d,0x2e0b27f5,0x2f2f2e96,0x30302fb6,0x30ff309d,
0x31a83158,0x323331f1,0x32a53270,0x330032d5,0x33473326,0x337d3363,0x33a43392,0x33bb33b0,
0x33ca33c5,0x33d033d0,0x33ce33d0,0x33c233c8,0x333e3391,0x37b3357d,0x381d37fd,0x38423834,
0x384e384b,0x384a384c,0x383e3845,0x382e3837,0x381a3824,0x3802380e,0x37e637f5,0x37c937d7,
0x37a737b8,0x37823795,0x375d3770,0x3735374a,0x36d23720,0x365636a0,0x3daa3c5a,0x3ddd3dc7,
0x3e013df0,0x3e193e0f,0x3e2a3e23,0x3e2f3e2e,0x3e2a3e2e,0x3e203e26,0x3e0f3e17,0x3df53e02,
0x3dd93de8,0x3db93dca,0x3d953da7,0x3d6e3d82,0x3d443d59,0x3cfa3d16,0x3c583cd5,0x440343c6,
0x440243fc,0x441d440f,0x44364429,0x4445443e,0x444c444a,0x4446444a,0x4437443f,0x441e442a,
0x43ff440e,0x43d843eb,0x43af43c6,0x43854399,0x43744371,0x40a24142,0x40604083,0x3f884039,
0x3d2d3d59,0x3cc83cf9,0x3c6e3c9a,0x3c1f3c46,0x3bd33bf9,0x3b8c3baf,0x3b483b69,0x3b053b26,
0x3ac33ae4,0x3a833aa4,0x3a473a65,0x3a0c3a29,0x39e739f0,0x367537f9,0x3636365a,0x3612361d,
0x266c36c2,0x228c235b,0x216c21f5,0x207920ee,0x1fab200e,0x1efd1f51,0x1e6d1eb2,0x1ded1e2a,
0x1d801db4,0x1d221d4f,0x1cd01cf7,0x1c8a1cad,0x1c4c1c6b,0x1c3c1c41,0x1c101c24,0x1be51bfb,
0x1baf1bd1,0x09d91b48,0x096109c2,0x089f08ff,0x07ee0843,0x0750079c,0x06c9070a,0x0655068c,
0x05f80624,0x05ab05d0,0x056d058a,0x053f0555,0x0511052b,0x08340697,0x083e083b,0x083d083f,
0x0838083a,0x082b0833,0x0c4708b5,0x0c0a0c06,0x0c200c14,0x0c370c2d,0x0c4c0c42,0x0c590c53,
0x0c640c5f,0x0c690c67,0x0c6a0c6a,0x0c6b0c6c,0x0c680c6a,0x0d690cee,0x0d7c0d79,0x0d780d7b,
0x0d6c0d72,0x0d5d0d64,0x0d600d57,0x069007a5,0x0618064c,0x05bd05ea,0x056e0594,0x05260549,
0x04e80506,0x04b204cb,0x04810497,0x0453046a,0x042c043f,0x04010414,0x03de03f1,0x03c103d0,
0x03a703b4,0x038b0398,0x0373037f,0x033f0365,0x0e5c0b12,0x0f1b0ed2,0x0f810f52,0x0fc70fa6,
0x0ffb0fe3,0x10211010,0x103a1030,0x104f1046,0x10581055,0x108b108e,0x1089108b,0x10821086,
0x1076107c,0x1066106e,0x1053105d,0x10411049,0x102f103b,0x1c23161b,0x1d0d1cb5,0x1d761d49,
0x1db11d99,0x1dd11dc3,0x1ddf1ddb,0x1de61de4,0x1dd91de3,0x1db51dbe,0x1da11dad,0x1d851d93,
0x1d641d76,0x1d3d1d52,0x1d141d29,0x1ce51cfd,0x1cb81cce,0x1cb01ca7,0x259d1dcc,0x25ed25c7,
0x26122604,0x26182617,0x26092612,0x25f225ff,0x25ce25e1,0x25a325b9,0x2575258f,0x253d2559,
0x25012520,0x24bf24e1,0x247a249e,0x24322456,0x23e4240b,0x239423bc,0x233a2368,0x2b3e22ec,
0x2bb32ba7,0x2bb42bb5,0x2ba62bae,0x2b8e2b9c,0x2b5c2b7b,0x2b2b2b45,0x2aed2b0e,0x2aa82aca,
0x2a5f2a83,0x2a0c2a36,0x29b629e1,0x295b2989,0x28fe292d,0x289d28ce,0x283a286c,0x27d32807,
0x297d2791,0x2cfe2d47,0x2cca2ce3,0x2c932cb0,0x2c552c76,0x2c0b2c30,0x2bbc2be6,0x2b672b92,
0x2b0b2b39,0x2aab2adb,0x2a462a7a,0x29de2a14,0x297529aa,0x290a2940,0x289c28d4,0x282d2865,
0x27bd27f5,0x27532783,0x1fbe2124,0x1ed21f3b,0x1e161e71,0x1d6d1dc1,0x1cd51d21,0x1c441c8b,
0x1bbc1bff,0x1b3a1b79,0x1abe1afc,0x1a471a81,0x19d41a0c,0x1965199c,0x18f6192f,0x189318c7,
0x18461868,0x18121826,0x1869181c,0x9ca61338,0xa719a6f5,0xa450a5ed,0xa0c9a292,0x9d4e9f03,
0x9a459bba,0x97cc98f6,0x95a2969c,0x943794d8,0x935893b8,0x92de9311,0x92a992bc,0x929f929f,
0x92b092a5,0x92ce92be,0x92f192e0,0x93119302,0x92bc931b,0x91bd9190,0x920691e2,0x92489228,
0x92819266,0x92ae9299,0x92d092c1,0x92e892de,0x92f792f1,0x93039304,0x93039303,0x93029302,

};

static const AudioSynthWavetable::sample_data AKWF_0001_samples[1] = {
	{
		(int16_t*)sample_0_AKWF_0001_AKWF_0001, // sample
		true, // LOOP
		12, // LENGTH_BITS
		(1 << (32 - 12)) * WAVETABLE_CENTS_SHIFT(0) * 44100.0 / WAVETABLE_NOTE_TO_FREQUENCY(41) / AUDIO_SAMPLE_RATE_EXACT + 0.5, // PER_HERTZ_PHASE_INCREMENT
		((uint32_t)2048 - 1) << (32 - 12), // MAX_PHASE
		((uint32_t)2047 - 1) << (32 - 12), // LOOP_PHASE_END
		(((uint32_t)2047 - 1) << (32 - 12)) - (((uint32_t)0 - 1) << (32 - 12)), // LOOP_PHASE_LENGTH
		uint16_t(UINT16_MAX * WAVETABLE_DECIBEL_SHIFT(0)), // INITIAL_ATTENUATION_SCALAR
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DELAY_COUNT
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // ATTACK_COUNT
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // HOLD_COUNT
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DECAY_COUNT
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // RELEASE_COUNT
		int32_t((1.0 - WAVETABLE_DECIBEL_SHIFT(0.0)) * AudioSynthWavetable::UNITY_GAIN), // SUSTAIN_MULT
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // VIBRATO_DELAY
		uint32_t(8.2 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // VIBRATO_INCREMENT
		(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // VIBRATO_PITCH_COEFFICIENT_INITIAL
		(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // VIBRATO_COEFFICIENT_SECONDARY
		uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // MODULATION_DELAY
		uint32_t(8.2 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // MODULATION_INCREMENT
		(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // MODULATION_PITCH_COEFFICIENT_INITIAL
		(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // MODULATION_PITCH_COEFFICIENT_SECOND
		int32_t(UINT16_MAX * (WAVETABLE_DECIBEL_SHIFT(0) - 1.0)) * 4, // MODULATION_AMPLITUDE_INITIAL_GAIN
		int32_t(UINT16_MAX * (1.0 - WAVETABLE_DECIBEL_SHIFT(0))) * 4, // MODULATION_AMPLITUDE_FINAL_GAIN
	},
};

static const uint8_t AKWF_0001_ranges[] = {127, };

const AudioSynthWavetable::instrument_data AKWF_0001 = {1, AKWF_0001_ranges, AKWF_0001_samples };
 
I've attempted to use single cycles from Union, Serum, and this: http://www.adventurekid.se/akrt/waveforms/

My intention is to use the opensource ones for a teensy synth, however, I used the commercial ones to test as I know for a fact they work. The included wavetable AKWF_0001 is the waveform I discuss most in the thread.
 
Although I think it's safe to rule out random noise at this point I've included how I have the T4 affixed to the shield. My camera is poor quality so just take my word that the solder joints are clean:

View attachment 18871

(the green wire going to hot was from me testing a non usb power supply that has reversed rails from my breadboard. It's not connected to anything)
 
Status
Not open for further replies.
Back
Top