Showing posts with label sync. Show all posts
Showing posts with label sync. Show all posts

Tuesday, May 26, 2020

Sending a Clock Signal to Modular Synth via WiFi

Sending an Ableton Live clock signal over WiFi to my modular synth using OSC, ESP8266 and Max for Live . The sync appears out of order because my DIY Exo Sequencer module doesn't have a reset input but overall the timing and tempo changes work really well - considering the setup.

View code here: https://github.com/little-scale/arduino-sketches/blob/master/esp8266-osc-sync.ino







Saturday, May 23, 2020

Teensy 3.6 Basics: Receiving MIDI Clock

MIDI clock messages (see System Real-Time Messages) are used to synchronise software or hardware playback transport using MIDI messages. One device sends the clock messages, and another device receives. The device receiving the messages is synchronised to the device that sends the messages.

MIDI clock messages do not carry song position, location or absolute time. Instead, this is transport information for synchronising.

There are four relevant message types - 'start', 'stop', 'continue' and 'clock'. Start and stop are self explanatory - they represent the transport beginning to play and ending to play. Continue represents a transport that is not at the start of the sequence to carry on from the current position. The clock message is sent 24 times per quarter note (a resolution of 24 ppqn). The clock message interval is, of course, depending on the beats-per-minute and can be calculated as (60 / beats-per-minute) / 24 seconds.

Teensy and the Teensyduino add-on can send and receive MIDI clock messages over USB as a USB-compliant MIDI device.

To receive MIDI clock messages on the Teensy, four functions must be written, that correspond with the following:

  • void myClock()
  • void myStart()
  • void myContinue()
  • void myStop()

These functions are created by the user, and each function will only be called when that type of message is received by the Teensy.

In setup(), each function must be connected by name to the message type it should respond to.

  • usbMIDI.setHandleClock(myClock);
  • usbMIDI.setHandleStart(myStart);
  • usbMIDI.setHandleContinue(myContinue);
  • usbMIDI.setHandleStop(myStop);

MIDI clock can be used with Ableton Live to sync the Teensy to the Transport. In Ableton Live, set up the Teensy as a sync output source in the Link MIDI tab in preferences.


When the transport is played in Live, this will then send MIDI clock messages from Live to Teensy. 

Here are three examples of sending MIDI clock messages from Live to Teensy. 



Turn on LED when transport is playing, turn off when transport is stopped







Turn on LED with every beat



View the code here: https://github.com/little-scale/arduino-sketches/blob/master/MIDI_Clock_Receive_2.ino



Two pots generate notes at 1/16ths that are synchronised to Live



View the code here: https://github.com/little-scale/arduino-sketches/blob/master/MIDI_Clock_Receive_3.ino

Teensy 3.6 Basics: Sending MIDI Clock Messages

MIDI clock messages (see System Real-Time Messages) are used to synchronise software or hardware playback transport using MIDI messages. One device sends the clock messages, and another device receives. The device receiving the messages is synchronised to the device that sends the messages.

MIDI clock messages do not carry song position, location or absolute time. Instead, this is transport information for synchronising.

There are four relevant message types - 'start', 'stop', 'continue' and 'clock'. Start and stop are self explanatory - they represent the transport beginning to play and ending to play. Continue represents a transport that is not at the start of the sequence to carry on from the current position. The clock message is sent 24 times per quarter note (a resolution of 24 ppqn). The clock message interval is, of course, depending on the beats-per-minute and can be calculated as (60 / beats-per-minute) / 24 seconds.

Teensy and the Teensyduino add-on can send and receive MIDI clock messages over USB as a USB-compliant MIDI device.

To send MIDI clock messages, four functions are used:

  • usbMIDI.sendRealTime(usbMIDI.Clock);
  • usbMIDI.sendRealTime(usbMIDI.Start);
  • usbMIDI.sendRealTime(usbMIDI.Continue);
  • usbMIDI.sendRealTime(usbMIDI.Stop);


To use a particular function, simple send it at the required point in time.

MIDI clock can be used with Ableton Live to sync the transport to the Teensy. In Ableton Live, set up the Teensy as a sync input source in the Link MIDI tab in preferences. This will enable an EXT button near the BPM. Click on this to enable external sync to the Teensy.




