amplifying signal in code

So using this code

#define OUTPIN  9 //Output pin to drive coil.
#define NOTELIM  70 // Highest MIDI note to output.
#define PWLIM  300 //Pulse Width limit in us.
#define PWMULT  3 //  multiplier applied to velocity to get pulse width .


//Include librarys.

#include <MIDI.h>
#include "TimerOne.h"

MIDI_CREATE_DEFAULT_INSTANCE();

//Define Global Variables

unsigned int midiperiod[128]; // Array to store midi note periods
unsigned int pw = 20;            // Caurrent Pulase width

void setup(void){
  
  // Prepare Timer1
  Timer1.initialize(1000000);

  //  Set the pin we want the ISR to toggle for output.
  pinMode(OUTPIN,OUTPUT);

  //Start up the serial port
  Serial.begin(9600);  



//Define Midi Note Periods
  
midiperiod[0] =122312;
midiperiod[1] =115447;
midiperiod[2] =108968;
midiperiod[3] =102852;
midiperiod[4] =97079;
midiperiod[5] =91631;
midiperiod[6] =86488;
midiperiod[7] =81634;
midiperiod[8] =77052;
midiperiod[9] =72727;
midiperiod[10] =68645;
midiperiod[11] =64793;
midiperiod[36] =15289;
midiperiod[37] =14431;
midiperiod[38] =13621;
midiperiod[39] =12856;
midiperiod[40] =12135;
midiperiod[41] =11454;
midiperiod[42] =10811;
midiperiod[43] =10204;
midiperiod[44] =9631;
midiperiod[45] =9091;
midiperiod[46] =8581;
midiperiod[47] =8099;
midiperiod[72] =1911;
midiperiod[73] =1804;
midiperiod[74] =1703;
midiperiod[75] =1607;
midiperiod[76] =1517;
midiperiod[77] =1432;
midiperiod[78] =1351;
midiperiod[79] =1276;
midiperiod[80] =1204;
midiperiod[81] =1136;
midiperiod[82] =1073;
midiperiod[83] =1012;
midiperiod[108] =239;
midiperiod[109] =225;
midiperiod[110] =213;
midiperiod[111] =201;
midiperiod[112] =190;
midiperiod[113] =179;
midiperiod[114] =169;
midiperiod[115] =159;
midiperiod[116] =150;
midiperiod[117] =142;
midiperiod[118] =134;
midiperiod[119] =127;
midiperiod[12] =61156;
midiperiod[13] =57724;
midiperiod[14] =54484;
midiperiod[15] =51426;
midiperiod[16] =48540;
midiperiod[17] =45815;
midiperiod[18] =43244;
midiperiod[19] =40817;
midiperiod[20] =38526;
midiperiod[21] =36364;
midiperiod[22] =34323;
midiperiod[23] =32396;
midiperiod[48] =7645;
midiperiod[49] =7215;
midiperiod[50] =6810;
midiperiod[51] =6428;
midiperiod[52] =6067;
midiperiod[53] =5727;
midiperiod[54] =5405;
midiperiod[55] =5102;
midiperiod[56] =4816;
midiperiod[57] =4545;
midiperiod[58] =4290;
midiperiod[59] =4050;
midiperiod[84] =956;
midiperiod[85] =902;
midiperiod[86] =851;
midiperiod[87] =804;
midiperiod[88] =758;
midiperiod[89] =716;
midiperiod[90] =676;
midiperiod[91] =638;
midiperiod[92] =602;
midiperiod[93] =568;
midiperiod[94] =536;
midiperiod[95] =506;
midiperiod[120] =119;
midiperiod[121] =113;
midiperiod[122] =106;
midiperiod[123] =100;
midiperiod[124] =95;
midiperiod[125] =89;
midiperiod[126] =84;
midiperiod[127] =80;
midiperiod[24] =30578;
midiperiod[25] =28862;
midiperiod[26] =27242;
midiperiod[27] =25713;
midiperiod[28] =24270;
midiperiod[29] =22908;
midiperiod[30] =21622;
midiperiod[31] =20408;
midiperiod[32] =19263;
midiperiod[33] =18182;
midiperiod[34] =17161;
midiperiod[35] =16198;
midiperiod[60] =3822;
midiperiod[61] =3608;
midiperiod[62] =3405;
midiperiod[63] =3214;
midiperiod[64] =3034;
midiperiod[65] =2863;
midiperiod[66] =2703;
midiperiod[67] =2551;
midiperiod[68] =2408;
midiperiod[69] =2273;
midiperiod[70] =2145;
midiperiod[71] =2025;
midiperiod[96] =478;
midiperiod[97] =451;
midiperiod[98] =426;
midiperiod[99] =402;
midiperiod[100] =379;
midiperiod[101] =358;
midiperiod[102] =338;
midiperiod[103] =319;
midiperiod[104] =301;
midiperiod[105] =284;
midiperiod[106] =268;
midiperiod[107] =253;


    MIDI.begin();                //   Launch MIDI with default options
  


}

