Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
3 of 22 committers (13.6%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.5%) to scientific vocabulary
Keywords from Contributors
Repository
Python wrapper around sox.
Basic Info
- Host: GitHub
- Owner: marl
- License: bsd-3-clause
- Language: Python
- Default Branch: master
- Size: 4.1 MB
Statistics
- Stars: 531
- Watchers: 13
- Forks: 87
- Open Issues: 35
- Releases: 4
Metadata Files
README.md
pysox
Python wrapper around sox. Read the Docs here.

This library was presented in the following paper:
R. M. Bittner, E. J. Humphrey and J. P. Bello, "pysox: Leveraging the Audio Signal Processing Power of SoX in Python", in Proceedings of the 17th International Society for Music Information Retrieval Conference Late Breaking and Demo Papers, New York City, USA, Aug. 2016.
Install
This requires that SoX version 14.4.2 or higher is installed.
To install SoX on Mac with Homebrew:
brew install sox
If you want support for mp3, flac, or ogg files, add the following flags:
brew install sox --with-lame --with-flac --with-libvorbis
on Linux:
apt-get install sox
or install from source.
To install the most up-to-date release of this module via PyPi:
pip install sox
To install the master branch:
pip install git+https://github.com/rabitt/pysox.git
or
git clone https://github.com/rabitt/pysox.git
cd pysox
python setup.py install
Tests
If you have a different version of SoX installed, it's recommended that you run the tests locally to make sure everything behaves as expected, by simply running:
pytest
Examples
```python import sox
create transformer
tfm = sox.Transformer()
trim the audio between 5 and 10.5 seconds.
tfm.trim(5, 10.5)
apply compression
tfm.compand()
apply a fade in and fade out
tfm.fade(fadeinlen=1.0, fadeoutlen=0.5)
create an output file.
tfm.buildfile('path/to/inputaudio.wav', 'path/to/output/audio.aiff')
or equivalently using the legacy API
tfm.build('path/to/input_audio.wav', 'path/to/output/audio.aiff')
get the output in-memory as a numpy array
by default the sample rate will be the same as the input file
arrayout = tfm.buildarray(inputfilepath='path/to/inputaudio.wav')
see the applied effects
tfm.effects_log
['trim', 'compand', 'fade']
```
Transform in-memory arrays: ```python import numpy as np import sox
sample rate in Hz
sample_rate = 44100
generate a 1-second sine tone at 440 Hz
y = np.sin(2 * np.pi * 440.0 * np.arange(samplerate * 1.0) / samplerate)
create a transformer
tfm = sox.Transformer()
shift the pitch up by 2 semitones
tfm.pitch(2)
transform an in-memory array and return an array
yout = tfm.buildarray(inputarray=y, sampleratein=samplerate)
instead, save output to a file
tfm.buildfile( inputarray=y, sampleratein=samplerate, outputfilepath='path/to/output.wav' )
create an output file with a different sample rate
tfm.setoutputformat(rate=8000) tfm.buildfile( inputarray=y, sampleratein=samplerate, outputfilepath='path/to/output_8k.wav' ) ```
Concatenate 3 audio files: ```python import sox
create combiner
cbn = sox.Combiner()
pitch shift combined audio up 3 semitones
cbn.pitch(3.0)
convert output to 8000 Hz stereo
cbn.convert(samplerate=8000, n_channels=2)
create the output file
cbn.build( ['input1.wav', 'input2.wav', 'input3.wav'], 'output.wav', 'concatenate' )
the combiner does not currently support array input/output
```
Get file information: ```python import sox
get the sample rate
samplerate = sox.fileinfo.sample_rate('path/to/file.mp3')
get the number of samples
nsamples = sox.fileinfo.num_samples('path/to/file.wav')
determine if a file is silent
issilent = sox.fileinfo.silent('path/to/file.aiff')
file info doesn't currently support array input
```
Owner
- Name: Music and Audio Research Laboratory - NYU
- Login: marl
- Kind: organization
- Location: New York, NY
- Website: http://steinhardt.nyu.edu/marl/
- Repositories: 29
- Profile: https://github.com/marl
GitHub Events
Total
- Issues event: 1
- Watch event: 19
- Issue comment event: 9
- Push event: 1
- Pull request review event: 1
- Pull request event: 2
- Fork event: 9
Last Year
- Issues event: 1
- Watch event: 19
- Issue comment event: 9
- Push event: 1
- Pull request review event: 1
- Pull request event: 2
- Fork event: 9
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Rachel Bittner | r****6@n****u | 164 |
| Page David | d****0@g****m | 17 |
| Vincent Lostanlen | v****n@n****u | 11 |
| Hugo van Kemenade | h****k | 7 |
| Eric Humphrey | e****y@s****m | 6 |
| Peter Sobot | p****t@s****m | 3 |
| Stephanie Wagner | s****g@s****m | 3 |
| Justin Salamon | j****n@g****m | 2 |
| Ales Holy | a****y@u****m | 1 |
| Christopher Jacoby | c****y | 1 |
| Farhim Ferdous | 3****a | 1 |
| Jonathan Marmor | j****r@g****m | 1 |
| Karol Trzcinski | k****5@g****m | 1 |
| Kyle Crayne | k****e@d****m | 1 |
| Ronan Delacroix | r****x@g****m | 1 |
| Stefan Mächler | s****r@g****m | 1 |
| Volodymyr Selyukh | v****l | 1 |
| hadware | h****z@g****m | 1 |
| mpuels | m****s@g****m | 1 |
| nullptr-0 | 6****0 | 1 |
| pseeth | p****m@u****u | 1 |
| srishtih | s****h@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 109
- Total pull requests: 60
- Average time to close issues: 5 months
- Average time to close pull requests: 2 months
- Total issue authors: 38
- Total pull request authors: 16
- Average comments per issue: 1.62
- Average comments per pull request: 3.65
- Merged pull requests: 51
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 1
- Average time to close issues: 1 day
- Average time to close pull requests: 1 day
- Issue authors: 2
- Pull request authors: 1
- Average comments per issue: 2.0
- Average comments per pull request: 3.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- rabitt (15)
- justinsalamon (6)
- Page-David (3)
- carlthome (2)
- mcartwright (1)
- StuartIanNaylor (1)
- zackees (1)
- jared-mackey (1)
- mthaak (1)
- Jacob-Bishop (1)
- ingoogni (1)
- ghost (1)
- lostanlen (1)
- manuelhuber (1)
- JackismyShephard (1)
Pull Request Authors
- rabitt (12)
- ejhumphrey (3)
- Page-David (3)
- srishtih (2)
- ronhanson (1)
- justinsalamon (1)
- mikeziminio (1)
- jonathanmarmor (1)
- psobot (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- numpy >=1.9.0
- numpydoc >=0.5
- typing-extensions *
- numpy *
- typing-extensions *
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite