Skip to content

Sets up secure audio streaming, sampling, processing, FF transformation, and publishing via MQTT protocol

Notifications You must be signed in to change notification settings

rbed23/py-simple-acoustic-sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Acoustic Sensor


Description

Sets up secure audio streaming, sampling, processing, FF transformation, and publishing via MQTT protocol

Dependencies and Package Requirements

The following installations and imports are required to run this application.

Helpful Guides

  1. AWS IoT Development Guide: Describe the basic features and hierachy of AWS IoT
  2. Git Guide: Helpful Git commands

Installs

  1. Python 3.6 via python software foundation
  2. AWSIoTPythonSDK via aws-iot-device-sdk-python on github
    • allows developers to access / control devices via the AWS IoT platform
  3. RPI Audio Levels via rpi-audio-levels on github
    • this script also uses the GPU FFT library installed on RPi (see link)

Imports

  1. Pyaudio
  2. Numpy
  3. Queue
  4. Threading
  5. Cython (if installing RPI Audio Levels library, above)

Security Credentials

  1. Root Certificate Authority Certificate File
  2. Private Key File
  3. Activated Certificate File

Hardware Used

  1. Raspberry Pi 3 Model B
  2. Snopy Rampage SN-RM7X USB Microphone

Configuration

acu_sens_config.json

Keys

  • aws_vars (mandatory): necessary to connect to Hala AWS endpoint broker

Values

  • <clientId> in "*_topics" keys gets replaced with the actual 'clientId' value

acu_sens_prototype.py

ENVR VARS

  • callback: will the script use the pyaudio stream callback feature or not
  • recording_flag: used if callback == True, start recording immediately at runtime or wait
  • NUM_THREADS: if callback == True, indicate how many workers to create for processing streaming audio data
  • REC_SECONDS: if callback != True, run the script for a number of seconds
  • iot_config_json: /path/to/config.json

Pyaudio and FFT VARS

  • RATE: sample rate of the microphone in Hz
  • DATA_SIZE: sets the sample size of the buffer (base 2 exponential --> 2^X)
  • BUFFER_SIZE: actual number of samples in the buffer
  • FORMAT: Pyaudio data format of samples

About

Sets up secure audio streaming, sampling, processing, FF transformation, and publishing via MQTT protocol

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages