This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

The audiogen package provides time domain audio processing tools using Python generators.

This makes some types of audio sample generation and processing pretty easy:

# mix 440 Hz and 445 Hz tones to get 5 Hz beating
beats = audiogen.mixer(
        (audiogen.tone(440), audiogen.tone(445)),
        [(constant(1), constant(1)),]
)

The actual samples won’t be generated or stored in memory until they’re actually consumed – for instance, when they’re being written out to disk in a wave file:

with open("output.wav", "wb") as f:
    audiogen.sampler.write_wav(f, beats)

Generators’ at-consumption-time computation also allows creating infinitely long output, e.g. to stream to speakers rather than a file on disk:

audiogen.sampler.write_wav(sys.stdout, audiogen.tone(440))

Or just:

audiogen.sampler.play(audiogen.tone(440))

You can also use standard generator tools, e.g. the itertools module, to handle audio data:

    beep_silence = itertools.chain(audiogen.beep(), audiogen.silence(0.5))
    infinite_beeps = itertools.cycle(beep_silence)

audiogen.sampler.write_wav(sys.stdout, infinite_beeps)

Soundcard output

The easiest way to play directly to a soundcard output is to use the audiogen.sampler.play function, which will play your samples using PyAudio:

import audiogen
import itertools
import sys

audiogen.sampler.play(
    itertools.cycle(itertools.chain(audiogen.beep(), audiogen.silence(0.5)))
)

Alternatively, you could write your wave data to stdout, e.g. myaudio.py:

import audiogen
import itertools
import sys

audiogen.sampler.write_wav(
    sys.stdout,
    itertools.cycle(itertools.chain(audiogen.beep(), audiogen.silence(0.5)))
)

Then pipe to a command line audio player like Sox:

python myaudio.py | play -t wav -

Installation

Install with:

$ pip install audiogen
$ pip install --allow-external PyAudio --allow-unverified PyAudio PyAudio

PyAudio is optional. If it’s not installed, playing audio via the soundcard with audiogen.sampler.play() will not be available, but generating Wave files – including for piping to an external player, like sox – will work just fine.

Note that to install PyAudio on Mac OS X, you’ll need to first install portaudio:

$ brew install portaudio

See also

Projects built with audiogen:

  • koch, a Koch method Morse code trainer and audio generator
  • afsk, a ham radio APRS/Bell-202 audio frequency shift keying encoder

Contributing

Get the source and report any bugs on Github:

https://github.com/casebeer/audiogen

Version history

  • 0.1.2 - Add band pass and band stop IIR filters; custom beep lengths from @jhobbs
  • 0.1.1 - Fix multiplexing bug causing increase in pitch when using mixer() to produce more than one output channel
  • 0.1.0 - Breaking changes: new arguments to tone(), play() blocks by default
Release History

Release History

0.1.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
audiogen-0.1.2.tar.gz (10.6 kB) Copy SHA256 Checksum SHA256 Source May 28, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting