A realtime audio recording scripts
Project description
rcaudio : A Realtime Audio Recording & Analyze Script
Introduction
rcaudio Rcaudio is a real-time audio analysis library that allows you to simply record audio through a microphone and analyze.
It supports real-time analysis of :
- The raw audio data
- Volume
- Beat Information
For chinese documentation : 中文文档
Usage
CoreRecorder
CoreRecorder
is used to fetch raw data. When started, the audio data will be stored in the CoreRecorder.buffer
.
from rcaudio import CoreRecorder
CR = CoreRecorder(
time = 10, #How much time to record
sr = 1000 #sample rate
)
CR.start()
while True:
if not CR.buffer.empty():
x = CR.buffer.get()
print('*'*int(abs(x)))
SimpleRecorder
In most cases, we use SimpleRecorder
. For efficiency consideration, the SimpleRecorder
should only be instantiated once.
This class can register several Analyzer
.
When the function start()
called, It will begin to record through microphone, and refresh the status of all the Analyzer
Analyzers
All class extended from BaseAnalyzer
can be registered into SimpleRecorder
. For example VolumeAnalyzer
can get the current volume of the microphone.
SR = SimpleRecorder()
VA = VolumeAnalyzer(rec_time = 1)
SR.register(VA)
SR.start()
while True:
print("VOLUME : ",VA.get_volume())
time.sleep(1)
And beat analyzer can predict the beats from the music. (However, there will be some delay.)
SR = SimpleRecorder(sr = 20000)
BA = BeatAnalyzer(rec_time = 15, initial_bpm = 120, smooth_ratio = .8)
SR.register(BA)
SR.start()
while True:
print(BA.block_until_next_beat())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rcaudio-0.0.1.tar.gz
.
File metadata
- Download URL: rcaudio-0.0.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a180bb559328bbabf63b6a35fcccbcf4003f9c638e678db6ee827bd0013b316b |
|
MD5 | b47fe6e7ab3ed53037f2509e113c9f05 |
|
BLAKE2b-256 | 26037a31078e680fd9e33b0838af3dd11245771035a7fc6fc2c32dce559a8d61 |
File details
Details for the file rcaudio-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: rcaudio-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77bf9398d37716de72ac94ef81cba1370bdf2375dbff47aa6aca6de6e9acf6e8 |
|
MD5 | 56d9bb4b0d3f2b652fdd552c48b32407 |
|
BLAKE2b-256 | 55d41aa0502afabf2c5f93b77052bddbe2af74fe3184a0d49cc57e36b76750b1 |