Show Posts
Pages: [1]
1  Using Arduino / Audio / Re: Need help MIDI Out from Arduino on: October 26, 2012, 03:35:03 pm
Allright now I'm difficulties with sending CC messages:

I am sending as so:

ProcessMIDIOut(176,12,xx) where xx-values that can be changed from incoming voltage

is this the right format for sending out CC messages? I want the arduino to act as MIDI controller
2  Using Arduino / Networking, Protocols, and Devices / Re: MIDI OUT as CC Messages on: October 26, 2012, 03:28:46 pm
bump
3  Using Arduino / Networking, Protocols, and Devices / MIDI OUT as CC Messages on: October 26, 2012, 02:40:14 pm
Hi guys

Right now I am working on using an arduino as a simple MIDI controller.

I was able to get the arduino to send out MIDI note number easily to a DAW (I am using Reaper). So i figured sending out CC messages would be simple

However I am not getting any respond from the DAW when assigning MIDI data. Could it be the way it is sending?

Here's an example of what I've written:

Code:
ProcessMIDIOut(176,14,76);

where 176= Channel 1 Mode, 14: unsigned , 76: value

The function is as so:

Quote
void ProcessMIDIOut(byte cmdtype, byte val1, byte val2)
{
  
 //bugging test purposes: to see what values the TX pin is sending out.
  SSerial.print("?x00?y2");
  if (cmdtype == PITCHBEND)
  {
    Serial.write(0xE0 | (channel & 0xf));            //  control change command ***Error here:: "As of Arduino 1.0 the "BYTE" keyword is no longer supported. Please use Serial.write () instead
    Serial.write(val1 & 0x7f);                       //  pb MSB 0-127
    Serial.write(val2);                              //  pb LSB 0-15 - TODO
  }
  else // All standard note and cc messages
  {
    Serial.write(cmdtype | (output_channel & 0xf));  //  control change command
    Serial.write(val1);                           //  command
    Serial.write(val2 & 0x7f);                       //  val1 0-127


and yes, Serial is in the right MIDI baud.

I'm still new to the CC messages format
4  Using Arduino / Audio / Re: Need help MIDI Out from Arduino on: October 26, 2012, 12:51:43 pm
It worked!!
Yep, that was all it was needed. Just change from print to write.

Thank you so much!!
5  Using Arduino / Audio / Re: Need help MIDI Out from Arduino on: October 26, 2012, 10:56:24 am
I've taken consideration on the MIDI IN as you suggessted. Right now, I'm focused on the MIDI OUT

Yes, I set the baud rate 31250

here's the code: https://docs.google.com/document/d/1VpcNgb8phVN_fRRYdFNwo6l-9kQLV7_ToV_rvBiVrQU/edit
6  Using Arduino / Audio / Need help MIDI Out from Arduino on: October 26, 2012, 10:26:16 am
Hi guys

so my schematic is pretty simple for the MIDI Out; basically it's the standard setup as shown here:

http://www.roguescience.org/wordpress/wp-content/uploads/2011/07/midiO.png

In fact, when I plug in to the M-audio UNO MIDI interface, I do indeed receive the incoming MIDI data from the arduino (the MIDI IN LED lights up when I change values from the arduino).

However, when I try to hook it up with Reaper in my computer, it's not communicating at all. I've checked that the MIDI interface is not the case because it worked when I hooked it up with a MIDI controller keyboard. However, I did noticed that when I hooked it up with the keyboard, the MIDI IN LED kept turning on and off continuesly, where as with the arduino, it only lights up when I change a MIDI note number.

I did not used the MIDI library that the arduino has. Instead, I've modified from another source. Basically this is what is sending out from the Arduino:

Code:
void ProcessMIDIOut(byte cmdtype, byte val1, byte val2)
{
  
 //bugging test purposes: to see what values the TX pin is sending out.
  SSerial.print("?x00?y2");
  if (cmdtype == PITCHBEND)
  {
    Serial.print(0xE0 | (channel & 0xf));            //  control change command ***Error here:: "As of Arduino 1.0 the "BYTE" keyword is no longer supported. Please use Serial.write () instead
    Serial.print(val1 & 0x7f);                       //  pb MSB 0-127
    Serial.print(val2);                              //  pb LSB 0-15 - TODO
  }
  else // All standard note and cc messages
  {
    Serial.print(cmdtype | (output_channel & 0xf));  //  control change command
    Serial.print(val1);                           //  command
    Serial.print(val2 & 0x7f);                       //  val1 0-127
  

So for instance, when I call out the function:

Code:
ProcessMIDIOut(144, 86, 100)

Would that be enough to communicate with the computer?

I know that these are the values that are sending since I've hooked an LCD to display it



7  Using Arduino / Audio / Incoming analog signal to MIDI Out on: October 15, 2012, 10:10:15 pm
Hi guys

I know there are a lot of methods of having an incoming analog signal (let's say from a guitar) and convert to MIDI. Particularly I am more interested in how Stephen Hobley did on his project, as shown here:

http://www.stephenhobley.com/blog/2011/01/24/pitch-and-volume-tracking-midi-interface-for-the-theremin/

I would ask Hobley himself, but he has not responded to my email for weeks so I figured I will ask you guys in deciphering his code.

The Volume data is pretty straightforward, but the pitch detection is what baffles me. Here's the audio component of his project:
http://www.stephenhobley.com/blog/wp-content/uploads/2011/01/schematic_4_web.gif
[the threshold comparator is what I'm focused on now]

According to his code, he takes the pitch preview of the theremin [which is analog) and convert it to square waves and feed it into an interrupt pin in the Atmega328p

Code:
void setup ()
...
...
attachInterrupt(0, sample_freq, RISING);
.....


At this point, it makes sense and I've tried it on the breadboard to confirm it (using a function generator feeding as the  pitch-preview)

Next, after having enough number of samples it will start matching the MIDI note number:

Code:
void loop ()
 
  // We have captured enough samples, time to process...
  if (sample_counter == NO_OF_SAMPLES)
  {
    ProcessSamples();

    // Start sampling again
    sample_counter = 0;
  }
}

Code:
void sample_freq() // Interrupt handler function
{
  if (sample_counter == NO_OF_SAMPLES) //NO_OF_SAMPLES = 5
    return;
   
  if ((sample_counter > 0) && (micros() < samples[sample_counter-1]))
  {
    sample_counter = 0; // Reset and
    return;             // do nothing if we have overflowed.
  }
 
  samples[sample_counter] = micros();
  sample_counter++;
}


Hobley's methods is what throws me off here...

When the function ProcessSample calls out, he takes those 5 samples and take the average of it (?) as shown here:

Code:
unsigned long ProcessSamples()
{
    accumulator =  (samples[1] - samples[0]);
    accumulator += (samples[2] - samples[1]);
    accumulator += (samples[3] - samples[2]);
    accumulator += (samples[4] - samples[3]);
   
    accumulator = accumulator / 4;
   
Then he compares (from what I'm assuming a huge array of period numbers, which I still dont know how he got those numbers) to correspond the right note:

 
Code:
   for (int i = 0; i <69; i++)
    {
      if (accumulator > lower_bound_period[i])
      {
.............................

where

Code:
uint16_t lower_bound_period[]  = {
/*22282,*/ 21052, 19869, 18748, 17696, 16706, 15768, 14880, 14046, 13259,
12515, 11814, 11152, 10525, 9931,  9374,  8849,  8351,  7882,  7442,
7024,  6631,  6260,  5908,  5577,  5264,  4968,  4689,  4426,  4177,
3943,  3722,  3513,  3316,  3130,  2955,  2789,  2632,  2485,  2346,
2214,  2090,  1972,  1862,  1757,  1658,  1565,  1478,  1395,  1317,
1244,  1174,  1107,  1045,  987,   932,   880,   830,   784,   740,
699,   659,   622,   588,   555,   524,   495,   467,   441,   421 
};

Can anyone help me understand what exactly is he doing here? Is there an actual name for this A/D method?
8  Using Arduino / General Electronics / Re: Rotary Switch--5 Position? on: October 03, 2012, 09:49:10 pm
Hey guys, I'm looking for a rotary switch that has 5 positions. I'm basically using the rotary switch as so:

http://s3.amazonaws.com/satisfaction-production/s3_images/101962/arduino-rotary-switch.png

I just want to confirm that it has to be a 1 polarize correct? What does it mean by deck? I'm asking because I'm having hard time finding the right one on digikey




Could you rephrase that 'polarize' statement, as I don't understand the question? If you mean are you only needing a single pole, five position rotary switch, that is correct. By the way in that drawing you show using external pull-up resistors. You really can save some trouble and not use them, but rather just enable the internal pull-up resistors for those specific pins, it's free and it works.

Lefty

Sorry about that. Yes I meant 1 pole .
I am actually going to be using the Atmega328 chip on a PCB board, hence it setup this way.

Thanks for the reply everyone!
9  Using Arduino / General Electronics / Rotary Switch--5 Position? on: October 03, 2012, 09:17:50 pm
Hey guys, I'm looking for a rotary switch that has 5 positions. I'm basically using the rotary switch as so:

http://s3.amazonaws.com/satisfaction-production/s3_images/101962/arduino-rotary-switch.png

I just want to confirm that it has to be a 1 polarize correct? What does it mean by deck? I'm asking because I'm having hard time finding the right one on digikey


10  Using Arduino / Displays / Re: LCD117 Driver--cant seems to get it working...drawing too much current? on: July 02, 2012, 08:48:09 pm
Never mind guys.
It seemed the breadboard I was using was the cause of it.

Carry on.
 smiley-cool
11  Using Arduino / Displays / LCD117 Driver--cant seems to get it working...drawing too much current? on: July 02, 2012, 08:41:50 pm
I've noticed a person above this thread is having the same problem I am. I've tried putting resistor between the voltage supply (5v) but it's not helping.

I've actually got the LCD working about a week ago: I've just hooked the LCD driver in its appropriate pins (ground, 5v, and Rx pin). But now, whenever I hook the ground and voltage source, the Arduino (Uno) turns off.

This is the driver I am using:
http://shop.moderndevice.com/products/20x4lcd-lcd117asmb

Any ideas?
Pages: [1]