Jump to content

Recommended Posts

Posted

hi ,

i want to implement an "half tempo" function in my seq (to easily make Hip-Hop break during Jungle mix) and want to be abble to return to the normal tempo with the same button .

It 's what i start to add to the code ,i've done it in the "seq_buttons.inc" after adding an F5 button:

SEQ_BUTTON_F5

SEQ_BPM_Get

SET_BSR SEQ_BPM

movf SEQ_BPM, W, BANKED

;; half BPM

clrf TMP2 ; clear help register

clrc        ; clear carry bit

rrcf SEQ_BPM, W, BANKED      ; shift BPM value to the right (== BPM / 2)

movwf SEQ_BPM, BANKED

SEQ_BPM_End

;; enable IRQs again and exit

IRQ_ENABLE

return

that is for the half function, is the "seq_BPM_End" needed?

;; do nothing if button has been depressed

IFSET MIOS_PARAMETER2, 0, return

how i have to change that to "*2" the tempo when i release (or press again ) the button?

  • 2 weeks later...
  • 4 weeks later...
Posted

hi ,

finally ,the divide function isn't suitable for this ,cause it doesn't work in an relative way ,and there is no way to get all the divide  parameters of each track.

So ,i' ve done my HALF BPM function :

as the seq enter in SLAVE MODE below 50bpm ,the /2 operation only happen if your tempo is upper 100bpm ,and as 255 is the max tempo ,the x2 function only happen if your tempo is below 127.

here is the code i've done :

;; --------------------------------------------------------------------------

;;  F2 button --- implement your favourite function here!

;; --------------------------------------------------------------------------

SEQ_BUTTON_F2

;; branch to BPM_RESTORE if button has been depressed

IFSET MIOS_PARAMETER2, 0, rgoto BPM_RESTORE

btg SEQ_MODE0, SEQ_MODE0_MENU, BANKED

SET_BSR SEQ_BASE

call SEQ_BPM_Get

movlw 0x64

cpfsgt SEQ_BPM, 1

goto DISABLE_RESTORE

rrncf SEQ_BPM ,0

call    SEQ_BPM_Set

SET_BSR SEQ_BASE

;;then branch to bpm menu

movlw CS_MENU_PAGE_BPM 

goto CS_M_HLP_ChangePage

DISABLE_RESTORE

bsf MOXI_MEM1, 0

return

BPM_RESTORE

SET_BSR SEQ_BASE

btfss MOXI_MEM1, 0

bra BPM_MULTIPLY

bcf MOXI_MEM1 ,0

goto BACK_TO_MENU

BPM_MULTIPLY

SET_BSR SEQ_BASE

rlncf SEQ_BPM ,0

call    SEQ_BPM_Set

call SEQ_BPM_End

SET_BSR SEQ_BASE

;; then exit to EDIT menu

BACK_TO_MENU

movlw CS_MENU_PAGE_VIEW

goto CS_M_HLP_ChangePage

the "MOXI_MEM1" is just to ensure that the 2*multiply function isn't done if you realease the buton when the half function was avoided (if tempo is below 100bpm).

this function work ,but sometimes ,after some navigation (switching between solo ,pattern...) do false operation ,or always set my bpm to a tempo that correspond to nothing .

i think the operation is sometime done on a value loaded into W by other routine ,so i've done the same thing using file instead of W but it doesn't solve my problem...

for now ,the function work fine ,so you can try it ,just adding the "MOXI_MEM1" in your app.define and the function in

seq_butons.inc . and then help me.... :)

secondly ,i want this function to be synced with the first step ,and i've try to use this way :

;; ------------------------------------------------------------------

;; request next pattern if sequencer running and last position reached

;; ------------------------------------------------------------------

and the following :

movlw (4*6)-10 ; (this value has to be adjusted - depends on the time which is necessary to load 4 patterns)

IFNEQ SEQ_CLK_TICK_CTR, BANKED, rgoto """but where i go if not? if i do a loop until the value match,the run stop!"

movlw 16-1

IFNEQ SEQ_CLK_STEP_CTR, BANKED, rgoto """but where i go if not? if i do a loop until the value match ,the run stop!"

;;macro IFNEQ = cpfseq  reg, reg_a

maybe i have to take the value of the step played when the buton is pressed ,then start a kind of counter ,but how to let other function (especially the run!!!) be working ,waiting for the pointer reach the first step?

Posted

Hi Moxi,

it's better to build such a change into seq_bpm.inc

You will find a detailed description about how BPM is handled in Master and Slave mode

And you will find out that the timer is clocked four times faster than a common MIDI clock tick

This means that you only have to divide the multiplier by 2

If you want to switch between normal BPM and BPM/2 during runtime, you have to think about a proper synchronization, so that the frequency won't be switched "at the wrong moment" (e.g. during the second or fourth sub-tick)

Best Regards, Thorsten.

Posted

Hi Thorsten,

you say :

And you will find out that the timer is clocked four times faster than a common MIDI clock tick

This means that you only have to divide the multiplier by 2

It's the change to be done in SEQ_MIDI.inc , eg :

;; increment clock counter by 4 - SEQ_SENT_CLK_CTR and ensure that the clock won't be echoed

movf SEQ_SENT_CLK_CTR, W, BANKED

sublw 2    ;; instead of 4

addwf SEQ_CLK_REQ_CTR, F, BANKED

but such a change will only be effective in slave mode ,no?

f you want to switch between normal BPM and BPM/2 during runtime, you have to think about a proper synchronization, so that the frequency won't be switched "at the wrong moment" (e.g. during the second or fourth sub-tick)

