Skip to content

Commit f41b4a0

Browse files
Toby MaoToby Mao
Toby Mao
authored and
Toby Mao
committed
pip structure build
1 parent a642032 commit f41b4a0

18 files changed

+64
-140
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__pycache__/

LICENSE

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The MIT License (MIT)
2+
Copyright © 2018 <copyright holders>
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5+
6+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
8+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# rcaudio : A Realtime Audio Recording & Analyze Script
2+
3+
## Introduction
4+
5+
rcaudio is a realtime audio recording script, it provide easy way to record via microphone and then analyze.
6+
7+
rcaudio provide APIs to get:
8+
9+
* The raw audio data
10+
* Volume
11+
* Beat Information
12+
-985 Bytes
Binary file not shown.
-2.63 KB
Binary file not shown.
-2.03 KB
Binary file not shown.
-1.75 KB
Binary file not shown.
-1.6 KB
Binary file not shown.
-1.46 KB
Binary file not shown.

beat_analyzer_old.py

-128
This file was deleted.

main.py renamed to demo.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
from core_recorder import CoreRecorder
2-
from simple_recorder import SimpleRecorder
3-
from volume_analyzer import VolumeAnalyzer
4-
from beat_analyzer import BeatAnalyzer
1+
from rcaudio import *
52
import time
63
import logging
74

85

96
logging.basicConfig(level=logging.DEBUG,
10-
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s')
7+
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s')
118

129

1310
def demo1():

rcaudio/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from .core_recorder import CoreRecorder
2+
from .simple_recorder import SimpleRecorder
3+
from .base_analyzer import BaseAnalyzer
4+
5+
from .volume_analyzer import VolumeAnalyzer
6+
from .beat_analyzer import BeatAnalyzer
7+
8+
__all__ = [
9+
"CoreRecorder",
10+
"SimpleRecorder",
11+
"BaseAnalyzer",
12+
"VolumeAnalyzer",
13+
"BeatAnalyzer"
14+
]
File renamed without changes.

beat_analyzer.py renamed to rcaudio/beat_analyzer.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import librosa
66
import bisect
77
import math
8-
from base_analyzer import BaseAnalyzer
8+
from .base_analyzer import BaseAnalyzer
99

1010
class BeatAnalyzer(BaseAnalyzer):
1111
def __init__(self,
@@ -41,7 +41,6 @@ def run(self):
4141
data = np.array(self.audio_data[start_samples:]).astype(np.float32)
4242
start_time = start_samples / self.sr
4343
tmpo, _beat_frames = librosa.beat.beat_track(y=data,sr = self.sr)
44-
#beat_frames = _beat_frames + int(start_samples / 512)
4544
beat_times = librosa.frames_to_time(_beat_frames) + start_time + self.start_time
4645

4746
if len(beat_times) < 5:

core_recorder.py renamed to rcaudio/core_recorder.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def __init__(self,
2525
self.__running.set()
2626

2727
def run(self):
28-
self.logger.info("Start to recording...")
29-
self.logger.info(" Time = %s"%self.time)
30-
self.logger.info(" Sample Rate = %s"%self.sr)
28+
self.logger.debug("Start to recording...")
29+
self.logger.debug(" Time = %s"%self.time)
30+
self.logger.debug(" Sample Rate = %s"%self.sr)
3131
self.start_time = time.time()
3232
pa=PyAudio()
3333
stream=pa.open(format = paInt16,channels=1, rate=self.sr,input=True, frames_per_buffer=self.frames_per_buffer)

simple_recorder.py renamed to rcaudio/simple_recorder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from core_recorder import CoreRecorder
1+
from .core_recorder import CoreRecorder
22
import threading
33
import logging
44
import time

volume_analyzer.py renamed to rcaudio/volume_analyzer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33
import time
44
import queue
5-
from base_analyzer import BaseAnalyzer
5+
from .base_analyzer import BaseAnalyzer
66

77
class VolumeAnalyzer(BaseAnalyzer):
88
def __init__(self,

setup.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import setuptools
2+
3+
with open("README.md", "r") as fh:
4+
long_description = fh.read()
5+
6+
setuptools.setup(
7+
name="rcaudio",
8+
version="0.0.1",
9+
author="mhy12345",
10+
author_email="maohanyang789@163.com",
11+
description="A realtime audio recording scripts",
12+
long_description=long_description,
13+
long_description_content_type="text/markdown",
14+
url="https://github.com/mhy12345/rcaudio",
15+
packages=setuptools.find_packages(),
16+
classifiers=[
17+
"Programming Language :: Python :: 3",
18+
"License :: OSI Approved :: MIT License",
19+
"Operating System :: OS Independent",
20+
],
21+
)

0 commit comments

Comments
 (0)