Show Posts
Pages: 1 ... 5 6 [7]
91  Using Arduino / Audio / setting up midi [HELP][NEWBIE] on: April 25, 2012, 09:28:42 pm
Hello guys,

Been sitting up for a couple of hours, I really should goto sleep but I know that all Ill do in bed is thinking "what have I done wrong?".

The problem is configuring the MIDI.
Here is how I did:

First of all I soldered some wires on the DIN output, here is how it looks like (not my picture, but thats how I did).
. Ive done it exactly like that!

Then I went to my board and connected the DIN to the arduino by putting:
PIN 5 (red cable) = TX
PIN 2 (black cable) = ground
PIN 4 (green cable) = 220ohm resistor + 5v

I took this code to confirm wheter its working or not
Code:
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// MAKE MAGAZINE - MIDI TEST CODE
// Stephen Hobley 2008
// www.stephenhobley.com
////////////////////////////////////////////////////////////////////////////////////////////////////////

// Variables: ///////////////////////////////////////////////////////////////////////////////////////////
#define MIDICMD_NOTEON 0x90 // MIDI command (Note On, Channel 0)
void SendMIDI(char cmd, char data1, char data2)
{
  Serial.print(cmd);
  Serial.print(data1);
  Serial.print(data2);
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////
// SETUP FUNCTION
/////////////////////////////////////////////////////////////////////////////////////////////////////////
void setup()
{
  // Set MIDI baud rate:
  Serial.begin(31250);
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////
// MAIN LOOP
/////////////////////////////////////////////////////////////////////////////////////////////////////////
void loop()
{
  for (int i= 60; i < 70; i++)
  {
    // NOTE_ON
    SendMIDI(MIDICMD_NOTEON, i, 127);
    delay(250);
  
    // NOTE OFF
    SendMIDI(MIDICMD_NOTEON, i, 0); // Silence the note
  }
}

Ive also tried the code from the arduino.cc learning page 2, without success.

Well how do I know that the problem is there?
Well I do have a keyboard that works with midi, and I tried it up with a software called MIDI OX. Works..
And I can see that the TX "led" is blinking, which means it it sending .

Please help me, whats going wrong? :/
92  Using Arduino / Microcontrollers / Which arduino to order on: April 24, 2012, 10:10:12 am
Hello peeps,

Im about to order an arduino microcontroller, but there are many to choose between.
So.. could any1 give me some feeds on which arduino to order?

Atm I have a Arduino Uno, borrowed from the school and as I am enjoying this I want to have my own!

Ive been looking at the Arduino Mega 2560 based on the ATmega2560 (Arduino Mega AVR ATmega2560 USB board).
Should I just get this one?
93  Using Arduino / Programming Questions / Re: Combine several notes. on: April 21, 2012, 07:19:20 pm
Thanks again for taking your time to help me through, I really appreciate it.

Ive taken a look through the code and tried to understand whats really going on.

What kind of "mix" does he use? What is a mix? smiley-razz
I assume he has several mixes that each one output a sound.

 
Code:
  if (digitalRead (note1button) == LOW) {
1.    if (note1playing == 0)  // if key is pressed and note is not started
2.    {
3.      note1playing = 1; // set note flag to playing
4.      note1end = micros() + note1time; // capture time to make note change state
5.      digitalWrite (note1pin, (1-note1state)); // start the note at high level (replace the write with something faster)
6.    }
7.    if (note1playing == 1){ // if key is pressed and note is already playing
8.      if (micros()>=note1end){ // see if its time to change note state
9.        note1end = note1end + note1time; // set time for next change
10.        digitalWrite (note1pin, 1-note1state); //  change the note state (1->0, 0->1)
      }
    }
  }

If we take a look at this part of the code.
Line 4 and 9 = Keeps track for how long we have been holding down the button.
Line 5 and 10 = This is the part where we make the output sound, and also the part that is confusing me a bit. He uses his "mix" here with the opamp, but I cannot see where he really output the specific tone.

I hope Im not making myself look dumb or something.

Cheers
94  Using Arduino / Programming Questions / Re: Combine several notes. on: April 21, 2012, 07:17:40 am
Bump!
95  Using Arduino / Programming Questions / Re: Combine several notes. on: April 20, 2012, 04:43:43 pm
How about the Octosynth from the Audio page section then?

http://www.cs.nott.ac.uk/~jqm/?p=605

I just took a look into the source code, waah that was very much for my mind I must say. I dunno where to look in the code, I went to the void loop where everything actually happens but there was to much other stuffs combined together. So that is way to much for me.

Once again, thanks for helping me out dude!
96  Using Arduino / Programming Questions / Re: Combine several notes. on: April 20, 2012, 04:12:32 pm
Thanks for the fast reply, really appreciated.

The summer thing, thats just to make the codes a bit more "good looking" to ur eyes, correct?
You can play mutiple "summers" but it does not say that u can combine em together.

I will take a deeper look into the other link, however, does some1 has some thoughts?

Edit:
Is the only way of doing that, to have several speakers?
Cause when I get my MIDI cable I will get the sound from the computer and wont be able to use several speakers from the outputs.

Thanks
97  Using Arduino / Programming Questions / Re: Combine several notes. on: April 20, 2012, 03:48:32 pm
If it seems a bit dizzy or something, please remember im just getting familiar with all the parts.
Code:
 #include "pitches.h"
  
int potPin = 0;
int inPin5 = 5;
int inPin4 = 4;
int inPin3 = 3;
int inPin2 = 2;
int readVal = 0;
 
void setup() {
  pinMode(inPin5,INPUT);
  pinMode(inPin4,INPUT);
  pinMode(inPin3,INPUT);
  pinMode(inPin2,INPUT);
 }
 
void loop() {
     if(digitalRead(inPin5) == HIGH){
    tone(8, NOTE_C4,10);
  }
  else if(digitalRead(inPin4) == HIGH){
    tone(8, NOTE_G3,10);
  }
  else if(digitalRead(inPin3) == HIGH){
    tone(8, NOTE_A3,10);
  }
  else if(digitalRead(inPin2) == HIGH){
    tone(8, NOTE_B3,10);
  }
  else if(analogRead(potPin) > 0){
    readVal = analogRead(potPin);
    tone(8, readVal,10);
  }
}

Edit:
The problem must be cause to the IF sentences, I believe.
98  Using Arduino / Programming Questions / Combine several notes. on: April 20, 2012, 03:40:30 pm
Howdie peeps.

At the moment Im making a simple drumset with buttons, its working great I can make sounds and such BUT it can only play a note at a time.
What Id like to have help with is, HOW do you make it play sounds in parallell?

Cheers
99  Using Arduino / Audio / Confused about MIDI on: April 11, 2012, 03:21:13 pm
Hello dear fellow members

Im just about to construct my laser harp very soon. Ive just recently recieved my laser modules and will soon get my phototransistor this weekend.

Ive decided to use MIDI as my interface for generating sounds.  However I am very confused with this, because there are a couple of stuffs I do not get into my mind.
1. How can I get the values of the phototransistor when the laser is on and off?
2. What values does the midi actaully send, how does it know when laser beam one has been blocked? Is it like (very simple), if beam one is struck send a certain value (a note) trough the midi output to the computer.

These are the main two questions.

Between, for a green laser beam I am in need of a phototransistor capable to handle a wavelength of 532nm. So 600nm should work, correct?

Cheers!
100  Using Arduino / Project Guidance / Re: Laserharp [Suggestions/Help] on: March 31, 2012, 08:21:16 am
Thanks for the replies and suggestions ur feeding me with, very appreciated!

I think I will go for phototransistor instead, but there is a question mark in my head that I really cant figure how to solve.
How do u measure the values from the phototransistor while you have the laser beam on and off, do I need to use a volt/potentialmeter to measure the values?

My thought of the Y-axis was to use a red laser beam, cause we will not be able to see the beam. And yes, it will be hard to detect every inch you move, but atleast you can make it 10 cm between each sensor.
But how does it know if ur moving up or down? Well, this is another thought we have considered.
To know which direction ur moving, the y-axis sensor (each one havin its own number) should register which was the first sensor touched, and when you go across another one it shall compare the difference, it is higher or lower then the sensor before? And so on .. smiley-razz But for now I will only go for the x-axis, if we do have time to implent y-axis we will.

In a week or so I will get the arduino board so I cannot make any testing at the moment, but meanwhile I can atleast get as much facts as I need so I am prepared later.

We have also been thinking of using a midi port, and now Ive been reading  abit of it.
In general all I need is the midi connector and ofcourse the cable for it.
Is that really everything u need to be able to use the midi, and ofcourse a software.

But now there is another question mark, how do you combine the midi software with the code?
101  Using Arduino / Project Guidance / Laserharp [Suggestions/Help] on: March 29, 2012, 09:48:30 am
Hello dear members,

This is my first project using the arduino processor, actually we are a group.
However, we are up with thoughts now and trying come up with some algorithms.

Right now we have ordered the lasers, 5 with a strenght of 50mW.
We are going to order some LDRs (light dependent resistor), which will notice if a beam has been interrupted.

A simple structure of the design.
LDR = "*"
Beam = "|"

1 2  3  4  5
*  *  *  *  * (x-axis)
| |  |  | |
| |  |  | |
| |  |  | |
| |  |  | |

First algorithm:
When you struck, as an example, beam 3 a specific note will be played, and so on.
This is very clear for us, and we will not interfere any kind of problem with this.

However, as we want to inplent something more, we have thought of using more LDRs in the Y-axis to notify on which "level note" you are on, so if you go further up with your hand the frequency on the note will change.

But there are problem with this! Because if you do interrupt two beams and change the level with the other hand, the program will not know which beam you should change the frequency on.

I hope Ive made it clear enough for you to understand this problem.

Cheers!
Pages: 1 ... 5 6 [7]