X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02-2.git/blobdiff_plain/aa747a416652b64a182d6e2594c08e2476d17d76..97ee1d88e84df79d82c3ca20eb89378c65197f9a:/examples/noise-profile.py?ds=inline diff --git a/examples/noise-profile.py b/examples/noise-profile.py old mode 100644 new mode 100755 index 70aa6ab..1afdff5 --- a/examples/noise-profile.py +++ b/examples/noise-profile.py @@ -2,11 +2,13 @@ import ST7735 from PIL import Image, ImageDraw from enviroplus.noise import Noise -SAMPLERATE = 16000 +print("""noise-profile.py - Get a simple noise profile. -FREQ_LOW = 100.0 -FREQ_HIGH = 2000.0 -WIDTH = 100 +This example grabs a basic 3-bin noise profile of low, medium and high frequency noise, plotting the noise characteristics as coloured bars. + +Press Ctrl+C to exit! + +""") noise = Noise() @@ -24,7 +26,7 @@ draw = ImageDraw.Draw(img) while True: - low, mid, high, amp = noise.measure() + low, mid, high, amp = noise.get_noise_profile() low *= 128 mid *= 128 high *= 128 @@ -36,4 +38,3 @@ while True: draw.line((0, 0, 0, amp), fill=(int(low), int(mid), int(high))) disp.display(img) -