Sets up secure audio streaming, sampling, processing, FF transformation, and publishing via MQTT protocol
The following installations and imports are required to run this application.
Helpful Guides
- AWS IoT Development Guide: Describe the basic features and hierachy of AWS IoT
- Git Guide: Helpful Git commands
Installs
- Python 3.6 via python software foundation
- AWSIoTPythonSDK via aws-iot-device-sdk-python on github
- allows developers to access / control devices via the AWS IoT platform
RPI Audio Levels viarpi-audio-levels on githubthis script also uses the GPU FFT library installed on RPi(see link)
Imports
- Pyaudio
- Numpy
- Queue
- Threading
Cython (if installing RPI Audio Levels library, above)
Security Credentials
- Root Certificate Authority Certificate File
- Private Key File
- Activated Certificate File
Hardware Used
- Raspberry Pi 3 Model B
- Snopy Rampage SN-RM7X USB Microphone
Keys
- aws_vars (mandatory): necessary to connect to Hala AWS endpoint broker
Values
<clientId>
in "*_topics" keys gets replaced with the actual 'clientId' value
ENVR VARS
callback: will the script use the pyaudio stream callback feature or notrecording_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