diff --git a/README.md b/README.md index 0cf22be..2300fdb 100755 --- a/README.md +++ b/README.md @@ -22,62 +22,9 @@ Here a few examples on the usage of Clock library for MIDI devices, keep in mind If you dont want to build a MIDI interface and you are going to use your arduino only with your PC, you can use a Serial-to-Midi bridge and connects your arduino via USB cable to your conputer to use it as a MIDI tool [like this one](http://projectgus.github.io/hairless-midiserial/). -### A Simple MIDI Sync Box sketch example -Here is a example on how to create a simple MIDI Sync Box - -```c++ -#include - -// MIDI clock, start and stop byte definitions - based on MIDI 1.0 Standards. -#define MIDI_CLOCK 0xF8 -#define MIDI_START 0xFA -#define MIDI_STOP 0xFC - -// The callback function wich will be called by Clock each Pulse of 96PPQN clock resolution. -void ClockOut96PPQN(uint32_t * tick) { - // Send MIDI_CLOCK to external gears - Serial.write(MIDI_CLOCK); -} - -// The callback function wich will be called when clock starts by using Clock.start() method. -void onClockStart() { - Serial.write(MIDI_START); -} - -// The callback function wich will be called when clock stops by using Clock.stop() method. -void onClockStop() { - Serial.write(MIDI_STOP); -} - -void setup() { - - // Initialize serial communication at 31250 bits per second, the default MIDI serial speed communication: - Serial.begin(31250); - - // Inits the clock - uClock.init(); - // Set the callback function for the clock output to send MIDI Sync message. - uClock.setClock96PPQNOutput(ClockOut96PPQN); - // Set the callback function for MIDI Start and Stop messages. - uClock.setOnClockStartOutput(onClockStart); - uClock.setOnClockStopOutput(onClockStop); - // Set the clock BPM to 126 BPM - uClock.setTempo(126); - - // Starts the clock, tick-tac-tick-tac... - uClock.start(); - -} - -// Do it whatever to interface with Clock.stop(), Clock.start(), Clock.setTempo() and integrate your environment... -void loop() { - -} -``` - ### Acid Step Sequencer -A clone of Roland TB303 step sequencer main engine, here is a example with no user interface for interaction. If you're looking for a complete and working TB303 sequencer engine clone with user interface please take a look here https://github.com/midilab/uClock/tree/development/examples/AcidStepSequencer. +A clone of Roland TB303 step sequencer main engine, here is a example with no user interface for interaction. If you're looking for a user interactable TB303 sequencer engine clone with user interface please take a look here https://github.com/midilab/uClock/tree/development/examples/AcidStepSequencer. ```c++ // Roland TB303 Step Sequencer engine clone. @@ -250,5 +197,58 @@ void loop() //processYourButtons(); //processYourLeds(); //processYourPots(); +} +``` + +### A Simple MIDI Sync Box sketch example +Here is a example on how to create a simple MIDI Sync Box + +```c++ +#include + +// MIDI clock, start and stop byte definitions - based on MIDI 1.0 Standards. +#define MIDI_CLOCK 0xF8 +#define MIDI_START 0xFA +#define MIDI_STOP 0xFC + +// The callback function wich will be called by Clock each Pulse of 96PPQN clock resolution. +void ClockOut96PPQN(uint32_t * tick) { + // Send MIDI_CLOCK to external gears + Serial.write(MIDI_CLOCK); +} + +// The callback function wich will be called when clock starts by using Clock.start() method. +void onClockStart() { + Serial.write(MIDI_START); +} + +// The callback function wich will be called when clock stops by using Clock.stop() method. +void onClockStop() { + Serial.write(MIDI_STOP); +} + +void setup() { + + // Initialize serial communication at 31250 bits per second, the default MIDI serial speed communication: + Serial.begin(31250); + + // Inits the clock + uClock.init(); + // Set the callback function for the clock output to send MIDI Sync message. + uClock.setClock96PPQNOutput(ClockOut96PPQN); + // Set the callback function for MIDI Start and Stop messages. + uClock.setOnClockStartOutput(onClockStart); + uClock.setOnClockStopOutput(onClockStop); + // Set the clock BPM to 126 BPM + uClock.setTempo(126); + + // Starts the clock, tick-tac-tick-tac... + uClock.start(); + +} + +// Do it whatever to interface with Clock.stop(), Clock.start(), Clock.setTempo() and integrate your environment... +void loop() { + } ``` \ No newline at end of file diff --git a/examples/AcidStepSequencer/README.md b/examples/AcidStepSequencer/README.md index b0ddc8a..910b69c 100644 --- a/examples/AcidStepSequencer/README.md +++ b/examples/AcidStepSequencer/README.md @@ -4,3 +4,16 @@ With some user interface changes for cheap construction of a functional TB303 en ![Image of uMODULAR ctrl16 pcb top view](https://raw.githubusercontent.com/midilab/uClock/development/examples/AcidStepSequencer/acid_step_sequencer-protoboard-v001.png) +## Interface from left to rigth + +POT1: Octave +POT2: Note +POT3: Sequence Length +POT4: Sequencer BPM Tempo + +Button1: Prev Step +Button2: Next Step +Button3: Rest +Button4: Glide +Button5: Accent +Buttons6: Play/Stop \ No newline at end of file