cysox 0.1.3__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.
Files changed (57) hide show
  1. cysox-0.1.3/LICENSE +21 -0
  2. cysox-0.1.3/MANIFEST.in +4 -0
  3. cysox-0.1.3/PKG-INFO +319 -0
  4. cysox-0.1.3/README.md +282 -0
  5. cysox-0.1.3/include/sox.h +2628 -0
  6. cysox-0.1.3/pyproject.toml +110 -0
  7. cysox-0.1.3/setup.cfg +4 -0
  8. cysox-0.1.3/setup.py +183 -0
  9. cysox-0.1.3/src/cysox/__init__.py +61 -0
  10. cysox-0.1.3/src/cysox/__init__.pyi +223 -0
  11. cysox-0.1.3/src/cysox/audio.py +528 -0
  12. cysox-0.1.3/src/cysox/fx/__init__.py +113 -0
  13. cysox-0.1.3/src/cysox/fx/base.py +168 -0
  14. cysox-0.1.3/src/cysox/fx/convert.py +128 -0
  15. cysox-0.1.3/src/cysox/fx/eq.py +94 -0
  16. cysox-0.1.3/src/cysox/fx/filter.py +131 -0
  17. cysox-0.1.3/src/cysox/fx/reverb.py +215 -0
  18. cysox-0.1.3/src/cysox/fx/time.py +248 -0
  19. cysox-0.1.3/src/cysox/fx/volume.py +98 -0
  20. cysox-0.1.3/src/cysox/sox.c +56101 -0
  21. cysox-0.1.3/src/cysox/sox.pxd +851 -0
  22. cysox-0.1.3/src/cysox/sox.pyx +2341 -0
  23. cysox-0.1.3/src/cysox/utils.py +47 -0
  24. cysox-0.1.3/src/cysox/utils.pyi +21 -0
  25. cysox-0.1.3/src/cysox.egg-info/PKG-INFO +319 -0
  26. cysox-0.1.3/src/cysox.egg-info/SOURCES.txt +55 -0
  27. cysox-0.1.3/src/cysox.egg-info/dependency_links.txt +1 -0
  28. cysox-0.1.3/src/cysox.egg-info/entry_points.txt +2 -0
  29. cysox-0.1.3/src/cysox.egg-info/top_level.txt +1 -0
  30. cysox-0.1.3/tests/test_benchmarks.py +512 -0
  31. cysox-0.1.3/tests/test_buffer_protocol.py +96 -0
  32. cysox-0.1.3/tests/test_callback.py +236 -0
  33. cysox-0.1.3/tests/test_edge_cases.py +381 -0
  34. cysox-0.1.3/tests/test_error_handling.py +216 -0
  35. cysox-0.1.3/tests/test_example0.py +84 -0
  36. cysox-0.1.3/tests/test_example1.py +83 -0
  37. cysox-0.1.3/tests/test_example2.py +115 -0
  38. cysox-0.1.3/tests/test_example3.py +155 -0
  39. cysox-0.1.3/tests/test_example4.py +173 -0
  40. cysox-0.1.3/tests/test_example5.py +148 -0
  41. cysox-0.1.3/tests/test_example6.py +180 -0
  42. cysox-0.1.3/tests/test_fx_outputs.py +434 -0
  43. cysox-0.1.3/tests/test_high_level_api.py +347 -0
  44. cysox-0.1.3/tests/test_sox_constants.py +52 -0
  45. cysox-0.1.3/tests/test_sox_effects.py +92 -0
  46. cysox-0.1.3/tests/test_sox_encoding.py +133 -0
  47. cysox-0.1.3/tests/test_sox_file.py +63 -0
  48. cysox-0.1.3/tests/test_sox_format.py +210 -0
  49. cysox-0.1.3/tests/test_sox_functions.py +81 -0
  50. cysox-0.1.3/tests/test_sox_globals.py +13 -0
  51. cysox-0.1.3/tests/test_sox_instr.py +67 -0
  52. cysox-0.1.3/tests/test_sox_lifecycle.py +30 -0
  53. cysox-0.1.3/tests/test_sox_loop.py +61 -0
  54. cysox-0.1.3/tests/test_sox_oob.py +70 -0
  55. cysox-0.1.3/tests/test_sox_signal.py +98 -0
  56. cysox-0.1.3/tests/test_sox_utils.py +21 -0
  57. cysox-0.1.3/tests/test_thread_safety.py +401 -0
