using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GetCardData { public class Sample { private long _sampleNumber; //just an index into the file (of samples) that this value came from private short _value; public Sample(long sampleNumber, short value) { _sampleNumber = sampleNumber; _value = value; } public long SampleNumber { get { return _sampleNumber; } } public string TimeOffset { get { //Assuming 44.1KHz, we can derive the exact millisecond from the sample number double second = _sampleNumber / 44100.0; return second.ToString(); } } public string Height { get { //Assuming 0 is silence, we can return a wave/peak "height" or percentage (easier to see in Audacity) double height; if (_value >= 0) height = _value / 32767.0; else height = _value / 32768.0; return height.ToString(); } } public short Value { get { return _value; } } } }