Here are three examples of sending MIDI clock messages from Teensy to Live. 



Sending Start and Clock



View code here: https://github.com/little-scale/arduino-sketches/blob/master/MIDI_Clock_Send_1.ino



Sending Tempo Based on Potentiometer



View code here: https://github.com/little-scale/arduino-sketches/blob/master/MIDI_Clock_Send_2.ino



Sending Tempo Based on Potentiometer, with a Button for Start and Stop




Wednesday, May 20, 2020

Pocket Operator PO-12 Sync


I made a Teensy sketch that syncs a Pocket Operator at 2PPQN to Ableton Live. The code can be found here: https://github.com/little-scale/arduino-sketches/blob/master/PO-12_Sync.ino



Wednesday, February 08, 2017

Hackaday Article on Audio Pulse Sync via Cheap USB



Wednesday, January 25, 2017

Audio Pulse Link Sync




This is a Max patch that connects to an Ableton Link network, and generates pulses suitable for a Teenage Engineering Pocket Operator PO-12 or other similar sync scenarios.

Download the Max patch here: http://milkcrate.com.au/_other/downloads/max_patches/Link_to_Pulse_Tick.maxpat

The patch requires Max - download here https://cycling74.com/products/max/ - which can be run in demo mode as a version of runtime. The patch requires the Max Ableton Link package, which can be installed via the package manager in Max.

The pulses are output via an audio interface. In this case, the audio interface that is used is a $2 - with free shipping - USB sound card.

To use the patch:

- Make sure that the laptop and any Link devices are on the same network
- Launch Max go to Options and Audio Status..., set the audio output device to the audio interface and turn the audio engine on
- Connect the output of the audio interface to the PO-12
- Launch the Link to Pulse Tick patch, and set quantum to 4 and subdivisions to 2
- Set the PO-12 to SY2 - sync input, stereo output - by pressing funct and bpm
- Press play on the PO-12 - the PO-12 will wait for a sync signal
- Enable to the output of the sync patch by turning the toggle on
- At the start of the next quantum - bar - , the patch will start sending a sync signal to the PO-12, the PO-12 will play in time with Link
- Changing the tempo in the patch will update all other Link devices on the network and vice versa

Monday, July 09, 2012

USB MIDI Clock to DIN Sync 24 Converter



This is a sketch for the Teensy. It takes a MIDI clock signal and converts it into a DIN Sync (Sync 24) signal.

The default output pins of the sketch are:

Teensy pin 11 = DIN sync start / stop
Teensy pin 12 = DIN sync shield
Teensy pin 13 = DIN sync continue
Teensy pin 14 = DIN sync clock

Download the sketch here: http://milkcrate.com.au/_other/downloads/teensy/MIDI_USB_DIN_SYNC/


Code:

int dT = 2000;

byte counter; 
byte CLOCK = 248; 
byte START = 250; 
byte CONTINUE = 251; 
byte STOP = 252; 

int sync_24_pulse_pin = 14; 
int sync_24_start_pin = 11; 
int sync_24_continue_pin = 13; 
int sync_ground = 12; 

void setup() {
  pinMode(sync_ground, OUTPUT); 
  digitalWrite(sync_ground, LOW);
  pinMode(sync_24_start_pin, OUTPUT); // Sync 24 sync pulse output
  pinMode(sync_24_continue_pin, OUTPUT); // Sync 24 sync pulse output
  
  pinMode(sync_24_start_pin, OUTPUT); // Sync 24 start / stop output
  usbMIDI.setHandleRealTimeSystem(RealTimeSystem);
  
}

void loop() {
  usbMIDI.read(); 

}

void RealTimeSystem(byte realtimebyte) {
  if(realtimebyte == CLOCK) {
    dinSync(); 
  }
  if(realtimebyte == START) {
    digitalWrite(sync_24_start_pin, HIGH); 
    digitalWrite(sync_24_continue_pin, LOW); 
  }
  if(realtimebyte == CONTINUE) {
    digitalWrite(sync_24_start_pin, HIGH); 
    digitalWrite(sync_24_continue_pin, HIGH); 
  }
  if(realtimebyte == STOP) {
    digitalWrite(sync_24_start_pin, LOW);  
    digitalWrite(sync_24_continue_pin, LOW); 
  }
}


