Note Onset Localization

Craig Stuart Sapp
<craig@ccrma.stanford.edu>
23 Janurary 2006

\(\(\( (*Date : \(Sun\ Jan\ 22\ 20 : \(55 : 
            06\ PST\ 2006\)\)*) \)\( (*Colums : 
        1. \ The\ offset\ time\ in\ milliseconds\ between\ the\ click\ and\ the\ piano\ sound . 
            Negative\ values\ mean\ that\ the\ click\ came\ before\ the\ piano\ sound . 
            2. \ The\ number\ of\ reponses\ where\ the\ click\ was\ before\ the\ piano\ sound . 
            3. \ The\ number\ of\ reponses\ where\ the\ click\ was\ after\ the\ piano\ sound . 
            4. \ A\ count\ of\ all\ response\ whether\ before\ or\ after . 
            5. \ Fraction\ of\ response\ for\ "before" . 
            5. \ Fraction\ of\ response\ for\ \(\("after"\)\(.\)\)*) \)\(results = {{100, 0, 57, 57, 0, 1}, {95, 0, 24, 24, 0, 1}, {90, 0, 30, 30, 
            0, 1}, {85, 1, 41, 42, 0.024, 0.976}, {80, 0, 21, 21, 0, 1}, {75, 
            0, 9, 9, 0, 1}, {70, 0, 35, 35, 0, 1}, {65, 0, 32, 32, 0, 
            1}, {60, 2, 44, 46, 0.043, 0.957}, {55, 0, 39, 39, 0, 1}, {50, 5, 
            40, 45, 0.111, 0.889}, {45, 1, 24, 25, 0.04, 0.96}, {40, 6, 51, 
            57, 0.105, 0.895}, {35, 1, 28, 29, 0.034, 0.966}, {30, 5, 33, 38, 
            0.132, 0.868}, {25, 8, 27, 35, 0.229, 0.771}, {20, 12, 25, 37, 
            0.324, 0.676}, {15, 5, 28, 33, 0.152, 0.848}, {10, 19, 29, 48, 
            0.396, 0.604}, {5, 29, 24, 53, 0.547, 0.453}, {0, 51, 25, 76, 
            0.671, 0.329}, {\(-5\), 29, 19, 48, 0.604, 0.396}, {\(-10\), 22, 
            20, 42, 0.524, 0.476}, {\(-15\), 23, 14, 37, 0.622, 
            0.378}, {\(-20\), 27, 8, 35, 0.771, 0.229}, {\(-25\), 23, 7, 30, 
            0.767, 0.233}, {\(-30\), 32, 6, 38, 0.842, 0.158}, {\(-35\), 30, 
            1, 31, 0.968, 0.032}, {\(-40\), 25, 6, 31, 0.806, 
            0.194}, {\(-45\), 33, 3, 36, 0.917, 0.083}, {\(-50\), 36, 4, 40, 
            0.9, 0.1}, {\(-55\), 32, 1, 33, 0.97, 0.03}, {\(-60\), 35, 2, 37, 
            0.946, 0.054}, {\(-65\), 39, 0, 39, 1, 0}, {\(-70\), 40, 0, 40, 
            1, 0}, {\(-75\), 11, 0, 11, 1, 0}, {\(-80\), 25, 0, 25, 1, 
            0}, {\(-85\), 49, 1, 50, 0.98, 0.02}, {\(-90\), 34, 0, 34, 1, 
            0}, {\(-95\), 40, 0, 40, 1, 0}, {\(-100\), 86, 0, 86, 1, 
            0}};\)\)\)

{delta,  before,  after,  count,  bfrac,  afrac}  =  
        Transpose[results];

beforeplot  =  
        ListPlot[Transpose[{delta,  bfrac}],  Frame -> True,  
          Axes -> False,  PlotRange -> All,  
          PlotStyle -> {RGBColor[1, 0, 0],  PointSize[0.015]},  
          AspectRatio -> 1/4];

afterplot  =  
        ListPlot[Transpose[{delta,  afrac}],  Frame -> True,  
          Axes -> False,  PlotRange -> All,  
          PlotStyle -> {RGBColor[0, 0, 1],  PointSize[0.015]},  
          AspectRatio -> 1/4];

Show[beforeplot,  afterplot];

<<  Statistics`NonlinearFit`

Fiting an approximation curve to the data

bfit  =  
      Fit[Transpose[{delta, bfrac}],  Table[x^y,  {y,  0,  5}],  
        x]

bfitplot  =  
        Plot[bfit,  {x,  -100,  100},  
          PlotStyle -> RGBColor[1, 0, 0],  Frame -> True,  
          Axes -> False];

fullbeforeplot  =  Show[beforeplot,  bfitplot];

afit  =  
      Fit[Transpose[{delta,  afrac}],  Table[x^y,  {y,  0,  5}],  
        x]

afitplot  =  
        Plot[afit,  {x,  -100,  100},  
          PlotStyle -> RGBColor[0, 0, 1],  Frame -> True,  
          Axes -> False];

fullafterplot  =  Show[afterplot,  afitplot];

Show[fullbeforeplot,  fullafterplot];

Show[fullbeforeplot,  fullafterplot,  
        Frame -> False];

Solve[afit  ==  0.5,  x]

afit  /.  x ->  0.404748

Solve[bfit  ==  0.5,  x]

bfit  /.  x -> 0.404748

Find the zone of confusion:

Solve[afit  ==  0.75,  x]

Solve[bfit  ==  0.75,  x]

Solve[afit  ==  0.67,  x]

Solve[bfit  ==  0.67,  x]