void pulse(){
  
  digitalWrite(OUTPIN,HIGH);
  delayMicroseconds(pw);
  digitalWrite(OUTPIN,LOW);
  
}

void loop(){
  
int controlnote;


  
      //Check for availible midi data
      if (MIDI.read()) {
        switch(MIDI.getType()) {        //   Get the type of the message we caught
           case midi::NoteOn:
                
                
                // get note on number and check for limit
                controlnote = MIDI.getData1();
                
                if (controlnote > NOTELIM){
                  controlnote = 10;
                }
                
                
                Timer1.attachInterrupt(pulse,midiperiod[controlnote]);
     
      
                // Calculate Pulse width from velocity and Limit to P WLIM
                pw = PWMULT * MIDI.getData2();
                if (pw > PWLIM){
                    pw = PWLIM;
                
                    }
                    
                    
               
                break;
           case midi::NoteOff:
      
                //Disable the interupt.
                Timer1.detachInterrupt();
                break;


     default:
        break;
    }
  }
  
  
  
  
  
}

I get a output of .05v peak to peak on pin D9
sadly I need this signal to control a fiber optic transmitter which has a forward voltage of 2.5v.
Is there any way to amplify this signal in code of have this signal loop back around to a analog pin and then have it output an amplified signal on a digital pin?
Thanks in advance!

I get a output of .05v peak to peak on pin D9

On a 5V Arduino, a digital pin outputs 5V peak to peak, so this statement implies you have some sort of circuitry connected to the pin.

Please explain, and tell us what signal you are measuring, and how you are measuring it.

#define OUTPIN 9 //Output pin to drive coil.

Pins can't drive "coils" directly. You must obey the recommended 20 mA output current limit, or you may destroy the pin circuitry.

You've defined midiperiod[] as an array of type unsigned int. uint16_t can hold values from o to 65535 so initializations outside of these bounds, for instance:

midiperiod[0] =122312;

won't give the expected behavior (and should trigger compiler warnings...)

What's the load on pin 9? Your comment says "output pin to drive coil"; what's the characteristics of this coil?

If you unload (disconnect) pin 9, what do you see?

What's the PWM value you're sending to pin 9 when you make this measurement? Are you using an oscilloscope or a meter and if a meter is it capable of giving accurate true RMS values or average values for a PWM signal?

output on pin nine right now is just my scope, but its going to be a fiber optic transmitter

Are you using an Uno or ...?

Regardless, a 50mV 'high' output suggests one of a pin not being configured properly, being overloaded or being damaged.

Test your pin. Do you see a ~square wave when running this:

void setup( void )
{
    pinMode( 9, OUTPUT );
    
}//setup

void loop ( void )
{
    digitalWrite( 9, HIGH );
    delay( 100 );
    digitalWrite( 9, LOW );
    delay( 100 );
    
}//loop

well don't i feel silly, thanks for all your guys help, it was my cheap Chinese boards way of telling me it was dying lol. The micro controller itself actually blew up