Skip to main content

A small package to convert audio files

Project description

pyaudioconvert

Simple utility to convert audio from one form to another (via sox). We will use Sox until we find a fast and efficient way to convert reliably in python

Requirements

  1. At least py3x
  2. Have sox installed

Install

  1. pip install pyaudioconvert

Example Usage

Converting Single WAVs

#let's start with a 24bit 48kz audio wav 2 channel wav
>>> soxi example_24bit_48k_2ch.wav 

Input File     : 'example_24bit_48k_2ch.wav'
Channels       : 2
Sample Rate    : 48000
Precision      : 24-bit
Sample Encoding: 24-bit Signed Integer PCM

#we prefer 16-bit 16kz mono for our systems, let's use python
>>> import pyaudioconvert as pac
>>> pac.convert_wav_to_16bit_mono('example_24bit_48k_2ch.wav', 'example_16bit_16k_1ch.wav')
Out[2]: 'example_16bit_16k_1ch.wav'

#let's check the new file...
>>> soxi example_16bit_16k_1ch.wav 

Input File     : 'example_16bit_16k_1ch.wav'
Channels       : 1
Sample Rate    : 16000
Precision      : 16-bit
Sample Encoding: 16-bit Signed Integer PCM

Converting Directory of WAVs

Maybe I have a whole folder of WAVS that need converting... this will create a _16k.wav version.

(py36) rob:~/example_test$ ls
1.wav  2.wav  3.wav  4.wav

>>>python

Python 3.6.5 (default, Apr  1 2018, 05:46:30) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import pyaudioconvert as pac

In [2]: pac.convert_all_wavs_in_folder()
2.wav
2_16k.wav
3.wav
3_16k.wav
1.wav
1_16k.wav
4.wav
4_16k.wav

(py36) rob:~/example_test$ ls
1_16k.wav  1.wav  2_16k.wav  2.wav  3_16k.wav  3.wav  4_16k.wav  4.wav

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyaudioconvert-0.0.5.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

pyaudioconvert-0.0.5-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file pyaudioconvert-0.0.5.tar.gz.

File metadata

  • Download URL: pyaudioconvert-0.0.5.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for pyaudioconvert-0.0.5.tar.gz
Algorithm Hash digest
SHA256 13e3f4b1780640da57d4cb660570e9f763be894f334aaab6a4f256cf60d6b2ce
MD5 29fed1f6366927037e4758dfab67a9e8
BLAKE2b-256 07ffa6081d8340394a1865b6ef7339c07627258f9d66fa70fe0ecbdf1fca5d81

See more details on using hashes here.

File details

Details for the file pyaudioconvert-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pyaudioconvert-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for pyaudioconvert-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d5a67db3ac0b23adac85d83cd45386046cf02ddbc4d55700d47cc4b3c4178358
MD5 0686914a37e29a66a8c13779b9d52d93
BLAKE2b-256 57536006f18834d484704c2e7bb46d4f7c9fcde06d2b1f9f5f53e03bb4283ff4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page