cysox-0.1.3/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Shakeeb Alireza
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include src/cysox/*.pxd
2
+ include src/cysox/*.pyx
3
+ include src/cysox/*.c
4
+ include include/*.h
cysox-0.1.3/PKG-INFO ADDED
@@ -0,0 +1,319 @@
1
+ Metadata-Version: 2.4
2
+ Name: cysox
3
+ Version: 0.1.3
4
+ Summary: A Pythonic audio processing library wrapping libsox
5
+ Author-email: Shakeeb Alireza <me@example.com>
6
+ Maintainer-email: Shakeeb Alireza <me@example.com>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/shakfu/cysox
9
+ Project-URL: Repository, https://github.com/shakfu/cysox
10
+ Project-URL: Documentation, https://github.com/shakfu/cysox#readme
11
+ Project-URL: Issues, https://github.com/shakfu/cysox/issues
12
+ Project-URL: Changelog, https://github.com/shakfu/cysox/releases
13
+ Keywords: audio,sound,sox,libsox,audio-processing,effects,cython,dsp
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Cython
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
+ Classifier: Programming Language :: Python :: 3.14
27
+ Classifier: Topic :: Multimedia :: Sound/Audio
28
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
29
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Conversion
30
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Editors
31
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Sound Synthesis
32
+ Classifier: Typing :: Typed
33
+ Requires-Python: >=3.9
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE
36
+ Dynamic: license-file
37
+
38
+ # cysox
39
+
40
+ [![PyPI](https://img.shields.io/pypi/v/cysox)](https://pypi.org/project/cysox/)
41
+ [![Python](https://img.shields.io/pypi/pyversions/cysox)](https://pypi.org/project/cysox/)
42
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
43
+
44
+ A Pythonic audio processing library which uses cython to wrap [libsox](https://github.com/chirlu/sox).
45
+
46
+ ## Features
47
+
48
+ - **Simple API**: Convert, analyze, and play audio with one-liners
49
+ - **Typed Effects**: 28 effect classes with IDE autocomplete and validation
50
+ - **High Performance**: Direct C bindings through Cython
51
+ - **Zero Configuration**: Auto-initialization, no manual setup required
52
+ - **Cross-Platform**: macOS, Linux (Windows placeholder)
53
+
54
+ ## Installation
55
+
56
+ Note that cysox only works on macOS and Linux.
57
+
58
+ ```sh
59
+ pip install cysox
60
+ ```
61
+
62
+ ## Quick Start
63
+
64
+ ```python
65
+ import cysox
66
+ from cysox import fx
67
+
68
+ # Get audio file info
69
+ info = cysox.info('audio.wav')
70
+ print(f"Duration: {info['duration']:.2f}s, Sample rate: {info['sample_rate']} Hz")
71
+
72
+ # Convert with effects
73
+ cysox.convert('input.wav', 'output.mp3', effects=[
74
+ fx.Normalize(),
75
+ fx.Reverb(reverberance=60),
76
+ fx.Fade(fade_in=0.5, fade_out=1.0),
77
+ ])
78
+
79
+ # Play audio (macOS/Linux)
80
+ cysox.play('audio.wav')
81
+
82
+ # Play with effects
83
+ cysox.play('audio.wav', effects=[fx.Volume(db=-6)])
84
+ ```
85
+
86
+ ## Core Functions
87
+
88
+ ### `cysox.info(path) -> dict`
89
+
90
+ Get audio file metadata:
91
+
92
+ ```python
93
+ info = cysox.info('audio.wav')
94
+ # Returns: {
95
+ # 'path': 'audio.wav',
96
+ # 'format': 'wav',
97
+ # 'duration': 11.5,
98
+ # 'sample_rate': 44100,
99
+ # 'channels': 2,
100
+ # 'bits_per_sample': 16,
101
+ # 'samples': 507150,
102
+ # 'encoding': 'signed-integer',
103
+ # }
104
+ ```
105
+
106
+ ### `cysox.convert(input, output, effects=[], **options)`
107
+
108
+ Convert audio files with optional effects and format options:
109
+
110
+ ```python
111
+ # Simple format conversion
112
+ cysox.convert('input.wav', 'output.mp3')
113
+
114
+ # With effects
115
+ cysox.convert('input.wav', 'output.wav', effects=[
116
+ fx.Volume(db=3),
117
+ fx.Bass(gain=5),
118
+ fx.Reverb(),
119
+ ])
120
+
121
+ # With format options
122
+ cysox.convert('input.wav', 'output.wav',
123
+ sample_rate=48000,
124
+ channels=1,
125
+ bits=24,
126
+ )
127
+ ```
128
+
129
+ ### `cysox.stream(path, chunk_size=8192) -> Iterator[memoryview]`
130
+
131
+ Stream audio samples for processing:
132
+
133
+ ```python
134
+ import numpy as np
135
+
136
+ for chunk in cysox.stream('large.wav', chunk_size=8192):
137
+ arr = np.frombuffer(chunk, dtype=np.int32)
138
+ process(arr)
139
+ ```
140
+
141
+ ### `cysox.play(path, effects=[])`
142
+
143
+ Play audio to the default audio device:
144
+
145
+ ```python
146
+ cysox.play('audio.wav')
147
+ cysox.play('audio.wav', effects=[fx.Volume(db=-6), fx.Reverb()])
148
+ ```
149
+
150
+ ### `cysox.concat(inputs, output)`
151
+
152
+ Concatenate multiple audio files:
153
+
154
+ ```python
155
+ cysox.concat(['intro.wav', 'main.wav', 'outro.wav'], 'full.wav')
156
+ ```
157
+
158
+ All input files must have the same sample rate and channel count.
159
+
160
+ ## Effects Module
161
+
162
+ The `cysox.fx` module provides 28 typed effect classes:
163
+
164
+ ### Volume & Dynamics
165
+ ```python
166
+ fx.Volume(db=3) # Adjust volume in dB
167
+ fx.Gain(db=6) # Apply gain
168
+ fx.Normalize(level=-3) # Normalize to target level
169
+ ```
170
+
171
+ ### Equalization
172
+ ```python
173
+ fx.Bass(gain=5, frequency=100) # Boost/cut bass
174
+ fx.Treble(gain=-2, frequency=3000) # Boost/cut treble
175
+ fx.Equalizer(frequency=1000, width=1.0, gain=3)
176
+ ```
177
+
178
+ ### Filters
179
+ ```python
180
+ fx.HighPass(frequency=200) # Remove low frequencies
181
+ fx.LowPass(frequency=8000) # Remove high frequencies
182
+ fx.BandPass(frequency=1000, width=100)
183
+ fx.BandReject(frequency=60, width=10) # Notch filter
184
+ ```
185
+
186
+ ### Spatial & Reverb
187
+ ```python
188
+ fx.Reverb(reverberance=50, room_scale=100)
189
+ fx.Echo(gain_in=0.8, gain_out=0.9, delays=[100], decays=[0.5])
190
+ fx.Chorus()
191
+ fx.Flanger()
192
+ ```
193
+
194
+ ### Time-Based
195
+ ```python
196
+ fx.Trim(start=1.0, end=5.0) # Extract portion
197
+ fx.Pad(before=0.5, after=1.0) # Add silence
198
+ fx.Speed(factor=1.5) # Change speed (affects pitch)
199
+ fx.Tempo(factor=1.5) # Change tempo (preserves pitch)
200
+ fx.Pitch(cents=100) # Shift pitch (preserves tempo)
201
+ fx.Reverse() # Reverse audio
202
+ fx.Fade(fade_in=0.5, fade_out=1.0) # Fade in/out
203
+ fx.Repeat(count=3) # Repeat audio
204
+ ```
205
+
206
+ ### Conversion
207
+ ```python
208
+ fx.Rate(sample_rate=48000) # Resample
209
+ fx.Channels(channels=1) # Change channel count
210
+ fx.Remix(out_spec=[[1, 2]]) # Custom channel mixing
211
+ fx.Dither() # Add dither
212
+ ```
213
+
214
+ ### Composite Effects
215
+
216
+ Create reusable effect combinations:
217
+
218
+ ```python
219
+ from cysox.fx import CompositeEffect, HighPass, LowPass, Reverb, Volume
220
+
221
+ class TelephoneEffect(CompositeEffect):
222
+ """Simulate telephone audio quality."""
223
+
224
+ @property
225
+ def effects(self):
226
+ return [
227
+ HighPass(frequency=300),
228
+ LowPass(frequency=3400),
229
+ Volume(db=-3),
230
+ ]
231
+
232
+ # Use like any other effect
233
+ cysox.convert('input.wav', 'output.wav', effects=[TelephoneEffect()])
234
+ ```
235
+
236
+ ## Low-Level API
237
+
238
+ For advanced use cases, access the full libsox bindings:
239
+
240
+ ```python
241
+ from cysox import sox
242
+
243
+ # Manual initialization (high-level API handles this automatically)
244
+ sox.init()
245
+
246
+ # Open files
247
+ input_fmt = sox.Format('input.wav')
248
+ output_fmt = sox.Format('output.wav', signal=input_fmt.signal, mode='w')
249
+
250
+ # Build effects chain
251
+ chain = sox.EffectsChain(input_fmt.encoding, output_fmt.encoding)
252
+
253
+ e = sox.Effect(sox.find_effect("input"))
254
+ e.set_options([input_fmt])
255
+ chain.add_effect(e, input_fmt.signal, input_fmt.signal)
256
+
257
+ e = sox.Effect(sox.find_effect("vol"))
258
+ e.set_options(["3dB"])
259
+ chain.add_effect(e, input_fmt.signal, input_fmt.signal)
260
+
261
+ e = sox.Effect(sox.find_effect("output"))
262
+ e.set_options([output_fmt])
263
+ chain.add_effect(e, input_fmt.signal, input_fmt.signal)
264
+
265
+ # Process
266
+ chain.flow_effects()
267
+
268
+ # Cleanup
269
+ input_fmt.close()
270
+ output_fmt.close()
271
+ sox.quit()
272
+ ```
273
+
274
+ ## Building from Source
275
+
276
+ ### macOS
277
+
278
+ ```sh
279
+ brew install sox libsndfile mad libpng flac lame mpg123 libogg opus opusfile libvorbis
280
+ make
281
+ make test
282
+ ```
283
+
284
+ ### Linux
285
+
286
+ ```sh
287
+ apt-get install libsox-dev libsndfile1-dev
288
+ make
289
+ make test
290
+ ```
291
+
292
+ ## Status
293
+
294
+ Comprehensive test suite covering all functionality. All libsox C examples ported to Python (effects chains, waveform analysis, trim, concatenation, format conversion).
295
+
296
+ ## Known Issues
297
+
298
+ - **Memory I/O**: libsox memory I/O functions have platform issues (tests skipped)
299
+ - **Init/Quit Cycles**: Use high-level API to avoid init/quit issues (handled automatically)
300
+
301
+ See [KNOWN_LIMITATIONS.md](https://github.com/shakfu/cysox/blob/main/KNOWN_LIMITATIONS.md) for details.
302
+
303
+ ## Platform Support
304
+
305
+ - **macOS**: Full support
306
+ - **Linux**: Full support
307
+ - **Windows**: Placeholder (contributions welcome)
308
+
309
+ ## Building Documentation
310
+
311
+ ```sh
312
+ pip install sphinx furo myst-parser
313
+ make docs
314
+ make docs-serve # http://localhost:8000
315
+ ```
316
+
317
+ ## License
318
+
319
+ MIT
cysox-0.1.3/README.md ADDED
@@ -0,0 +1,282 @@
1
+ # cysox
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/cysox)](https://pypi.org/project/cysox/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/cysox)](https://pypi.org/project/cysox/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+
7
+ A Pythonic audio processing library which uses cython to wrap [libsox](https://github.com/chirlu/sox).
8
+
9
+ ## Features
10
+
11
+ - **Simple API**: Convert, analyze, and play audio with one-liners
12
+ - **Typed Effects**: 28 effect classes with IDE autocomplete and validation
13
+ - **High Performance**: Direct C bindings through Cython
14
+ - **Zero Configuration**: Auto-initialization, no manual setup required
15
+ - **Cross-Platform**: macOS, Linux (Windows placeholder)
16
+
17
+ ## Installation
18
+
19
+ Note that cysox only works on macOS and Linux.
20
+
21
+ ```sh
22
+ pip install cysox
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ```python
28
+ import cysox
29
+ from cysox import fx
30
+
31
+ # Get audio file info
32
+ info = cysox.info('audio.wav')
33
+ print(f"Duration: {info['duration']:.2f}s, Sample rate: {info['sample_rate']} Hz")
34
+
35
+ # Convert with effects
36
+ cysox.convert('input.wav', 'output.mp3', effects=[
37
+ fx.Normalize(),
38
+ fx.Reverb(reverberance=60),
39
+ fx.Fade(fade_in=0.5, fade_out=1.0),
40
+ ])
41
+
42
+ # Play audio (macOS/Linux)
43
+ cysox.play('audio.wav')
44
+
45
+ # Play with effects
46
+ cysox.play('audio.wav', effects=[fx.Volume(db=-6)])
47
+ ```
48
+
49
+ ## Core Functions
50
+
51
+ ### `cysox.info(path) -> dict`
52
+
53
+ Get audio file metadata:
54
+
55
+ ```python
56
+ info = cysox.info('audio.wav')
57
+ # Returns: {
58
+ # 'path': 'audio.wav',
59
+ # 'format': 'wav',
60
+ # 'duration': 11.5,
61
+ # 'sample_rate': 44100,
62
+ # 'channels': 2,
63
+ # 'bits_per_sample': 16,
64
+ # 'samples': 507150,
65
+ # 'encoding': 'signed-integer',
66
+ # }
67
+ ```
68
+
69
+ ### `cysox.convert(input, output, effects=[], **options)`
70
+
71
+ Convert audio files with optional effects and format options:
72
+
73
+ ```python
74
+ # Simple format conversion
75
+ cysox.convert('input.wav', 'output.mp3')
76
+
77
+ # With effects
78
+ cysox.convert('input.wav', 'output.wav', effects=[
79
+ fx.Volume(db=3),
80
+ fx.Bass(gain=5),
81
+ fx.Reverb(),
82
+ ])
83
+
84
+ # With format options
85
+ cysox.convert('input.wav', 'output.wav',
86
+ sample_rate=48000,
87
+ channels=1,
88
+ bits=24,
89
+ )
90
+ ```
91
+
92
+ ### `cysox.stream(path, chunk_size=8192) -> Iterator[memoryview]`
93
+
94
+ Stream audio samples for processing:
95
+
96
+ ```python
97
+ import numpy as np
98
+
99
+ for chunk in cysox.stream('large.wav', chunk_size=8192):
100
+ arr = np.frombuffer(chunk, dtype=np.int32)
101
+ process(arr)
102
+ ```
103
+
104
+ ### `cysox.play(path, effects=[])`
105
+
106
+ Play audio to the default audio device:
107
+
108
+ ```python
109
+ cysox.play('audio.wav')
110
+ cysox.play('audio.wav', effects=[fx.Volume(db=-6), fx.Reverb()])
111
+ ```
112
+
113
+ ### `cysox.concat(inputs, output)`
114
+
115
+ Concatenate multiple audio files:
116
+
117
+ ```python
118
+ cysox.concat(['intro.wav', 'main.wav', 'outro.wav'], 'full.wav')
119
+ ```
120
+
121
+ All input files must have the same sample rate and channel count.
122
+
123
+ ## Effects Module
124
+
125
+ The `cysox.fx` module provides 28 typed effect classes:
126
+
127
+ ### Volume & Dynamics
128
+ ```python
129
+ fx.Volume(db=3) # Adjust volume in dB
130
+ fx.Gain(db=6) # Apply gain
131
+ fx.Normalize(level=-3) # Normalize to target level
132
+ ```
133
+
134
+ ### Equalization
135
+ ```python
136
+ fx.Bass(gain=5, frequency=100) # Boost/cut bass
137
+ fx.Treble(gain=-2, frequency=3000) # Boost/cut treble
138
+ fx.Equalizer(frequency=1000, width=1.0, gain=3)
139
+ ```
140
+
141
+ ### Filters
142
+ ```python
143
+ fx.HighPass(frequency=200) # Remove low frequencies
144
+ fx.LowPass(frequency=8000) # Remove high frequencies
145
+ fx.BandPass(frequency=1000, width=100)
146
+ fx.BandReject(frequency=60, width=10) # Notch filter
147
+ ```
148
+
149
+ ### Spatial & Reverb
150
+ ```python
151
+ fx.Reverb(reverberance=50, room_scale=100)
152
+ fx.Echo(gain_in=0.8, gain_out=0.9, delays=[100], decays=[0.5])
153
+ fx.Chorus()
154
+ fx.Flanger()
155
+ ```
156
+
157
+ ### Time-Based
158
+ ```python
159
+ fx.Trim(start=1.0, end=5.0) # Extract portion
160
+ fx.Pad(before=0.5, after=1.0) # Add silence
161
+ fx.Speed(factor=1.5) # Change speed (affects pitch)
162
+ fx.Tempo(factor=1.5) # Change tempo (preserves pitch)
163
+ fx.Pitch(cents=100) # Shift pitch (preserves tempo)
164
+ fx.Reverse() # Reverse audio
165
+ fx.Fade(fade_in=0.5, fade_out=1.0) # Fade in/out
166
+ fx.Repeat(count=3) # Repeat audio
167
+ ```
168
+
169
+ ### Conversion
170
+ ```python
171
+ fx.Rate(sample_rate=48000) # Resample
172
+ fx.Channels(channels=1) # Change channel count
173
+ fx.Remix(out_spec=[[1, 2]]) # Custom channel mixing
174
+ fx.Dither() # Add dither
175
+ ```
176
+
177
+ ### Composite Effects
178
+
179
+ Create reusable effect combinations:
180
+
181
+ ```python
182
+ from cysox.fx import CompositeEffect, HighPass, LowPass, Reverb, Volume
183
+
184
+ class TelephoneEffect(CompositeEffect):
185
+ """Simulate telephone audio quality."""
186
+
187
+ @property
188
+ def effects(self):
189
+ return [
190
+ HighPass(frequency=300),
191
+ LowPass(frequency=3400),
192
+ Volume(db=-3),
193
+ ]
194
+
195
+ # Use like any other effect
196
+ cysox.convert('input.wav', 'output.wav', effects=[TelephoneEffect()])
197
+ ```
198
+
199
+ ## Low-Level API
200
+
201
+ For advanced use cases, access the full libsox bindings:
202
+
203
+ ```python
204
+ from cysox import sox
205
+
206
+ # Manual initialization (high-level API handles this automatically)
207
+ sox.init()
208
+
209
+ # Open files
210
+ input_fmt = sox.Format('input.wav')
211
+ output_fmt = sox.Format('output.wav', signal=input_fmt.signal, mode='w')
212
+
213
+ # Build effects chain
214
+ chain = sox.EffectsChain(input_fmt.encoding, output_fmt.encoding)
215
+
216
+ e = sox.Effect(sox.find_effect("input"))
217
+ e.set_options([input_fmt])
218
+ chain.add_effect(e, input_fmt.signal, input_fmt.signal)
219
+
220
+ e = sox.Effect(sox.find_effect("vol"))
221
+ e.set_options(["3dB"])
222
+ chain.add_effect(e, input_fmt.signal, input_fmt.signal)
223
+
224
+ e = sox.Effect(sox.find_effect("output"))
225
+ e.set_options([output_fmt])
226
+ chain.add_effect(e, input_fmt.signal, input_fmt.signal)
227
+
228
+ # Process
229
+ chain.flow_effects()
230
+
231
+ # Cleanup
232
+ input_fmt.close()
233
+ output_fmt.close()
234
+ sox.quit()
235
+ ```
236
+
237
+ ## Building from Source
238
+
239
+ ### macOS
240
+
241
+ ```sh
242
+ brew install sox libsndfile mad libpng flac lame mpg123 libogg opus opusfile libvorbis
243
+ make
244
+ make test
245
+ ```
246
+
247
+ ### Linux
248
+
249
+ ```sh
250
+ apt-get install libsox-dev libsndfile1-dev
251
+ make
252
+ make test
253
+ ```
254
+
255
+ ## Status
256
+
257
+ Comprehensive test suite covering all functionality. All libsox C examples ported to Python (effects chains, waveform analysis, trim, concatenation, format conversion).
258
+
259
+ ## Known Issues
260
+
261
+ - **Memory I/O**: libsox memory I/O functions have platform issues (tests skipped)
262
+ - **Init/Quit Cycles**: Use high-level API to avoid init/quit issues (handled automatically)
263
+
264
+ See [KNOWN_LIMITATIONS.md](https://github.com/shakfu/cysox/blob/main/KNOWN_LIMITATIONS.md) for details.
265
+
266
+ ## Platform Support
267
+
268
+ - **macOS**: Full support
269
+ - **Linux**: Full support
270
+ - **Windows**: Placeholder (contributions welcome)
271
+
272
+ ## Building Documentation
273
+
274
+ ```sh
275
+ pip install sphinx furo myst-parser
276
+ make docs
277
+ make docs-serve # http://localhost:8000
278
+ ```
279
+
280
+ ## License
281
+
282
+ MIT