History

tLivingString2 tweaks

spiricom committed 5 years ago

Commit b48e5eb1 parent debdbb42 files · +14 −12Browse files

Unified · Split

2 files
  1. leaf/Src/leaf-distortion.c +1 −1
  2. leaf/Src/leaf-physical.c +13 −11
leaf/Src/leaf-distortion.c+1−1
@@ -318,7 +318,7 @@ void tOversampler_setRatio (tOversampler* const osr, int ratio) · 317 unmodified lines
318 else if (ratio == 2 || ratio == 4 || ratio == 8 ||318 else if (ratio == 2 || ratio == 4 || ratio == 8 ||
319 ratio == 16 || ratio == 32 || ratio == 64)319 ratio == 16 || ratio == 32 || ratio == 64)
320 {320 {
321 os->ratio = os->maxRatio;321 os->ratio = os->ratio;
322 int idx = (int)(log2f(os->ratio))-1+os->offset;322 int idx = (int)(log2f(os->ratio))-1+os->offset;
323 os->numTaps = __leaf_tablesize_firNumTaps[idx];323 os->numTaps = __leaf_tablesize_firNumTaps[idx];
324 os->phaseLength = os->numTaps / os->ratio;324 os->phaseLength = os->numTaps / os->ratio;
leaf/Src/leaf-physical.c+13−11
@@ -682,7 +682,7 @@ void tLivingString2_initToPool (tLivingString2* const pl, float freq, floa · 681 unmodified lines
682 LEAF* leaf = p->mempool->leaf;682 LEAF* leaf = p->mempool->leaf;
683 683
684 p->curr=0.0f;684 p->curr=0.0f;
685 tExpSmooth_initToPool(&p->wlSmooth, leaf->sampleRate/freq, 0.01f, mp); // smoother for string wavelength (not freq, to avoid expensive divisions)685 tExpSmooth_initToPool(&p->wlSmooth, leaf->sampleRate/freq, 0.1f, mp); // smoother for string wavelength (not freq, to avoid expensive divisions)
686 tLivingString2_setFreq(pl, freq);686 tLivingString2_setFreq(pl, freq);
687 p->freq = freq;687 p->freq = freq;
688 p->prepPos = prepPos;688 p->prepPos = prepPos;
@@ -691,7 +691,7 @@ void tLivingString2_initToPool (tLivingString2* const pl, float freq, floa · 2 unmodified lines
691 tExpSmooth_initToPool(&p->puSmooth, pickupPos, 0.01f, mp); // smoother for pickup position691 tExpSmooth_initToPool(&p->puSmooth, pickupPos, 0.01f, mp); // smoother for pickup position
692 tLivingString2_setPickPos(pl, pickPos);692 tLivingString2_setPickPos(pl, pickPos);
693 tLivingString2_setPrepPos(pl, prepPos);693 tLivingString2_setPrepPos(pl, prepPos);
694 p->prepIndex=prepIndex;694 p->prepIndex = prepIndex;
695 p->pickupPos = pickupPos;695 p->pickupPos = pickupPos;
696 tHermiteDelay_initToPool(&p->delLF,p->waveLengthInSamples, 2400, mp);696 tHermiteDelay_initToPool(&p->delLF,p->waveLengthInSamples, 2400, mp);
697 tHermiteDelay_initToPool(&p->delUF,p->waveLengthInSamples, 2400, mp);697 tHermiteDelay_initToPool(&p->delUF,p->waveLengthInSamples, 2400, mp);
@@ -745,6 +745,7 @@ void tLivingString2_setFreq(tLivingString2* const pl, float freq) · 47 unmodified lines
745 LEAF* leaf = p->mempool->leaf;745 LEAF* leaf = p->mempool->leaf;
746 if (freq<20.f) freq=20.f;746 if (freq<20.f) freq=20.f;
747 else if (freq>10000.f) freq=10000.f;747 else if (freq>10000.f) freq=10000.f;
748 freq = freq*2;
748 p->freq = freq;749 p->freq = freq;
749 p->waveLengthInSamples = (leaf->sampleRate/freq) - 1;750 p->waveLengthInSamples = (leaf->sampleRate/freq) - 1;
750 tExpSmooth_setDest(&p->wlSmooth, p->waveLengthInSamples);751 tExpSmooth_setDest(&p->wlSmooth, p->waveLengthInSamples);
@@ -754,6 +755,7 @@ void tLivingString2_setWaveLength(tLivingString2* const pl, float waveLength · 3 unmodified lines
754{755{
755 _tLivingString2* p = *pl;756 _tLivingString2* p = *pl;
756 LEAF* leaf = p->mempool->leaf;757 LEAF* leaf = p->mempool->leaf;
758 waveLength = waveLength * 0.5f;
757 if (waveLength<4.8f) waveLength=4.8f;759 if (waveLength<4.8f) waveLength=4.8f;
758 else if (waveLength>2400.f) waveLength=2400.f;760 else if (waveLength>2400.f) waveLength=2400.f;
759 p->waveLengthInSamples = waveLength - 1;761 p->waveLengthInSamples = waveLength - 1;
@@ -926,27 +928,27 @@ float tLivingString2_tick(tLivingString2* const pl, float input) · 166 unmodified lines
926 tHermiteDelay_setDelay(&p->delUF, upLen);928 tHermiteDelay_setDelay(&p->delUF, upLen);
927 tHermiteDelay_setDelay(&p->delUB, upLen);929 tHermiteDelay_setDelay(&p->delUB, upLen);
928 930
929 /*931
930 uint pickupPosInt;932 uint32_t pickupPosInt;
931 float pickupOut = 0.0f;933 float pickupOut = 0.0f;
932 if (pickupPos < 0.9f)934 if (p->pickupPos < 0.98f)
933 {935 {
934 float fullPickupPos = (pickupPos*upLen);936 float fullPickupPos = (p->pickupPos*upLen);
935 pickupPosInt = (uint) fullPickupPos;937 pickupPosInt = (uint32_t) fullPickupPos;
936 float pickupPosFloat = fullPickupPos - pickupPosInt;938 float pickupPosFloat = fullPickupPos - pickupPosInt;
937 if (pickupPosInt == 0)939 if (pickupPosInt == 0)
938 {940 {
939 pickupPosInt = 1;941 pickupPosInt = 1;
940 }942 }
941 pickupOut = tHermiteDelay_tapOutInterpolated(&p->delUF, pickupPosInt, pickupPosFloat);943 pickupOut = tHermiteDelay_tapOutInterpolated(&p->delUF, pickupPosInt, pickupPosFloat);
942 pickupOut += tHermiteDelay_tapOutInterpolated(&p->delUB, (uint) (upLen - pickupPosInt), pickupPosFloat);944 pickupOut += tHermiteDelay_tapOutInterpolated(&p->delUB, (uint32_t) (upLen - pickupPosInt), pickupPosFloat);
943 p->curr = pickupOut;945 p->curr = pickupOut;
944 }946 }
945 else947 else
946 */948
947 //{949 {
948 p->curr = fromBridge;950 p->curr = fromBridge;
949 //}951 }
950 952
951 //p->curr = fromBridge;953 //p->curr = fromBridge;
952 //p->curr += fromNut;954 //p->curr += fromNut;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t