it's why i'm asking in the precedent post how to make the function waiting for the first step (and the first clock) ..

more test needed ...but it's the week-end...

Posted

No, in the meantime I think that the best place for the change is propably in seq_core.inc, function SEQ_CORE_Clk_Reference

You will find following line:

  movlw (4*6)-1 ; we are working with 4 times resolution

for BPM/2 it must be:

  movlw (2*4*6)-1 ; we are working with 4 times resolution and BPM/2

so, it's just a IFSET instruction, let's assume that flag 0 of your new register which controls the BPM contains the current state (BPM or BPM/2), then write:

  movlw (4*6)-1 ; we are working with 4 times resolution

  IFSET MOXI_REGISTER, 0, movlw (2*4*6)-1 ; we are working with 4 times resolution and BPM/2

Here you also know when a new step will be started (search for "increment step counter").

For a proper synchronization: you need three flags: one which requests a change, one which contains the new state (BPM or BPM/2), one which contains the current state (BPM or BPM/2)

So, additional change before ";; increment step counter":

    ;; handle BPM change request

    IFCLR MOXI_REGISTER, 2, rgoto SEQ_CORE_Clk_Reference_NoBPMC

      bcf MOXI_REGISTER, 2

      bcf MOXI_REGISTER, 0

      btfsc MOXI_REGISTER, 1

      bsf MOXI_REGISTER, 0

SEQ_CORE_Clk_Reference_NoBPMC

  ;; increment step counter

Note: if your MOXI_REGISTER is located between 0x100-0x1ff (SEQ_BASE), use BIFSET/BIFCLR instead of IFSET/IFCLR and add BANKED after each register access

Note also: I've no idea if this really works, but this was the information I was able to give you within 30 minutes of digging through the code and thinking about possible solutions...

Best Regards, Thorsten.

Posted
Note also: I've no idea if this really works, but this was the information I was able to give you within 30 minutes of digging through the code and thinking about possible solutions...

Great thanks ,30 minutes of your time is a big gift ,i will do what needed to finish that by myself ..

  • 4 weeks later...
Posted

hi ,

i've finished and tested this function ,following the TK's advise.

i've done it synced with the begenning of the pattern (first step)

how it works :

- press the F(x) buton that you have assigned to the half tempo function

the pattern will go at bpm/2 as soon as the first step will be reached.

- press again theF(x) buton ,the bpm will return to normal speed as soon as the first step will be reached.

Note: the bpm outputed to MIDI out won't be changed ,so if you have delay, arp or LFO synced to the seq BPM on the gear controled by the seq  ,they will run at the same speed in the two state.

you need to modify :

1. the "app.defines" file, add this atthe end of the file:

HALF_BPM EQU 0x360

2.the "seq_butons.inc" file , add this to the F(x) buton you choose (the F2 buton here)

;; --------------------------------------------------------------------------

;;  F2 button --- implement your favourite function here!

;; --------------------------------------------------------------------------

SEQ_BUTTON_F2

IFSET MIOS_PARAMETER2, 0, return

SET_BSR SEQ_BASE

btg HALF_BPM, 1

bsf HALF_BPM, 2

return

3. the "eq_core.inc" file ,search for this part :"increment reference counters (if "first clk" flag not set)", and add this:

;; ------------------------------------------------------------------

;; increment reference counters (if "first clk" flag not set)

;; ------------------------------------------------------------------

SEQ_CORE_Clk_Reference

;; increment tick counter

incf SEQ_CLK_TICK_CTR, F, BANKED

bz SEQ_CORE_Clk_Reference_ResetT

movlw (4*6)-1 ; we are working with 4 times resolution

IFSET HALF_BPM, 0, movlw (2*4*6)-1      ; we are working with 4 times resolution and BPM/2 ********************

IFLEQ SEQ_CLK_TICK_CTR, BANKED, rgoto SEQ_CORE_Clk_Reference_NoOv

SEQ_CORE_Clk_Reference_ResetT

;; clear tick counter

clrf SEQ_CLK_TICK_CTR, BANKED

;; if step display update enabled, request display update

btfsc CS_STAT, CS_STAT_STEP_DISPLAY_UPDATE

bsf CS_STAT, CS_STAT_DISPLAY_UPDATE_REQ

    ;; handle BPM change request   ******************************************************************

IFCLR HALF_BPM, 2, rgoto SEQ_CORE_Clk_Reference_NoBPMC****************************************

movlw 16-1*****************************************************************************

IFNEQ SEQ_CLK_STEP_CTR, BANKED, rgoto SEQ_CORE_Clk_Reference_NoBPMC***********************

    bcf HALF_BPM, 2******************************************************************************

    bcf HALF_BPM, 0******************************************************************************

    btfsc HALF_BPM, 1*****************************************************************************

    btg HALF_BPM, 0*******************************************************************************

SEQ_CORE_Clk_Reference_NoBPMC******************************************************************

   

;; increment step counter

incf SEQ_CLK_STEP_CTR, F, BANKED

movlw 16-1

IFLEQ SEQ_CLK_STEP_CTR, BANKED, rgoto SEQ_CORE_Clk_Reference_NoOv

SEQ_CORE_Clk_Reference_ResetS

;; clear step counter

clrf SEQ_CLK_STEP_CTR, BANKED

SEQ_CORE_Clk_Reference_NoOv

here you just have to insert the line followed by the little cross.

i'm sure TK could do better ,and i can't say if this function have any influence on the realtime behaviour of the SEQ ,but in this state ,it works fine (i haven't noticed any bugs..)

if some one want to program a display update to see when this function is enabled....

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...