void dinSync() {
  digitalWrite(sync_24_pulse_pin, HIGH); 
  delayMicroseconds(dT); 
  digitalWrite(sync_24_pulse_pin, LOW); 


}

Tuesday, September 20, 2011

Dot.AY's Laser Gameboys 2.0 (Now With VGA Hacking)



More information here.

Monday, October 05, 2009

Nanoloop 1.5 (Game Boy) Synced to Ableton Live

Saturday, August 08, 2009

Dual Nanoloop 2 MIDI Sync with Tuplet and Triplet Function

Overview
I made a sync device that will synchronise up to two copies of Nanoloop 2 to a MIDI clock source. The device is powered from on of the Game Boy Advance consoles, via swapping pins in order to gain access to a 3.3V signal.

The device also supports a "duplet / triplet" type mode. By sending a CC value to the device on CC number 1, the tempo relationship between the host and the slaves can be changed. Channel 1 is GBA console 1, and channel 2 is GBA console 2.

CC#1 (Modulation): 0 <= 31: slave plays 2 notes for every 2 notes that the master plays

CC#1 (Modulation): 32 <= 63: slave plays 2 notes for every 3 notes that the master plays

CC#1 (Modulation): 64 <= 95: slave plays 2 notes for every 4 notes that the master plays

CC#1 (Modulation): 96 <= 127: slave plays 2 notes for every 5 notes that the master plays.

Each slave GBA can be set independently. By combining the above rhythmic ratios, interesting rhythms and grooves can be established. See this video for a brief demo: http://www.youtube.com/watch?v=HeW_zMVoWts


Arduino Code
Download the Arduino Code here:
http://www.milkcrate.com.au/_other/downloads/projects/TwinNano2/TwinNano2.pde



Schematic
The schematic is very simple, it's basically a simple MIDI in circuit, with VCC coming from the Game Boy Advance #1. Digital pin 7 of the Arduino goes to Serial In on Game Boy Advance #1, and pin 8 goes to Serial In on Game Boy Advance #2. Add 0.1uF and 47uF caps between ground and VCC.

Wednesday, March 25, 2009

liquidcalm's $1 Nanoloop Sync

8bc user liquidcalm has posted some pictures of his beautiful $1 Nanoloop Syncbox.

Thursday, July 03, 2008

How to Build a MIDI Clock to Game Boy Sync Thing for Around AU$15

Introduction
Here is a simple, step-by-step guide to make your very own MIDI Clock to LSDJ and/or Nanoloop Sync Device.

This device will respond to 'STOP', 'START' and 'CONTINUE' MIDI real time messages, making it compatible with devices that are able to output MIDI clock messages. (eg. a drum machine or a sequencer). You can synchronise up to 6 copies of LSDJ and/or 6 copies of Nanoloop simultaneously to MIDI clock.

If you would like to build one of these yourself, you can contact me and I can send you a pre-flashed Freeduino chip etc for a very low cost. This device cost me around AU$15 in parts to make and it is not very hard at all.




Schematic
There is no need to worry about this schematic is you follow the steps below.
• The above schematic shows what the circuit is.
• In addition, you will need to apply 5V to the Arduino / Freeduino pins 7 and 20, ground to pin 8 and add a 16MHz crystal in between pins 9 and 10 which go to ground via 2 20pF capacitors. Additionally, pin 1 will need to be connected to 5V via a 10k ohm resistor.
• PORTD refers to the IC pins 2 - 6, 11 - 13
• PORTB refers to the IC pins 14 - 19
• PORTC refers to the IC pins 23 - 28




Arduino Code
There is no need to worry about this code if you would like me to send you a pre-flashed chip.

You can view and download the Arduino code here:
http://milkcrate.com.au/_other/downloads/projects/MIDIGBSYNC/




What You Will Need

Let's have a look at the required electronic components:

Resistors
1. 3.3k ohm resistor
2. 110k ohm resistor
3. 220 ohm resistor
4. 10k ohm resistor

Capacitors
5. 20pF ceramic capacitor (x 2)
6. 0.1uF ceramic capacitor
7. 47uF electrolytic capacitor

