pyupm_mic module

class pyupm_mic.Microphone(micPin)[source]

Bases: object

API for the Analog Microphone.

ID: microphone

Name: Simple Analog Microphone

Other Names: Grove Sound Sensor

Category: sound

Manufacturer: seeed

Link:http://www.seeedstudio.com/wiki/Grove_-_Sound_Sensor

Connection: analog

Kit: gsk This module defines the Analog Microphone sensor

C++ includes: mic.hpp

findThreshold(ctx, threshold, buffer, len)[source]

int findThreshold(thresholdContext *ctx, unsigned int threshold, uint16_t *buffer, int len)

Given the sampled buffer, this method returns TRUE/FALSE if threshold is reached

ctx: Threshold context

threshold: Sample threshold

buffer: Buffer with samples

len: Buffer length

getSampledWindow(freqMS, numberOfSamples, buffer)[source]

int getSampledWindow(unsigned int freqMS, int numberOfSamples, uint16_t *buffer)

Gets samples from the microphone according to the provided window and number of samples

freqMS: Time between each sample (in microseconds)

numberOfSamples: Number of sample to sample for this window

buffer: Buffer with sampled data

printGraph(ctx)[source]

void printGraph(thresholdContext *ctx)

Prints a running average of the threshold context

ctx: Threshold context

class pyupm_mic.thresholdContext[source]

Bases: object

averageReading
averagedOver
runningAverage
class pyupm_mic.uint16Array(nelements)[source]

Bases: object

cast()[source]
static frompointer()