The formula for teleseismic bodywave magnitude is:
mb = log10(A/T) + Q
A is the zerotopeak amplitude in microns of the P phase
(not necessarily limited to the first few cycles)
T is period in seconds **
Q is a function of distance (degrees) and depth (kilometers)
For shallow events, Gutenberg and Richter (1956) provide a table of Q values as a function of distance. See: http://www.seismo.com/msop/msop79/par/tab_3.2.1.gif
For arbitrary depth, Gutenberg and Richter (1956) provide a
contour graph of Q values as a function of both distance and depth. See:
http://www.seismo.com/msop/msop79/par/fig_3.2.1.2a.gif
The NEIC uses a table to approximate the Q values shown in this graph.
This table is given here: qtab.txt .
Larry Braile gives this formula for mb:
mb = log10(A/T) + 0.01*D + 5.9
See:
http://www.eas.purdue.edu/~braile/edumod/as1mag/as1mag3.pdf
The comparison table, below, shows how the Q values differ for these various formulations. The largest differences in computed magnitudes will be for delta in the range of 100 to 109 degrees. For these distances the Braile formula may underestimate the magnitude by as much as one unit.
Braile formula: 
PZ**
= Q for shallow earthquakes 
NEIC 
NEIC qtab 

Delta 
Z=0  Z=500  
16  6.1  5.9  5.9  6.4 
20  6.1  6.0  6.1  6.4 
30  6.2  6.6  6.6  6.3 
40  6.3  6.4  6.4  6.3 
50  6.4  6.7  6.7  6.2 
60  6.5  6.8  6.9  6.2 
70  6.6  6.9  6.9  6.3 
80  6.7  6.7  6.7  6.2 
90  6.8  7.0  7.0  6.7 
100  6.9  7.4  7.3  7.2 
109  7.0  8.0  7.9  7.8 
**From Gutenberg and Richter (1956) table for shallow events. ("Magnitude and energy of earthquakes," Annali di Geofisica, v. 9, no. 1, p. 115.) 
This is the version of the Q graph from Richter (1958) Elementary Seismology, W. H. Freeman and Company. 
FORTRAN code for computing mb magnitude based on Ray Buland's NEIC nreloc program is listed in mbmag.for. mbmag.exe is a compiled version of this code which will run on a PC in a DOS window. This program reads the qtab.txt file. But even better, Bob McClure has converted the DOS program to a Visual Basic Windows program. Just download and unzip MagCalc.zip and run the program MagCalc.exe.
(By the way, links to Bob's other programs are located on this page: http://www.jclahr.com/science/psn/mcclure/index.html )
Larry Braile has computed many magnitudes from his AS1 instrument and found good agreement with USGS NEIC published magnitudes. The chart below shows the calibration values that Larry used, which were based on work done by Tim Long.
Period (s) 
Counts per micrometer of ground motion 
1  75 
1.5  92 
2  88 
3  59 
5  28 
10  5.7 
15  1.7 
20  0.63 
30  0.15 
50  0.019 
**Note: Although the mb magnitudes computed from AS1 data shown good agreement with the mb magnitudes published by the USGS National Earthquake Information Center (NEIC), there are a few measurementrule differences that show up primarily for very large earthquakes in the range of 8 and above. The USGS measures the amplitude on a trace that has been filtered to appear like a WWSSN shortperiod station, so the period of the waves does not exceed 3.3 seconds. In contrast, the period of the largest P amplitude on an AS1 may be 10 seconds or more. Another issue is how long after the first P motion can one go to find the largest amplitude. A good general rule for students using AS1 instrumental data is to limit this time to 20 seconds or less. In the case of the very largest earthquakes, such as the Sumatra Mw 9 earthquake of 2004, the maximum measured by the NEIC for some stations was as much as 120 seconds after the initial P motion. For the educational purposes of the AS1, these differences can be ignored, but are included here for completeness.