Skip to content
A small library for generating and saving sinusoidal sounds, especially for microphone arrays.
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
__init__.py
pySoundToolbox.py

README.md

pySoundToolbox

A small library for generating and saving sinusoidal sounds, especially for microphone arrays. I am implementing this library to test sound localization algorithms for my master thesis.

Requirements

Simple usage

from pySoundToolbox import *
import numpy as np

# Sinusoidal generation function for a source with 300Hz
sourceSine = genSine(frequency=300)
print(sourceSine(np.arange(0, 0.2, 0.01)))

# Get array response function with a source at 45° (the microphone positions are the ones of
# the kinect)
arrayResponse = genArrayResponseFunc(45 * np.pi / 180)
print(arrayResponse(np.arange(0, 0.2, 0.01)))

# Sample array response at 16kHz for one second
data = sample24PCM(arrayResponse)

# Save sampled array response as uncompressed 24 bit wav
# Every channel represents the response of the microphone
save24PCM('test.wav', data)

# Read saved file
loadedData = read24PCM('test.wav')
# loadedData == data
You can’t perform that action at this time.