ganchan Posted April 29, 2008 Report Share Posted April 29, 2008 i'm trying to make odd & new values in my LFOs. like 3/1 9/1 or 6/1 12/1 etc. and something like 1/2T 1/4T etc. T=triplets.the problem is the divider of 1024 that report comma values and i've not completly understand how work the sync but i've make some try just testing it hearing and counting. not so pro.some other mathematic info would be cool.i've look at SIDSE_M_SyncSIDSE_M_LFO_RestartSID_LFO_TABLE_MCLKtonight i will post some other info, i'm @ wrk now. :) Quote Link to comment Share on other sites More sharing options...
stryd_one Posted April 29, 2008 Report Share Posted April 29, 2008 Heya,Yeh, floating point won't work ;) The best way to do this if the values will be static (like yours), is with a table of the results of the division, rounded to the nearest integer.However you won't need to do that for the standard measures like 1/3,1/12,4/3,3/8, etc, that's why midi clock is 24ppqn, its the lowest common multiple of all of the common figures. MMA were thinking about us heheheh Quote Link to comment Share on other sites More sharing options...
ganchan Posted April 30, 2008 Author Report Share Posted April 30, 2008 yes i've thought about the nearest value. in ex 3/1 it's 341.33333333333333333333.so i can use 341 instead, the difference it's minimal. so the wave come out of the point after a lot of loops.but i think to a function (to now it's just an idea, no code wrote down), that restart the lfo after a given time/loop where the wave would be start in sync with the seq. so i can pseudo preserve the loop point of LFO start. Quote Link to comment Share on other sites More sharing options...
/tilted/ Posted April 30, 2008 Report Share Posted April 30, 2008 i'm trying to make odd & new values in my LFOs. like 3/1 9/1 or 6/1 12/1 etc. and something like 1/2T 1/4T etc. T=triplets.the problem is the divider of 1024 that report comma values and i've not completly understand how work I of course have no idea here, but:Is it possible to change the divider?To maybe 1536 or 768?Both significant numbers in the binary world...unfortunately the only way to ensure even divisions regardless of your time sig is to use ? ppqn.This makes your sequencer run very slowly...Edit: fixed the ?... Quote Link to comment Share on other sites More sharing options...
ganchan Posted April 30, 2008 Author Report Share Posted April 30, 2008 yes if 1/1 was 1536 in the sync table there was no problem. since midiclock it's 24ppqn, we must wrote a parallel counter that for each clock use 1536 in sync, and the lfo table it's referred to this. Quote Link to comment Share on other sites More sharing options...
stryd_one Posted April 30, 2008 Report Share Posted April 30, 2008 yes i've thought about the nearest value. in ex 3/1 it's 341.33333333333333333333.so i can use 341 instead, the difference it's minimal. so the wave come out of the point after a lot of loops.Yeh, that would suck... That's why that's not what I mean ;)I find the best way to avoid floating point is to avoid floating point hehehe... Just stay with good old fashioned fractions1024/3=341 and 1/3or you could say1024/3=341 with a modulus (remainder) of 1So can use 341, but if you want it to stay in sync, you've gotta spread the modulus around. You can use calculations to do it, but that could be a bit too much for the PIC to handle at such high frequency. However if you know what values you want to have available (like how you have 3/1), a nice quick way to do it is a lookup table, which has the pre-calculated period of each tick in it like so:341342341Tada, synced clocks. You just look up the value according to how many times it's ticked, and roll that counter over every 3 ticks. But when it comes to fast stuff like LFO's... You want to be careful how you time it... Try to look up the value pre-emptively.Notice that I put the remainder in the middle... That's where it really goes, because you want to just round to the nearest integer to be really accurate...it's like 0+ 341 1/3 = 341 1/3 ~ 341 difference from the last is 341+ 341 1/3 = 682 2/3 ~ 683 difference from the last is 342 there's our modulus+ 341 1/3 = 1024 ~ 1024 difference from the last is 341Dunno how much of that you'll be able to roll into the app though....HTH!Edit: I just saw your mention of the SID LFOs... if you're thinking about doing this in the MBSID, I'm not sure it'll work... I need to build one and figure out how the LFO's work :) Quote Link to comment Share on other sites More sharing options...
/tilted/ Posted April 30, 2008 Report Share Posted April 30, 2008 ... But when it comes to fast stuff like LFO's... You crazy kids and your fast LFOs.I remember when the 'L' was for "low" ;)Mind you, according to the electricians, 240V household mains is referred to as "low voltage".They count anything less than 1000V as "low".-cause they're tough. :) Quote Link to comment Share on other sites More sharing options...
ganchan Posted April 30, 2008 Author Report Share Posted April 30, 2008 this sound very interesting and yes you have figured right about my skill to do that but how knows.so you mean a table where i take for each LFO period a value in ex 314, than 342, than 341 and so on.so for each divider i must have 3 tick cycled by the function.for now this is my temporary new table for the bassline:SID_LFO_TABLE_MCLK dw 16 ; 231: 64/1 dw 32 ; 232: 32/1 dw 42 ; 233: 24/1 (42.66666666666666666667) dw 57 ; 234: 18/1 (56.88888888888888888889) dw 64 ; 235: 16/1 dw 85 ; 236: 12/1 (85.33333333333333333333) dw 114 ; 237: 9/1 (113.77777777777777777778) dw 128 ; 238: 8/1 dw 170 ; 239: 6/1 (170.66666666666666666667) dw 256 ; 240: 4/1 dw 341 ; 241: 3/1 (341.33333333333333333333) dw 512 ; 242: 2/1 dw 614 ; 243: 5/3 (614.4) dw 768 ; 244: 4/3 dw 1024 ; 245: 1/1 dw 1365 ; 246: 3/4 (1365.33333333333333333333) dw 1536 ; 247: 2/3 dw 1638 ; 248: 5/8 (1638.4) dw 2048 ; 249: 1/2 dw 2730 ; 250: 3/8 (2730.66666666666666666667) dw 3072 ; 251: 1/3 dw 4096 ; 252: 1/4 dw 8192 ; 253: 1/8 dw 12288 ; 254: 1/12 dw 16384 ; 255: 1/16 CS_MENU_PRINT_LFOx_RATE rcall CS_MENU_PRINT_GetLFOx ; FSR0 will point to SID_Ix_LFOx_RATE ;; prepare TBLPTR[LH] TABLE_ADDR CS_MENU_PRINT_LFOx_RATE_Tab ;; if clock sync activated, and rate >= 245, print period length movlw (SID_Ix_LFOx_MODE-SID_Ix_LFOx_RATE) BRA_IFCLR PLUSW0, SID_I_LFO_MODE_CLKSYNC, ACCESS, CS_MENU_PRINT_LFOx_RATE_Dec movf INDF0, W addlw -231 bnc CS_MENU_PRINT_LFOx_RATE_Dec SIDSE_M_LFO_Rate_ClkSync movf IRQ_TMP1, W addlw -231 bnc SIDSE_M_LFO_Rate_NoClkSyncValues TABLE_ADDR_MUL_W SID_LFO_TABLE_MCLK, 2 rgoto SIDSE_M_LFO_Rate_ClkSync_Cont CS_MENU_PRINT_LFOx_RATE_Tab dw "64/1" dw "32/1" dw "24/1" dw "18/1" dw "16/1" dw "12/1" dw "9/1 " dw "8/1 " dw "6/1 " dw "4/1 " dw "3/1 " dw "2/1 " dw "5/3 " dw "4/3 " dw "1/1 " dw "3/4 " dw "2/3 " dw "5/8 " dw "1/2 " dw "3/8 " dw "1/3 " dw "1/4 " dw "1/8 " dw "1/12" dw "1/16"the slow lfo curve it's my point, 9/1 and 8/1 in ex make some cool modulation on 2 cloned bassline in sync.-6/1 and 3/1 too Quote Link to comment Share on other sites More sharing options...
stryd_one Posted April 30, 2008 Report Share Posted April 30, 2008 the slow lfo curve it's my point, 9/1 and 8/1 in ex make some cool modulation on 2 cloned bassline in sync.Now you know why I'm all about polyrhythms ;) Quote Link to comment Share on other sites More sharing options...
TK. Posted April 30, 2008 Report Share Posted April 30, 2008 In MBSEQ, triplets are generated by selecting a different predivider.The internal 96 ppqn are divided by 6 (-> 16 ppqn) and 4 (-> 24 ppqn) to avoid fractions or expensive mathThere are two reasons why I haven't done this for MBSID yet. One reason is, that SID_SE_STATE (which propagates the predivided clock events... and more flags) is fully allocated, another reason is, that SID_BASE section 0x100..0x1ff is completely allocated as well, so that I need to find some ways to free memory before introducing such special features. It's still in my focus to get the firmware bugfree before starting with optimisations, a proper solution for triplets will be provided by default in a pre 2.0 release. Of course, meanwhile you are free to tinker on your own solution, or to remove features you don't need (variables in SID_BASE section) to get some free memory...Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
ganchan Posted May 2, 2008 Author Report Share Posted May 2, 2008 tnx for the info, i will go to see MBSEQ functions!since i need only the bassline engine in my Datassette i will cut here and there some code. :) Quote Link to comment Share on other sites More sharing options...
stryd_one Posted May 2, 2008 Report Share Posted May 2, 2008 Did you miss this in my first post ganchan? [quote name=stryd_one link=topic=11311.msg89340#msg89340 date=1209486777However you won't need to do that for the standard measures like 1/3,1/12,4/3,3/8, etc, that's why midi clock is 24ppqn, its the lowest common multiple of all of the common figures. MMA were thinking about us heheheh Quote Link to comment Share on other sites More sharing options...
ganchan Posted May 2, 2008 Author Report Share Posted May 2, 2008 no stryd i've not miss! i've just take a look at the MBSEQ code to improve my skill and learn about clock dividers. i'm not able at now to do that, i'm still on the way, just studying and tinkering with the support of my brother (informatic engineer), and your obviously. :) Quote Link to comment Share on other sites More sharing options...
stryd_one Posted May 2, 2008 Report Share Posted May 2, 2008 Ahh no worries man :) You might like to check out the enhanced clockbox too, to see the dividers at work in C. Quote Link to comment Share on other sites More sharing options...
ganchan Posted May 13, 2008 Author Report Share Posted May 13, 2008 well, no good news about my code, i've make some try nothing working for now :p, so here i've attached a file that can show a little (not so good for real) what can do odd lfo long periods.2 BassLine Seq. lines, 2 notes each, other notes are glided.Lfo1 L PTr 4/3 DPW115 SncNoLfo2 L PSw 3/1 D.F40 SncYesLfo1 R offLfo2 R PWs 3/4 D.F30 SncNoOdd_Lfo_Values.mp3Odd_Lfo_Values.mp3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.