SoundGraph 0.2__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- soundgraph-0.3.0/CHANGELOG.md +29 -0
- {SoundGraph-0.2 → soundgraph-0.3.0}/LICENSE +1 -1
- soundgraph-0.3.0/MANIFEST.in +5 -0
- soundgraph-0.3.0/PKG-INFO +178 -0
- soundgraph-0.3.0/README.md +147 -0
- soundgraph-0.3.0/SoundGraph.egg-info/PKG-INFO +178 -0
- soundgraph-0.3.0/SoundGraph.egg-info/SOURCES.txt +23 -0
- soundgraph-0.3.0/SoundGraph.egg-info/entry_points.txt +2 -0
- soundgraph-0.3.0/SoundGraph.egg-info/requires.txt +4 -0
- soundgraph-0.3.0/SoundGraph.egg-info/top_level.txt +1 -0
- soundgraph-0.3.0/pyproject.toml +3 -0
- soundgraph-0.3.0/requirements.txt +9 -0
- soundgraph-0.3.0/setup.cfg +47 -0
- soundgraph-0.3.0/setup.py +5 -0
- soundgraph-0.3.0/soundgraph/__init__.py +35 -0
- soundgraph-0.3.0/soundgraph/__main__.py +138 -0
- soundgraph-0.3.0/soundgraph/py.typed +1 -0
- soundgraph-0.3.0/soundgraph/recognizer.py +141 -0
- soundgraph-0.3.0/soundgraph/recorder.py +108 -0
- soundgraph-0.3.0/soundgraph/spectrum.py +61 -0
- soundgraph-0.3.0/soundgraph/themes.py +75 -0
- soundgraph-0.3.0/soundgraph/visualizer.py +434 -0
- soundgraph-0.3.0/tests/test_soundgraph.py +266 -0
- SoundGraph-0.2/PKG-INFO +0 -35
- SoundGraph-0.2/README.md +0 -24
- SoundGraph-0.2/SoundGraph.egg-info/PKG-INFO +0 -35
- SoundGraph-0.2/SoundGraph.egg-info/SOURCES.txt +0 -9
- SoundGraph-0.2/SoundGraph.egg-info/entry_points.txt +0 -2
- SoundGraph-0.2/SoundGraph.egg-info/requires.txt +0 -4
- SoundGraph-0.2/SoundGraph.egg-info/top_level.txt +0 -1
- SoundGraph-0.2/setup.cfg +0 -4
- SoundGraph-0.2/setup.py +0 -25
- {SoundGraph-0.2 → soundgraph-0.3.0}/SoundGraph.egg-info/dependency_links.txt +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to SoundGraph are documented here.
|
|
4
|
+
Versioning follows [Semantic Versioning](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## [0.2.0] — 2024-03-04
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Proper Python package structure under `soundgraph/`
|
|
12
|
+
- `soundgraph.visualizer` — core real-time waveform plotting via Matplotlib animation
|
|
13
|
+
- `soundgraph.recognizer` — `VoiceCommandListener` background thread using a shared audio queue
|
|
14
|
+
- CLI entry point: `soundgraph` (and `python -m soundgraph`) with `--rate`, `--chunk`, `--phrase-seconds`, `--verbose`, `--version` flags
|
|
15
|
+
- Reactive waveform colour: shifts from blue → red as volume increases
|
|
16
|
+
- Clean shutdown on window close or "stop" voice command
|
|
17
|
+
- `pyproject.toml` + `setup.cfg` modern packaging
|
|
18
|
+
- Full test suite with hardware mocking
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- **Dual microphone conflict** — original code opened two separate mic streams (PyAudio + SpeechRecognition) simultaneously, causing device errors on many systems. Fixed by sharing a single PyAudio callback stream via a thread-safe queue.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## [0.1.0] — 2024-01-01 *(initial sketch)*
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- Basic real-time audio visualizer using PyAudio + Matplotlib
|
|
29
|
+
- Simple voice "stop" command via SpeechRecognition
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: SoundGraph
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Real-time audio waveform visualizer with voice-command stop
|
|
5
|
+
Home-page: https://github.com/bappy-3/sound-graph
|
|
6
|
+
Author: Al Mustafiz Bappy
|
|
7
|
+
Author-email: almustafizbappy@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: audio,visualization,waveform,speech-recognition,microphone,real-time
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: numpy>=1.21
|
|
28
|
+
Requires-Dist: matplotlib>=3.4
|
|
29
|
+
Requires-Dist: SpeechRecognition>=3.8
|
|
30
|
+
Requires-Dist: pyaudio>=0.2.11
|
|
31
|
+
|
|
32
|
+
# SoundGraph
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/SoundGraph/)
|
|
35
|
+
[](https://pypi.org/project/SoundGraph/)
|
|
36
|
+
[](LICENSE)
|
|
37
|
+
|
|
38
|
+
**SoundGraph** is a Python package that visualizes your microphone audio as a **live waveform** in real-time.
|
|
39
|
+
|
|
40
|
+
Make noise → see the wave. Say **"stop"** (or close the window) → exits cleanly.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install SoundGraph
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> **macOS** — install PortAudio first: `brew install portaudio`
|
|
51
|
+
> **Linux** — `sudo apt-get install portaudio19-dev python3-pyaudio`
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
import soundgraph
|
|
59
|
+
|
|
60
|
+
soundgraph.start()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
That's it.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Features
|
|
68
|
+
|
|
69
|
+
| Feature | Description |
|
|
70
|
+
|---|---|
|
|
71
|
+
| **Visualization modes** | Waveform, frequency spectrum, or both side-by-side |
|
|
72
|
+
| **Color themes** | `dark`, `light`, `neon` |
|
|
73
|
+
| **Live dB meter** | Real-time decibel level bar at the bottom |
|
|
74
|
+
| **Record to WAV** | Save your session to a file while visualizing |
|
|
75
|
+
| **Device selection** | Pick any connected microphone by index |
|
|
76
|
+
| **Voice stop** | Say "stop" to exit hands-free |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Usage
|
|
81
|
+
|
|
82
|
+
### Python API
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import soundgraph
|
|
86
|
+
|
|
87
|
+
# Waveform + spectrum side-by-side, neon theme
|
|
88
|
+
soundgraph.start(mode='both', theme='neon')
|
|
89
|
+
|
|
90
|
+
# Record while visualizing
|
|
91
|
+
soundgraph.start(record=True, output='session.wav')
|
|
92
|
+
|
|
93
|
+
# List available input devices, then use one
|
|
94
|
+
soundgraph.list_devices()
|
|
95
|
+
soundgraph.start(device=2)
|
|
96
|
+
|
|
97
|
+
# All options
|
|
98
|
+
soundgraph.start(
|
|
99
|
+
mode='both', # 'waveform' | 'spectrum' | 'both'
|
|
100
|
+
theme='dark', # 'dark' | 'light' | 'neon'
|
|
101
|
+
record=True, # save to WAV
|
|
102
|
+
output='out.wav', # custom output path
|
|
103
|
+
device=0, # input device index
|
|
104
|
+
sample_rate=44100, # Hz
|
|
105
|
+
chunk=2048, # frames per update
|
|
106
|
+
phrase_seconds=1.5, # seconds per recognition attempt
|
|
107
|
+
)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Command Line
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
soundgraph # default waveform, dark theme
|
|
114
|
+
soundgraph --mode both --theme neon # spectrum + waveform, neon
|
|
115
|
+
soundgraph --record --output out.wav # record while visualizing
|
|
116
|
+
soundgraph --list-devices # print available mics
|
|
117
|
+
soundgraph --device 2 # use mic at index 2
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
All flags:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
--mode, -m waveform | spectrum | both (default: waveform)
|
|
124
|
+
--theme, -t dark | light | neon (default: dark)
|
|
125
|
+
--record, -r Record session to WAV
|
|
126
|
+
--output, -o Output WAV path (default: auto-named)
|
|
127
|
+
--device, -d Input device index
|
|
128
|
+
--list-devices List available input devices and exit
|
|
129
|
+
--rate Sample rate in Hz (default: 44100)
|
|
130
|
+
--chunk Frames per update (default: 2048)
|
|
131
|
+
--phrase-seconds Seconds per recognition (default: 1.5)
|
|
132
|
+
--verbose, -v Debug logging
|
|
133
|
+
--version Show version
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## How It Works
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
Microphone
|
|
142
|
+
│
|
|
143
|
+
▼
|
|
144
|
+
PyAudio stream (single handle)
|
|
145
|
+
│
|
|
146
|
+
├──► viz_queue → Matplotlib animation (main thread)
|
|
147
|
+
├──► speech_queue → VoiceCommandListener (background thread)
|
|
148
|
+
└──► record_queue → AudioRecorder (background thread, if --record)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The waveform colour shifts from **blue → red** as your volume increases.
|
|
152
|
+
The dB meter at the bottom turns green → yellow → red as level rises.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Requirements
|
|
157
|
+
|
|
158
|
+
| Package | Purpose |
|
|
159
|
+
|---|---|
|
|
160
|
+
| `pyaudio` | Live microphone capture |
|
|
161
|
+
| `numpy` | PCM byte → number conversion |
|
|
162
|
+
| `matplotlib` | Animated waveform / spectrum plot |
|
|
163
|
+
| `SpeechRecognition` | Voice "stop" command detection |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Contributing
|
|
168
|
+
|
|
169
|
+
1. Fork → `git checkout -b feature/my-feature`
|
|
170
|
+
2. Make changes, add tests in `tests/`
|
|
171
|
+
3. `pytest tests/ -v` — all tests must pass
|
|
172
|
+
4. Pull request → [github.com/bappy-3/sound-graph](https://github.com/bappy-3/sound-graph)
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
MIT © [Al Mustafiz Bappy](https://github.com/bappy-3)
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# SoundGraph
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/SoundGraph/)
|
|
4
|
+
[](https://pypi.org/project/SoundGraph/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
**SoundGraph** is a Python package that visualizes your microphone audio as a **live waveform** in real-time.
|
|
8
|
+
|
|
9
|
+
Make noise → see the wave. Say **"stop"** (or close the window) → exits cleanly.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install SoundGraph
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
> **macOS** — install PortAudio first: `brew install portaudio`
|
|
20
|
+
> **Linux** — `sudo apt-get install portaudio19-dev python3-pyaudio`
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
import soundgraph
|
|
28
|
+
|
|
29
|
+
soundgraph.start()
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
That's it.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
| Feature | Description |
|
|
39
|
+
|---|---|
|
|
40
|
+
| **Visualization modes** | Waveform, frequency spectrum, or both side-by-side |
|
|
41
|
+
| **Color themes** | `dark`, `light`, `neon` |
|
|
42
|
+
| **Live dB meter** | Real-time decibel level bar at the bottom |
|
|
43
|
+
| **Record to WAV** | Save your session to a file while visualizing |
|
|
44
|
+
| **Device selection** | Pick any connected microphone by index |
|
|
45
|
+
| **Voice stop** | Say "stop" to exit hands-free |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
### Python API
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
import soundgraph
|
|
55
|
+
|
|
56
|
+
# Waveform + spectrum side-by-side, neon theme
|
|
57
|
+
soundgraph.start(mode='both', theme='neon')
|
|
58
|
+
|
|
59
|
+
# Record while visualizing
|
|
60
|
+
soundgraph.start(record=True, output='session.wav')
|
|
61
|
+
|
|
62
|
+
# List available input devices, then use one
|
|
63
|
+
soundgraph.list_devices()
|
|
64
|
+
soundgraph.start(device=2)
|
|
65
|
+
|
|
66
|
+
# All options
|
|
67
|
+
soundgraph.start(
|
|
68
|
+
mode='both', # 'waveform' | 'spectrum' | 'both'
|
|
69
|
+
theme='dark', # 'dark' | 'light' | 'neon'
|
|
70
|
+
record=True, # save to WAV
|
|
71
|
+
output='out.wav', # custom output path
|
|
72
|
+
device=0, # input device index
|
|
73
|
+
sample_rate=44100, # Hz
|
|
74
|
+
chunk=2048, # frames per update
|
|
75
|
+
phrase_seconds=1.5, # seconds per recognition attempt
|
|
76
|
+
)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Command Line
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
soundgraph # default waveform, dark theme
|
|
83
|
+
soundgraph --mode both --theme neon # spectrum + waveform, neon
|
|
84
|
+
soundgraph --record --output out.wav # record while visualizing
|
|
85
|
+
soundgraph --list-devices # print available mics
|
|
86
|
+
soundgraph --device 2 # use mic at index 2
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
All flags:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
--mode, -m waveform | spectrum | both (default: waveform)
|
|
93
|
+
--theme, -t dark | light | neon (default: dark)
|
|
94
|
+
--record, -r Record session to WAV
|
|
95
|
+
--output, -o Output WAV path (default: auto-named)
|
|
96
|
+
--device, -d Input device index
|
|
97
|
+
--list-devices List available input devices and exit
|
|
98
|
+
--rate Sample rate in Hz (default: 44100)
|
|
99
|
+
--chunk Frames per update (default: 2048)
|
|
100
|
+
--phrase-seconds Seconds per recognition (default: 1.5)
|
|
101
|
+
--verbose, -v Debug logging
|
|
102
|
+
--version Show version
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## How It Works
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
Microphone
|
|
111
|
+
│
|
|
112
|
+
▼
|
|
113
|
+
PyAudio stream (single handle)
|
|
114
|
+
│
|
|
115
|
+
├──► viz_queue → Matplotlib animation (main thread)
|
|
116
|
+
├──► speech_queue → VoiceCommandListener (background thread)
|
|
117
|
+
└──► record_queue → AudioRecorder (background thread, if --record)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The waveform colour shifts from **blue → red** as your volume increases.
|
|
121
|
+
The dB meter at the bottom turns green → yellow → red as level rises.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Requirements
|
|
126
|
+
|
|
127
|
+
| Package | Purpose |
|
|
128
|
+
|---|---|
|
|
129
|
+
| `pyaudio` | Live microphone capture |
|
|
130
|
+
| `numpy` | PCM byte → number conversion |
|
|
131
|
+
| `matplotlib` | Animated waveform / spectrum plot |
|
|
132
|
+
| `SpeechRecognition` | Voice "stop" command detection |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Contributing
|
|
137
|
+
|
|
138
|
+
1. Fork → `git checkout -b feature/my-feature`
|
|
139
|
+
2. Make changes, add tests in `tests/`
|
|
140
|
+
3. `pytest tests/ -v` — all tests must pass
|
|
141
|
+
4. Pull request → [github.com/bappy-3/sound-graph](https://github.com/bappy-3/sound-graph)
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT © [Al Mustafiz Bappy](https://github.com/bappy-3)
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: SoundGraph
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Real-time audio waveform visualizer with voice-command stop
|
|
5
|
+
Home-page: https://github.com/bappy-3/sound-graph
|
|
6
|
+
Author: Al Mustafiz Bappy
|
|
7
|
+
Author-email: almustafizbappy@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: audio,visualization,waveform,speech-recognition,microphone,real-time
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: numpy>=1.21
|
|
28
|
+
Requires-Dist: matplotlib>=3.4
|
|
29
|
+
Requires-Dist: SpeechRecognition>=3.8
|
|
30
|
+
Requires-Dist: pyaudio>=0.2.11
|
|
31
|
+
|
|
32
|
+
# SoundGraph
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/SoundGraph/)
|
|
35
|
+
[](https://pypi.org/project/SoundGraph/)
|
|
36
|
+
[](LICENSE)
|
|
37
|
+
|
|
38
|
+
**SoundGraph** is a Python package that visualizes your microphone audio as a **live waveform** in real-time.
|
|
39
|
+
|
|
40
|
+
Make noise → see the wave. Say **"stop"** (or close the window) → exits cleanly.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install SoundGraph
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> **macOS** — install PortAudio first: `brew install portaudio`
|
|
51
|
+
> **Linux** — `sudo apt-get install portaudio19-dev python3-pyaudio`
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
import soundgraph
|
|
59
|
+
|
|
60
|
+
soundgraph.start()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
That's it.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Features
|
|
68
|
+
|
|
69
|
+
| Feature | Description |
|
|
70
|
+
|---|---|
|
|
71
|
+
| **Visualization modes** | Waveform, frequency spectrum, or both side-by-side |
|
|
72
|
+
| **Color themes** | `dark`, `light`, `neon` |
|
|
73
|
+
| **Live dB meter** | Real-time decibel level bar at the bottom |
|
|
74
|
+
| **Record to WAV** | Save your session to a file while visualizing |
|
|
75
|
+
| **Device selection** | Pick any connected microphone by index |
|
|
76
|
+
| **Voice stop** | Say "stop" to exit hands-free |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Usage
|
|
81
|
+
|
|
82
|
+
### Python API
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import soundgraph
|
|
86
|
+
|
|
87
|
+
# Waveform + spectrum side-by-side, neon theme
|
|
88
|
+
soundgraph.start(mode='both', theme='neon')
|
|
89
|
+
|
|
90
|
+
# Record while visualizing
|
|
91
|
+
soundgraph.start(record=True, output='session.wav')
|
|
92
|
+
|
|
93
|
+
# List available input devices, then use one
|
|
94
|
+
soundgraph.list_devices()
|
|
95
|
+
soundgraph.start(device=2)
|
|
96
|
+
|
|
97
|
+
# All options
|
|
98
|
+
soundgraph.start(
|
|
99
|
+
mode='both', # 'waveform' | 'spectrum' | 'both'
|
|
100
|
+
theme='dark', # 'dark' | 'light' | 'neon'
|
|
101
|
+
record=True, # save to WAV
|
|
102
|
+
output='out.wav', # custom output path
|
|
103
|
+
device=0, # input device index
|
|
104
|
+
sample_rate=44100, # Hz
|
|
105
|
+
chunk=2048, # frames per update
|
|
106
|
+
phrase_seconds=1.5, # seconds per recognition attempt
|
|
107
|
+
)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Command Line
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
soundgraph # default waveform, dark theme
|
|
114
|
+
soundgraph --mode both --theme neon # spectrum + waveform, neon
|
|
115
|
+
soundgraph --record --output out.wav # record while visualizing
|
|
116
|
+
soundgraph --list-devices # print available mics
|
|
117
|
+
soundgraph --device 2 # use mic at index 2
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
All flags:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
--mode, -m waveform | spectrum | both (default: waveform)
|
|
124
|
+
--theme, -t dark | light | neon (default: dark)
|
|
125
|
+
--record, -r Record session to WAV
|
|
126
|
+
--output, -o Output WAV path (default: auto-named)
|
|
127
|
+
--device, -d Input device index
|
|
128
|
+
--list-devices List available input devices and exit
|
|
129
|
+
--rate Sample rate in Hz (default: 44100)
|
|
130
|
+
--chunk Frames per update (default: 2048)
|
|
131
|
+
--phrase-seconds Seconds per recognition (default: 1.5)
|
|
132
|
+
--verbose, -v Debug logging
|
|
133
|
+
--version Show version
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## How It Works
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
Microphone
|
|
142
|
+
│
|
|
143
|
+
▼
|
|
144
|
+
PyAudio stream (single handle)
|
|
145
|
+
│
|
|
146
|
+
├──► viz_queue → Matplotlib animation (main thread)
|
|
147
|
+
├──► speech_queue → VoiceCommandListener (background thread)
|
|
148
|
+
└──► record_queue → AudioRecorder (background thread, if --record)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The waveform colour shifts from **blue → red** as your volume increases.
|
|
152
|
+
The dB meter at the bottom turns green → yellow → red as level rises.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Requirements
|
|
157
|
+
|
|
158
|
+
| Package | Purpose |
|
|
159
|
+
|---|---|
|
|
160
|
+
| `pyaudio` | Live microphone capture |
|
|
161
|
+
| `numpy` | PCM byte → number conversion |
|
|
162
|
+
| `matplotlib` | Animated waveform / spectrum plot |
|
|
163
|
+
| `SpeechRecognition` | Voice "stop" command detection |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Contributing
|
|
168
|
+
|
|
169
|
+
1. Fork → `git checkout -b feature/my-feature`
|
|
170
|
+
2. Make changes, add tests in `tests/`
|
|
171
|
+
3. `pytest tests/ -v` — all tests must pass
|
|
172
|
+
4. Pull request → [github.com/bappy-3/sound-graph](https://github.com/bappy-3/sound-graph)
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
MIT © [Al Mustafiz Bappy](https://github.com/bappy-3)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
CHANGELOG.md
|
|
2
|
+
LICENSE
|
|
3
|
+
MANIFEST.in
|
|
4
|
+
README.md
|
|
5
|
+
pyproject.toml
|
|
6
|
+
requirements.txt
|
|
7
|
+
setup.cfg
|
|
8
|
+
setup.py
|
|
9
|
+
SoundGraph.egg-info/PKG-INFO
|
|
10
|
+
SoundGraph.egg-info/SOURCES.txt
|
|
11
|
+
SoundGraph.egg-info/dependency_links.txt
|
|
12
|
+
SoundGraph.egg-info/entry_points.txt
|
|
13
|
+
SoundGraph.egg-info/requires.txt
|
|
14
|
+
SoundGraph.egg-info/top_level.txt
|
|
15
|
+
soundgraph/__init__.py
|
|
16
|
+
soundgraph/__main__.py
|
|
17
|
+
soundgraph/py.typed
|
|
18
|
+
soundgraph/recognizer.py
|
|
19
|
+
soundgraph/recorder.py
|
|
20
|
+
soundgraph/spectrum.py
|
|
21
|
+
soundgraph/themes.py
|
|
22
|
+
soundgraph/visualizer.py
|
|
23
|
+
tests/test_soundgraph.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
soundgraph
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
name = SoundGraph
|
|
3
|
+
version = 0.3.0
|
|
4
|
+
author = Al Mustafiz Bappy
|
|
5
|
+
author_email = almustafizbappy@gmail.com
|
|
6
|
+
description = Real-time audio waveform visualizer with voice-command stop
|
|
7
|
+
long_description = file: README.md
|
|
8
|
+
long_description_content_type = text/markdown
|
|
9
|
+
url = https://github.com/bappy-3/sound-graph
|
|
10
|
+
license = MIT
|
|
11
|
+
keywords = audio, visualization, waveform, speech-recognition, microphone, real-time
|
|
12
|
+
classifiers =
|
|
13
|
+
Development Status :: 4 - Beta
|
|
14
|
+
Environment :: Console
|
|
15
|
+
Intended Audience :: Developers
|
|
16
|
+
Intended Audience :: Science/Research
|
|
17
|
+
License :: OSI Approved :: MIT License
|
|
18
|
+
Operating System :: OS Independent
|
|
19
|
+
Programming Language :: Python :: 3
|
|
20
|
+
Programming Language :: Python :: 3.8
|
|
21
|
+
Programming Language :: Python :: 3.9
|
|
22
|
+
Programming Language :: Python :: 3.10
|
|
23
|
+
Programming Language :: Python :: 3.11
|
|
24
|
+
Programming Language :: Python :: 3.12
|
|
25
|
+
Topic :: Multimedia :: Sound/Audio :: Analysis
|
|
26
|
+
Topic :: Scientific/Engineering :: Visualization
|
|
27
|
+
|
|
28
|
+
[options]
|
|
29
|
+
packages = soundgraph
|
|
30
|
+
python_requires = >=3.8
|
|
31
|
+
install_requires =
|
|
32
|
+
numpy>=1.21
|
|
33
|
+
matplotlib>=3.4
|
|
34
|
+
SpeechRecognition>=3.8
|
|
35
|
+
pyaudio>=0.2.11
|
|
36
|
+
|
|
37
|
+
[options.entry_points]
|
|
38
|
+
console_scripts =
|
|
39
|
+
soundgraph = soundgraph.__main__:main
|
|
40
|
+
|
|
41
|
+
[options.package_data]
|
|
42
|
+
soundgraph = py.typed
|
|
43
|
+
|
|
44
|
+
[egg_info]
|
|
45
|
+
tag_build =
|
|
46
|
+
tag_date = 0
|
|
47
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SoundGraph
|
|
3
|
+
==========
|
|
4
|
+
Real-time audio waveform visualizer with voice-command stop.
|
|
5
|
+
|
|
6
|
+
Quick start::
|
|
7
|
+
|
|
8
|
+
import soundgraph
|
|
9
|
+
soundgraph.start()
|
|
10
|
+
|
|
11
|
+
Full options::
|
|
12
|
+
|
|
13
|
+
soundgraph.start(
|
|
14
|
+
mode='both', # 'waveform' | 'spectrum' | 'both'
|
|
15
|
+
theme='neon', # 'dark' | 'light' | 'neon'
|
|
16
|
+
record=True, # save session to WAV
|
|
17
|
+
output='out.wav', # custom WAV path
|
|
18
|
+
device=2, # input device index
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
soundgraph.list_devices() # print available mic/input devices
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from soundgraph.visualizer import start_visualization, list_devices
|
|
25
|
+
|
|
26
|
+
# Short-form alias — the recommended way to use SoundGraph
|
|
27
|
+
start = start_visualization
|
|
28
|
+
|
|
29
|
+
__version__ = "0.3.0"
|
|
30
|
+
__author__ = "Al Mustafiz Bappy"
|
|
31
|
+
__email__ = "almustafizbappy@gmail.com"
|
|
32
|
+
__license__ = "MIT"
|
|
33
|
+
__url__ = "https://github.com/bappy-3/sound-graph"
|
|
34
|
+
|
|
35
|
+
__all__ = ["start", "start_visualization", "list_devices", "__version__"]
|