Diodes
8. 1n4148 small signal diode

Crystals
9. 16.00 MHz crystal

Integrated Circuit
10. 4n25 Optocoupler
11. Pre-flashed Arduino / Freeduino ATMega168

Sockets
12. 14 pin DIP socket (x 2)


You will also need:
• A circuit board of some sort
• A USB A to B cable that you can splice up (or some other 5V power source)
• A Game Boy link cable that you can splice up
• A 5 pin DIN socket with solderable lugs on the back
• Wiring




How to Build It, Step By Step
1. This is the circuit board I will be using in this tutorial. The brand is Datak and the model is 21-113.

2. Solder the integrated circuits and some basic components into place. Solder the 4n25 directly onto the board, being careful not to overheat the IC. If you prefer, use a 6 pin socket instead of soldering the IC directly to the board. Solder the 14 pin sockets to the board, so that they will allow the 28 pin Freeduino IC to fit comfortably in the two. This is where the Freeduino IC will sit, so I will refer to these two sockets as being the Freeduino IC.

Solder the crystal between pins 9 and 10 of the Fredduino IC. Solder the two 20pF capacitors between pins 9 and 10 respectively, and two free positions on the board. When soldering the two legs of the capacitors that are not connected to the Freeduino, use a little bit more solder and join the two together.


3. Solder the resistors and the diode into place. The diode goes in between pins 1 and 2 of the 4n25. The black band on the diode should point towards pin 1 of the 4n25. The 220 ohm resistor goes from pin 1 of the 4n25 to an empty point on the board. The 3.3k ohm resistor goes from pin 5 of the 4n25 to an empty point on the board. The 110k ohm resistor goes from pin 6 of the 4n25 to an empty point on the board.


4. Solder some caps to the power supply busses. The two long strips along the middle of the board are going to be the power supply busses. When looking at the component side, with the 4n25 facing up, the left bus is 5V and the right one is ground. Solder the 0.1uF capacitor in between 5V and ground. Solder the 47uF capacitor in between 5V and ground, so that the side with the white minus signs is connected to ground.


5. Connect power to the appropriate places for the ICs. Ground connections are shown in blue; 5V connections are shown in orange. The unconnected side of the 110k ohm resistor should go to ground. Pin 8 of the Freeduino should go to ground. The unconnected side of the two 20pF capacitors should go to ground. Pin 4 of the 4n25 should go to ground (this can be done quite easily by simply applying a little more solder to the pin and the bridging it across to the ground bus).

Pin 7 and 20 of the Freeduino should go to 5V. The unconnected side of the 3.3k ohm resistor should go to 5V.


6. Looking at the 5 pin din MIDI female connection from the back, point the five soldering lugs downwards. The second-most left pin should be soldered to the unconnected side of the 220 ohm resistor. The second-most right pin should be soldered to pin 2 of the 4n25.


7. Splice a Game Boy link cable. The green wire (clock) goes to Freeduino pin 23 (in fact, you can sync up to 6 Game Boys running LSDJ with this device... simply connect clock signals to Freeduino pins 23 - 28). Connect the blue (ground), orange (serin or serout) and red (serout or serin) to ground. You may need to make more ground connections by bridging the ground bus with another row.


8. Splice up a USB cable and connect the 5V and ground lines to the 5V and ground busses respectively. When looking at the USB connector with the four contacts facing downwards, ground is on the very left and 5V is on the very right. These two lines are usually designated with a red and a black wire.


9. And you're finished!




How To Use It with LSDJ
• Connect the USB connector to a power source, such as a computer USB port or a mains to USB power supply.

• Connect the MIDI connector to the output of a MIDI device that is capable of sending MIDI clock messages (such as a sequencer or a drum machine or an environment such as Max/MSP etc).

• Connect the Game Boy end of the link cable to the Game Boy.

• Start up LSDJ and load the song file of your choice.

• Set LSDJ to slave sync mode in the project screen.

• Select the correct position to in the song that you want to start on and press start. LSDJ will say 'WAIT'.

• Ensure that the output of your MIDI clock-generating device is set up properly to output the MIDI clock signal (for example, in Ableton Live, set the correct MIDI output to Sync On).

• Press start on your MIDI clock-generating device, LSDJ will follow.

• As you change tempo on your MIDI clock-generating device, LSDJ will follow.

• If you press stop on your MIDI clock-generating device, LSDJ will stop. However, to start again from the same position in the LSDJ song, you will need to manually select it and press start before pressing play on the MIDI clock-generating device.




Construction for Use with Nanoloop
This is identical to the steps above, except that the Game Boy link cable must be connected in a different way:
• Connect ground on the Game Boy link cable to ground on the board

• Connect SERIN on the Game Boy link cable to Freeduino pins 14, 15, 16, 17, 18 or 19

Friday, June 27, 2008

MIDI Clock --> Prophet 64 Sync Box



I made a sync device for the 8BC user TouchBoy that synchronises Prophet 64 for Commodore 64 to MIDI clock signals. It's USB powered and will respond to start, stop continue and clock real time messages.

You can see a video below of the device in action, as synced to Ableton Live. Schematic and code can be found here.


Tuesday, June 24, 2008

Custom MIDI Clock --> LSDJ Sync Box

I made a custom MIDI clock --> LSDJ sync box for the 8BC user Dexter. It is powered by USB but data is received via a MIDI connection. It will respond to real time start, stop, continue and clock messages.

How to use it:
• Connect the USB connector to a power source, such as a computer USB port or a mains to USB power supply.

• Connect the MIDI connector to the output of a MIDI device that is capable of sending MIDI clock messages (such as a sequencer or a drum machine or an environment such as Max/MSP etc).

• The included Game Boy link adaptor cable has two ends; a Game Boy end and a 3.5mm red jack end. Connect the 3.5mm red jack end to the MIDI sync device.

• Connect the Game Boy end of the link adaptor cable to the Game Boy.

• Start up LSDJ and load the song file of your choice.

• Set LSDJ to slave sync mode in the project screen.

• Select the correct position to in the song that you want to start on and press start. LSDJ will say 'WAIT'.

• Ensure that the output of your MIDI clock-generating device is set up properly to output the MIDI clock signal (for example, in Ableton Live, set the correct MIDI output to Sync On).

• Press start on your MIDI clock-generating device, LSDJ will follow.

• As you change tempo on your MIDI clock-generating device, LSDJ will follow.

• If you press stop on your MIDI clock-generating device, LSDJ will stop. However, to start again from the same position in the LSDJ song, you will need to manually select it and press start before pressing play on the MIDI clock-generating device.




Thursday, June 05, 2008

Sync Prophet 64 to MIDI Clock




A device which allows the synchronisation of the Prophet 64 cartridge to MIDI clock signals. The Arduino code can be downloaded here.

Saturday, May 24, 2008

Sync Nanoloop and LSDJ to MIDI (At the Same Time)

This setup lets one sync up to 6 copies of Nanoloop and 6 copies of LSDJ to MIDI clock signals. The circuit will respond to CLOCK TIMING, START, STOP and CONTINUE messages.

Schematic
Notes about the schematic:
• PORTD = digital pins 0 - 7
• PORTB = digital pins 7 - 13
• PORTC = analog pins 0 - 5
• PORTB = nanoloop sync
• PORTC = lsdj sync
• For each Nanoloop connection, the sync signal goes to the SERIN pin on the GB. The GND pin on the GB connects to Arduino ground.
• For each LSDJ connection, the sync signal goes to the CLK pin on the GB. The GND, SERIN and SEROUT pins on the GB all connect to Arduino ground. There is also a pull down resistor from the CLK line to ground. The value of this resistor is 22k up to around 100k or so.

Breadboard
Here is a breadboarded version with one Nanoloop sync out and one LSDJ sync out.


Code
You can get the code here:
http://milkcrate.com.au/_other/downloads/projects/nanolsdjsync/

Saturday, May 10, 2008

NanoSync


This is a device that will synchronise Nanoloop 1.x to a MIDI clock signal. A custom job for 8BC member Paranym from Melbourne.


You can see a video of this particular interface in action here:
http://youtube.com/watch?v=OQpSCPxz-E8


Arduino Code:
The Arduino code for this project can be downloaded here.


Schematic: