Jump to content

Step-Sequencer Programming Question


Saschaaa
 Share

Recommended Posts

Hey,

 

I'm trying to build a Midi-Step-Sequencer to control a Synthesizer.

The idea behind that is, that the Step-Sequencer has 16 encoders, each encoder stands for a single step. So the first encoder will always control the first note which sould be played, the second encoder controls the second note which should be played and so on..

Each encoder gets a certain number(1-16) and can play either nothing or  a note(c0 - h5 for example). When i hit the play button, the sequence will start to play and you will hear the notes, which are twisted. So if i iwant to hear a sequence where the third, the 10th and the 13th notes should be heared loud, i have to twist the third, 10th and 13th encoder.

Do you get the idea behind that ? I know, my explanation might sound strange...

 

I've read the sequencer tutorial, but i don't think that this is the way i should do it, because the Notestacks only can add Notes add the beginning/end of a stack.

 

Can somebody give me some hints for programming something like that ?

 

 

Best regards,

Sascha

Link to comment
Share on other sites

Hi Sascha.

Just some ruff ideas on how I would go about it, but there are probably better ways.

1 Setup a variable array to store the note value for each step. Each element/step represents a encoder value.

2 Setup a background timed step function. Seq_bpm() may help

3 In app.c, when APP_ENC_NotifyChange() fires, increment/decrement the associated array element for the active encoder

4 When the Step function fires, kill the current note, fetch the new step value from the array and output the new Note On till the next step.

This is a very basic outline and there are some examples for the build blocks that may help. I would start with #017 the simple Sequencer, and modify it with the variable array in place of the note stack. Look at #014 or #015 for encoder handling.

 You may want to also add a second encoder or pot for each step to set velocity values.

Yogi

 

EDIT After looking closely at Example #017, most of what you want to do is setup there. At the top of sec.c there are 3 arrays for Note, Vol and Length. the values in these arrays are used to build a midi package for each step.

 Though a Notestack is used, it controls the Seq Start/Stop functions; the Seq run only when a Midi Note On is received and stopped when a Note Off comes in. You may want to change the handling and do away with the Notestack

  Adding the Encoder handling is almost verbatim from Example #014.

 

 

void APP_ENC_NotifyChange(u32 encoder, s32 incrementer) {  

// toggle Status LED on each AIN value change 
MIOS32_BOARD_LED_Set(1, ~MIOS32_BOARD_LED_Get());   

// determine relative value  ***CHANGE THIS TO UPDATE A VALUE IN ARRAY OF seq.c
int value = seq_steps_note[encoder] + incrementer;  

// ensure that value is in range of 0..127
if( value < 0 )  
  value = 0;  
else if( value > 127 )  
  value = 127;   

// send event  ***CHANGE THIS TO UPDATE A VALUE IN ARRAY OF seq.c
seq_steps_note[encoder] = value;

}

The above is basic and you will also have to add the int enc code to APP_int() for your needs

Yogi

Edited by yogi
Link to comment
Share on other sites

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...
 Share

×
×
  • Create New...