Measure devel notes: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
Line 44: Line 44:
* http://www.dspguide.com/ch16/2.htm
* http://www.dspguide.com/ch16/2.htm
* I will precompute h[i] for all the three ranges and apply it to all the three ranges
* I will precompute h[i] for all the three ranges and apply it to all the three ranges
* See [[http://dev.laptop.org/git?p=projects/measure;a=blob;f=testing_scripts/sinc_value_estimate.py;h=6f0ed6c8f7bed0fada6ee69cd24d3117bc6e2af6;hb=HEAD|Script]]
* I have selected fc = and M =




==Scaling - for scale display, and RMS values==
===Scaling - for scale display, and RMS values===
* I get a buffer of 16bit values (-32768 to 32768). I need to calculate the corresponding rms value of the voltage
* I get a buffer of 16bit values (-32768 to 32768). I need to calculate the corresponding rms value of the voltage
* The correspondence between digital domain values and physical values has been found out experimentally as
* The correspondence between digital domain values and physical values has been found out experimentally as

Revision as of 18:27, 24 October 2007

Development notes. For the official page, please see Measure


Metadata file associated with Logs

Measure Activity logs metadata file
Filename
Filename
Filename
Logname
Logname
Logname

Log file format

sec/minute/hour/snapshot
2232
3445
stop

Draw dotted log

context.move_to(x,y)
context.arc(x,y,r,0,2*pi)


Convert #RRGGBB to an (R, G, B) tuple

colorstring = colorstring.strip()
if colorstring[0] == '#': colorstring = colorstring[1:]
r, g, b = colorstring[:2], colorstring[2:4], colorstring[4:]
r, g, b = [int(n, 16) for n in (r, g, b)]
return (r, g, b)

Get the XO colors

from sugar import profile
color=profile.get_color()
fill = color.get_fill_color()
stroke = color.get_stroke_color()

DSP

Filtering using sinc


Scaling - for scale display, and RMS values

  • I get a buffer of 16bit values (-32768 to 32768). I need to calculate the corresponding rms value of the voltage
  • The correspondence between digital domain values and physical values has been found out experimentally as
v = (m/g)*(s) + 1180   millivolts
where s is a sample value ranging from -32768 to +32768
where m = .0238(i.e. slope when all capture gains are 0dB i.e. g=1)
where g is the gain introduced by capture gains. There are two such gains Mic Boost +20dB and Capture Gain. Note that g IS NOT in dB.
  • Also let k = m/g and c = 1180
  • One option is to scale each sample in voltage domain (which would come out to be a float value) to get rms voltage, Rv = sqrt(sigma(Vi^2)) / N
  • The other option is to calculate RMS of all samples s and then convert result to equivalent voltage
  • For calculating RMS of samples s and then converting to Rv
    • sigma(Vi^2) = (k^2)*(sigma(Xi^2)) + N*c^2 + 2*k*c*sigma(Xi)
    • Once we have sigma(Vi^2) we can take square root of that and divide by N