Showing posts with label samsung galaxy s4. Show all posts
Showing posts with label samsung galaxy s4. Show all posts
Sunday, May 19, 2013
Useful Combo: Samsung Galaxy 4 + Focusrite Scarlett 2i2
Just a quick note: the Focusrite Scarlett 2i2 audio interface works well with the Samsung Galaxy S4 when using an OTG USB cable and the USB Audio Recorder App.
Saturday, May 11, 2013
Samsung Galaxy S4 and TouchDAW As Wired and Driver-less USB MIDI Controller
Overview
Smart phones can make great music controllers, but the connection from smart phone to computer DAW can be difficult to manage. Sometimes its just easy to have a wired connection, but most wired connections require a third party software platform to act as a go-between between smart phone and computer DAW.
This is a method for controlling Live and many other DAWs using a wired connection that shows up in the computer DAW as a USB MIDI device that requires no USB driver and is simply plug and play.
The basic idea is Android phone to TouchDAW to OTG cable to USB interface to Teensy to USB cable to computer to DAW.
Demo Video
Setup
Follow this guide on hacking and connecting a cheap, class compliant USB MIDI interface to a Samsung Galaxy S4.
Connect the MIDI interface TX output and MIDI interface ground to Teensy UART RX input and Teensy ground.
Upload the code to the Teensy. This will transmit any note on, note off, continuous controller and pitch bend messages via MIDI as a driver-less USB device signal to Live, Logic, ProTools etc.
Setup TouchDAW for use with the MIDI interface.
Arduino / Teensyduino Code
// Teensy UART MIDI Input
// MIDI input variables
byte channel;
byte pitch;
byte velocity;
byte ccnumber;
byte ccvalue;
byte ccvalue2;
byte bendLSB;
byte bendMSB;
byte rstat;
byte dataIn;
int flag_previous = 0;
// Initialise hardware
HardwareSerial Uart = HardwareSerial();
void setup() {
Uart.begin(31250);
Serial.begin(57600);
pinMode(11, OUTPUT);
digitalWrite(11, HIGH);
}
void loop() {
if(Uart.available() > 0) {
dataIn = Uart.read();
Serial.print(dataIn, BYTE);
if(dataIn < 0x80 && flag_previous == 0) {
doMidiIn(rstat);
}
doMidiIn(dataIn);
}
}
void doNote(byte channel, byte pitch, byte velocity) {
usbMIDI.sendNoteOn(pitch, velocity, channel);
}
void doNoteOff(byte channel, byte pitch, byte velocity) {
usbMIDI.sendNoteOff(pitch, velocity, channel);
}
void doCC(byte channel, byte ccnumber, byte ccvalue) {
usbMIDI.sendControlChange(ccnumber, ccvalue, channel);
}
void doBend(byte channel, unsigned int bend_usb) {
usbMIDI.sendPitchBend(bend_usb, channel);
}
void doMidiIn(byte data) {
// running status set
if((data >= 0x80) && (data < 0xf0) && (flag_previous == 0)) {
rstat = data;
}
// deal with note on
if((data >= 0x90) && (data < 0xa0) && (flag_previous == 0)) {
channel = data & B00001111;
flag_previous = 1;
}
else if((data < 0x80) && (flag_previous == 1)) {
pitch = data;
flag_previous = 2;
}
else if((data < 0x80) && (flag_previous == 2)) {
velocity = data;
doNote(channel, pitch, velocity);
flag_previous = 0;
}
// done with note on
// deal with note off (as discrete status byte)
else if((data >= 0x80) && (data < 0x90) && (flag_previous == 0)) {
channel = data & B00001111;
flag_previous = -1;
}
else if((data < 0x80) && (flag_previous == -1)) {
pitch = data;
flag_previous = -2;
}
else if((data < 0x80) && (flag_previous == -2)) {
velocity = data;
doNoteOff(channel, pitch, velocity);
flag_previous = 0;
}
// done with note off (as discrete status byte)
// deal with cc data
else if((data >= 0xb0) && (data < 0xc0) && (flag_previous == 0)) {
channel = data & B00001111;
flag_previous = 3;
}
else if((data < 0x80) && (flag_previous == 3)) {
ccnumber = data;
flag_previous = 4;
}
else if((data < 0x80) && (flag_previous == 4)) {
ccvalue = data;
doCC(channel, ccnumber, ccvalue);
flag_previous = 0;
}
// done with cc data
// deal with bend data
else if((data >= 0xe0) && (data < 0xf0) && (flag_previous == 0)) {
channel = data & B00001111;
flag_previous = 5;
}
else if((data < 0x80) && (flag_previous == 5)) {
bendLSB = data;
flag_previous = 6;
}
else if((data < 0x80) && (flag_previous == 6)) {
bendMSB = data;
doBend(channel, bendLSB + (bendMSB << 7));
flag_previous = 0;
}
// done with bend data
}
Smart phones can make great music controllers, but the connection from smart phone to computer DAW can be difficult to manage. Sometimes its just easy to have a wired connection, but most wired connections require a third party software platform to act as a go-between between smart phone and computer DAW.
This is a method for controlling Live and many other DAWs using a wired connection that shows up in the computer DAW as a USB MIDI device that requires no USB driver and is simply plug and play.
The basic idea is Android phone to TouchDAW to OTG cable to USB interface to Teensy to USB cable to computer to DAW.
Demo Video
Setup
Follow this guide on hacking and connecting a cheap, class compliant USB MIDI interface to a Samsung Galaxy S4.
Connect the MIDI interface TX output and MIDI interface ground to Teensy UART RX input and Teensy ground.
Upload the code to the Teensy. This will transmit any note on, note off, continuous controller and pitch bend messages via MIDI as a driver-less USB device signal to Live, Logic, ProTools etc.
Setup TouchDAW for use with the MIDI interface.
Arduino / Teensyduino Code
// Teensy UART MIDI Input
// MIDI input variables
byte channel;
byte pitch;
byte velocity;
byte ccnumber;
byte ccvalue;
byte ccvalue2;
byte bendLSB;
byte bendMSB;
byte rstat;
byte dataIn;
int flag_previous = 0;
// Initialise hardware
HardwareSerial Uart = HardwareSerial();
void setup() {
Uart.begin(31250);
Serial.begin(57600);
pinMode(11, OUTPUT);
digitalWrite(11, HIGH);
}
void loop() {
if(Uart.available() > 0) {
dataIn = Uart.read();
Serial.print(dataIn, BYTE);
if(dataIn < 0x80 && flag_previous == 0) {
doMidiIn(rstat);
}
doMidiIn(dataIn);
}
}
void doNote(byte channel, byte pitch, byte velocity) {
usbMIDI.sendNoteOn(pitch, velocity, channel);
}
void doNoteOff(byte channel, byte pitch, byte velocity) {
usbMIDI.sendNoteOff(pitch, velocity, channel);
}
void doCC(byte channel, byte ccnumber, byte ccvalue) {
usbMIDI.sendControlChange(ccnumber, ccvalue, channel);
}
void doBend(byte channel, unsigned int bend_usb) {
usbMIDI.sendPitchBend(bend_usb, channel);
}
void doMidiIn(byte data) {
// running status set
if((data >= 0x80) && (data < 0xf0) && (flag_previous == 0)) {
rstat = data;
}
// deal with note on
if((data >= 0x90) && (data < 0xa0) && (flag_previous == 0)) {
channel = data & B00001111;
flag_previous = 1;
}
else if((data < 0x80) && (flag_previous == 1)) {
pitch = data;
flag_previous = 2;
}
else if((data < 0x80) && (flag_previous == 2)) {
velocity = data;
doNote(channel, pitch, velocity);
flag_previous = 0;
}
// done with note on
// deal with note off (as discrete status byte)
else if((data >= 0x80) && (data < 0x90) && (flag_previous == 0)) {
channel = data & B00001111;
flag_previous = -1;
}
else if((data < 0x80) && (flag_previous == -1)) {
pitch = data;
flag_previous = -2;
}
else if((data < 0x80) && (flag_previous == -2)) {
velocity = data;
doNoteOff(channel, pitch, velocity);
flag_previous = 0;
}
// done with note off (as discrete status byte)
// deal with cc data
else if((data >= 0xb0) && (data < 0xc0) && (flag_previous == 0)) {
channel = data & B00001111;
flag_previous = 3;
}
else if((data < 0x80) && (flag_previous == 3)) {
ccnumber = data;
flag_previous = 4;
}
else if((data < 0x80) && (flag_previous == 4)) {
ccvalue = data;
doCC(channel, ccnumber, ccvalue);
flag_previous = 0;
}
// done with cc data
// deal with bend data
else if((data >= 0xe0) && (data < 0xf0) && (flag_previous == 0)) {
channel = data & B00001111;
flag_previous = 5;
}
else if((data < 0x80) && (flag_previous == 5)) {
bendLSB = data;
flag_previous = 6;
}
else if((data < 0x80) && (flag_previous == 6)) {
bendMSB = data;
doBend(channel, bendLSB + (bendMSB << 7));
flag_previous = 0;
}
// done with bend data
}
Labels:
ableton live,
android,
samsung galaxy s4
SN76489 Controlled By Samsung Galaxy S4
A demo of this process and this process.
Labels:
chipmusic,
chiptech,
samsung galaxy s4,
sn76489,
teensy
Connect Samsung Galaxy S4 to Teensy via MIDI
Overview
I like the idea of connecting and controlling circuits from a touch screen device. It seems like a great combination of DIY technology and modern smartphone technology.
This post describes a basic setup that has been tested and working and is ideal for connecting an Android phone to Touch Daw to OTG Cable to MIDI interface to Teensy.
The MIDI interface is hacked to allow direct connections to data send / receive, 5V and ground, which are needed to power and communicate with the Teensy.
Using the Touch DAW application, MIDI data such as notes, pitch bend, continuous controllers can be used to send data to the Teensy. The Teensy can then be used to control a circuit of some sort.
Setup
In order to connect the smartphone to Teensy, you will need:
• An Android phone that can run Touchdaw and can act as a host USB device
• An OTG USB cable (i.e. male micro USB to female USB A)
• A class-compliant MIDI interface, even a cheap one should be fine
• A Teensy microcontroller
MIDI Interface Hacking
This is a cheap USB MIDI interface with one input to one output. It costs $6 with shipping. It is a class-compliant device. This means that the USB MIDI interface does not require any drivers when used with music software on a Windows or Mac computer i.e. it will show up as a MIDI device with an input and an output.
This is the inside of the USB MIDI interface. There are two chips - an optoisolator and a larger microprocessor. It is the larger processor that is of interest. This is an MFM0860 chip, which is a common generic USB MIDI converter. There are four pins that are needed: ground, 5V, RX and TX.
The RX pin should be used for sending MIDI data to the Android device from the Teensy, for controlling an Android MIDI app from a circuit or a Teensy. The TX should be used for sending MIDI data from the Android device to the Teensy, for controlling circuits from an Android MIDI app. The ground and 5V pins should be connected to the Teensy for power.
• Pin 1 of the MFM0860 is 5V
• Pin 4 of the MFM0860 is ground
• Pin 5 of the MFM0860 is RX (i.e. receive data from elsewhere)
• Pin 5 of the MFM0860 is TX (i.e. send data to elsewhere)
Each pin can easily be soldered to. In this example, only the 5V, ground and TX pins are used, because TouchDaw will be used to send data from the Android to the outside world.
Connecting to Teensy
The Teensy 2.0 has a UART that is separate from the USB connection, which can come in handy. The UART is a serial connection that has an RX and a TX pin.
Digital pin 7 of the Teensy is RX and digital pin 8 of the Teensy is the TX pin. 5V and ground need to be connected to the Teensy. In this example, only the TX connection from the USB MIDI interface is connected to the RX connection of the UART on the Teensy.
The blue wire is the ground, the red wire is the 5V and the white wire is the TX coming from the MIDI interface to the RX input on the Teensy.
Teensy CodingThe Teensy code is relatively straightforward, but keep in mind that:
• The code needs to facilitate the use of the Teensy UART to accept incoming data
• The code needs to facilitate MIDI protocol for incoming data
• The code needs to make use of received status bytes, as some Android apps may format data in that way
A skeleton code that contains blank function for: NoteOn, NoteOff, ContinuousController and PitchBend across all channels can be found here: http://www.little-scale.blogspot.com.au/2013/05/teensy-uart-midi-input-skeleton-code.html
Use With TouchDaw
Setup in TouchDaw is easy:
• Connect the Teensy to the MIDI Interface
• Connect the MIDI Interface to the OTG cable; Connect the OTG Cable.
• Launch TouchDaw on the Android
• Go to the Main Menu; Go to Setup; Go to MIDI Utilities
• Go to MIDI Connection, and choose USB > USB MIDI Interface
Demo
I like the idea of connecting and controlling circuits from a touch screen device. It seems like a great combination of DIY technology and modern smartphone technology.
This post describes a basic setup that has been tested and working and is ideal for connecting an Android phone to Touch Daw to OTG Cable to MIDI interface to Teensy.
The MIDI interface is hacked to allow direct connections to data send / receive, 5V and ground, which are needed to power and communicate with the Teensy.
Using the Touch DAW application, MIDI data such as notes, pitch bend, continuous controllers can be used to send data to the Teensy. The Teensy can then be used to control a circuit of some sort.
Setup
In order to connect the smartphone to Teensy, you will need:
• An Android phone that can run Touchdaw and can act as a host USB device
• An OTG USB cable (i.e. male micro USB to female USB A)
• A class-compliant MIDI interface, even a cheap one should be fine
• A Teensy microcontroller
MIDI Interface Hacking
This is a cheap USB MIDI interface with one input to one output. It costs $6 with shipping. It is a class-compliant device. This means that the USB MIDI interface does not require any drivers when used with music software on a Windows or Mac computer i.e. it will show up as a MIDI device with an input and an output.
This is the inside of the USB MIDI interface. There are two chips - an optoisolator and a larger microprocessor. It is the larger processor that is of interest. This is an MFM0860 chip, which is a common generic USB MIDI converter. There are four pins that are needed: ground, 5V, RX and TX.
The RX pin should be used for sending MIDI data to the Android device from the Teensy, for controlling an Android MIDI app from a circuit or a Teensy. The TX should be used for sending MIDI data from the Android device to the Teensy, for controlling circuits from an Android MIDI app. The ground and 5V pins should be connected to the Teensy for power.
• Pin 1 of the MFM0860 is 5V
• Pin 4 of the MFM0860 is ground
• Pin 5 of the MFM0860 is RX (i.e. receive data from elsewhere)
• Pin 5 of the MFM0860 is TX (i.e. send data to elsewhere)
Each pin can easily be soldered to. In this example, only the 5V, ground and TX pins are used, because TouchDaw will be used to send data from the Android to the outside world.
Connecting to Teensy
The Teensy 2.0 has a UART that is separate from the USB connection, which can come in handy. The UART is a serial connection that has an RX and a TX pin.
Digital pin 7 of the Teensy is RX and digital pin 8 of the Teensy is the TX pin. 5V and ground need to be connected to the Teensy. In this example, only the TX connection from the USB MIDI interface is connected to the RX connection of the UART on the Teensy.
The blue wire is the ground, the red wire is the 5V and the white wire is the TX coming from the MIDI interface to the RX input on the Teensy.
Teensy CodingThe Teensy code is relatively straightforward, but keep in mind that:
• The code needs to facilitate the use of the Teensy UART to accept incoming data
• The code needs to facilitate MIDI protocol for incoming data
• The code needs to make use of received status bytes, as some Android apps may format data in that way
A skeleton code that contains blank function for: NoteOn, NoteOff, ContinuousController and PitchBend across all channels can be found here: http://www.little-scale.blogspot.com.au/2013/05/teensy-uart-midi-input-skeleton-code.html
Use With TouchDaw
Setup in TouchDaw is easy:
• Connect the Teensy to the MIDI Interface
• Connect the MIDI Interface to the OTG cable; Connect the OTG Cable.
• Launch TouchDaw on the Android
• Go to the Main Menu; Go to Setup; Go to MIDI Utilities
• Go to MIDI Connection, and choose USB > USB MIDI Interface
Demo
Labels:
android,
samsung galaxy s4,
teensy
Subscribe to:
Posts (Atom)







