midi seq – Sleepless Coding and Kick in the PoopMachine

prog_2Making the user interface is maybe the most boring thing to do, a real pain in the poopmachine !! Besides, you need to build the thing to really know how the user interface should be. So, I built the thing. Needless to say that it won’t be as annoying as it could be when working on the breadboard. Now that I know the hardware won’t go further,  I can go deeper in madness. I’ll try to be as consise as possible, to not bore the few souls reading this. It mostly serves as a notebook for myself (as I’ve the tendency to loose papper, I know that the WordPress server’s location won’t be loss in mind) Now that the machine is alive, I can proceed with more experiments and see how the thing fits in its role. And…its does it very well, tested for few hours with great success. It is when you got a sequencer that you modular setup starts to talk. The sequencer is able to output:

  1. CV1 (voltage sequence)
  2. CV2(voltage sequence or midi data (controller or midi wheel). Originally though as a “accent control”, but voltage being it can be used for any CV input.
  3. Clock
  4. 2 Gates (with Rest (0V), UP(5V) and Slide (which let the gate of the next steps UP)
  5. Midi out (first seqencer)
  6. 2X100 steps
  7. Midi out (first seqencer)

it has as controls :

  1. Play/stops button
  2. a multi usage encoder and its button click
  3. Reset
  4. direction
  5. Set mode (to set parameters as MIDI port, clocking source, output gain ect…)
  6. Transpose button (to transpose the sequence with midi keyboard)
  7. a seventh button that I don’t what to do with (for now)

Inputs:

  1. MIDI IN
  2. Play gate
  3. Stop gate
  4. Reset gate
  5. Direction gate
  6. (and hope in the futur an input to add some radomness to the sequence, activated with a gate)

Saveable datas which are recalled (or not, depends on the user) at start up :

  1. MIDI in/out
  2. clock source
  3. output gain
  4. reset points (for latter)
  5. Cv2 output mode (sequence or midi)

Sequences could be saved but considering the large amount of data required, some management has to be done. An external eeprom will do the job nicely (I’ve got one which craves to get some attention after 20years on its TV board. Certainly used for saving UHF frequencies, user favorites and so one) On space matter, here’s a little trick, nothing magical or new though. Instead of using two bytes to store the midi in and midi_out into the eeprom, why not using only one with some bitwise operator ? Yes it’s very “low level” but I like it, I actually think of all this as what it is, a set of registers.

void midi_write_eeprom(void) { uint8_t data = ((midi_in<<4) | midi_out); write_eeprom(data,0); } void midi_return_eeprom(void) { midi_in = (read_eeprom(0) & 0xf0) >> 4; midi_out = (read_eeprom(0) & 0x0f); }

the same is done for the scaling of the output. Save in 1 byte, you never are cheap enough I guess. Can also be used for a set of flags, avoid wasting memory (but you loose clock cycles). output_gain_reg is the register containing the cv scale imformation for the outputs.

  lcd_gotoxy(4,1);      if(output_gain_reg & 0b00010000)lcd_puts(“x2”);        //check if 4th bit is set else lcd_puts(“x1”); lcd_gotoxy(12,1);     if(output_gain_reg & 0b00000001) lcd_puts(“x2”);         //check if 0th bit is set else    lcd_puts(“x1”);

// to set the outputs

output_gain_reg ^= 1<<0; //output 1 output_gain_ reg ^= 1<<4; //output 2

//to output the data:

send_to_DAC(1,volt_out[seq_out_index] >> (output_gain_reg & 0b00000001));  //if the bitwise operation returns 1, the result is shifted by 1 (divided by two), otherwise, shifted by zero which means….nothing happens. Add a X2 op amp gain and you have  your stuff done.

The quantity of strings needed for the LCD is also a huge kick in the SRAM memory. Although I’m planing to move all those strings into the Flash memory (AVR/PROGMEM header). If any interest you get the schematic in the previous post. thanks for reading.

Advertisements

7 Comments

Filed under Uncategorized

7 responses to “midi seq – Sleepless Coding and Kick in the PoopMachine

  1. Andrew

    Just to let you know that there is at least one person following you exploits.

    Actually One thing I would say is that. If you are going to add a random input. You might want to consider using pseudo randomness.
    If you use true randomness, you will have little control over it and it will turn-out different each time you run the sequence, while this maybe fine in moderation, I think you might find that a repeatable/pseudo randomness will turn-out to be more useful.

    Sometime in the (distant) future I hope to add a sequencer to the set-up I am building. Just the other week I was looking into adding some randomness and came to the conclusion that if the randomness is significantly different each time you play the piece back; it is unlikely to add very much in musical terms and even if it does on one occasion, it will not be repeatable.

    • hi Andrew, thanks again for your interest ! how are you ? the modular is growing up ? hahaha

      Actually this is exactly what I had in mind. A pseudo-random generator which will make the sequencer drift a bit over a period of time. Something subtle and interesting on long sequences, to make the all thing more “alive”.

      I don’t know how to implement it yet, somekind of linear feedback shift register which is a pseudo-random generator I guess, nor what factor it’ll influence. But I’ll work on that.

      I’ve just spent 30min or so, testing and playing with that sequencer. It works very well and the browsering through menus isn’t that bad, relatively fluid (maybe because I designed it though, i’d like to make it tested by others). Even the midi fonctions work good (expect for one thing). Even if it is not really pretty I’m quite happy with it.

      Although, I’ve just realised that I’m feeding and creating a new addiction hahahaha….

      • Andrew

        Hi.
        Because I would not know one end of PIC from the other, I am doing everything in hardware !! This limits my choices somewhat. To keep things simple I was thinking along the lines of having banks of sequences that output a one bit data stream. The sequences will be anything from a couple of bars long to, say, 16 bars long. By combining different sequences in different ways I can get short sequences that repeat but with slight differences each time. Example> If I combine a 4 Bar and a 16 Bar sequence, the 4bar sequence will repeat itself four times for one complete 16bar sequence. This means that I will get four 4bar loops modified by the 16bar loop before the whole thing repeats itself. Add a third sequence to the mix and things get even more complex. I intend to feed the bit-streams directly to the data lines of D2A converters to generate control voltages.

        What is more, if, for example, you program your 16bar sequence such that bar4, bar8, bar12 and bar16 are more erratic that the other bars, this will blend in very nicely with a four-to-the-floor beat.

        Hope the above makes sense !!
        Any-way that is what I ithink I will do, Though I will have to either manually program some EPROMS or use diode matrices. one thing I do have is plenty of space for large circuit boards….Which is probably just as well LOL

  2. Andrew

    PS. I forgot to mention something.

    ” Although, I’ve just realised that I’m feeding and creating a new addiction hahahaha….”

    Creating an addiction and then feeding it is very,very dangerous. But hay, we live on the edge of danger every time we think of some new thing to add to our creations LOL

  3. very interesting idea indeed. although you’d probably need a large number of digital ICs.

    It’s a sane addiction (that what I’m telling myself…lol). Better having this that something more health concerned addiction lol

    • Andrew

      Yep ! l-o-a-d-s of IC’s but you can often get ten from China for the price of one from the UK (Oh how I love eBay). It also means large circuit boards which means large enclosure, which means plenty of space for the controls, so it sort of works itself out….sort of !!

      I keep meaning to post some pic’s and details…I will one day.

      • yes it could be very interesting to have a documented article about it !

        I always buy components in bulks from China (or Tayda electronics in Tailland when I need fewer parts), way cheaper that way if you don’t mind the wait. Never had bad surprises.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s