Make audio
Project description
A small library for audio manipulation.
import soundit as s
s.play_output_chunks(s.chunked(s.exact(1, s.sine(440))))
Installation
Simply run:
$ pip install soundit[sounddevice]
The [sounddevice] extra installs sounddevice for playing audio through speakers.
Usage
A longer example:
import itertools
import soundit as s
indices = s.make_indices_dict()
frequencies = s.make_frequencies_dict()
notes = "a3 c e a g e c e d e d c a3 c a3 g3".split()
s.play_output_chunks(s.chunked(itertools.chain.from_iterable(
s.exact(0.5, s.sine(frequencies[indices[note]]))
for note in notes
)))
An even longer example:
import soundit as s
s.init_piano() # See its documentation for details on its setup
names = "do di re ri mi fa fi so si la li ti".split()
indices = s.make_indices_dict(names)
music = '''
. mi mi mi
fa do . do
. so mi do
re mi,re - mi
'''
s.play_output_chunks(s.chunked(
s.volume(2, s._notes_to_sound(
s.music_to_notes(music, line_length=1.15),
lambda name, length: s.piano(indices[name] + 1),
))
))
Links
Source Code: https://github.com/GeeTransit/soundit
Documentation: https://geetransit.github.io/soundit/
PyPI Releases: https://pypi.org/project/soundit/
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
soundit-0.3.tar.gz
(21.3 kB
view details)
Built Distribution
soundit-0.3-py3-none-any.whl
(19.7 kB
view details)
File details
Details for the file soundit-0.3.tar.gz
.
File metadata
- Download URL: soundit-0.3.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.22.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cc0722db7031ab6a83ad50aec8f39a97c4802c952806244052ab226e22e5c94 |
|
MD5 | 1ceb89825730734dff084099167d23ad |
|
BLAKE2b-256 | 21ecd99c3e601393155204bbbca9c332bf8e91238f632aa1c774111d03bb498d |
Provenance
File details
Details for the file soundit-0.3-py3-none-any.whl
.
File metadata
- Download URL: soundit-0.3-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.22.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 461abdc64f86fe20c52d1efd8ec4a23a69b9b46ca56519dfb9e42b38fa5f7ed8 |
|
MD5 | de4c729f37d5dbdcd5cd314636edc153 |
|
BLAKE2b-256 | dab8dd909e7576dc396b618d16cddea7005180ae4d02df2549f6bc5bc60002e8 |