Generate Wav Files

Generate audio files with Python for programming music!

Generate wav files with Python!

Date Created:Monday June 23rd, 2008 12:54 PM
Date Modified:Sunday August 03rd, 2008 01:18 PM

# File:

import writewav
writewav.createWavlambda xwritewav.sin(x), "file.wav"0.5)

# File:

import wave
from math import pisinfloorcos
def quantize(f,  time ,channels 2framerate 44100amplitude 127):
    dx 1.0 float(framerate)
    res ""
    while time:
        res res chr(int(f(x) * amplitude amplitude)) * channels
        x += dx
    return res
def createWav(ffilenametime ,channels 2framerate 44100amplitude 127):
def dan1(x):
    % (pi)
    if pi or 3*pi/4:
        return sin(m)
        return -pi 2
def square(x):
    floor(10 pi)
    if sin(cos(x*x*x)) > 0:
        return d/m
        return -d/m
def waver(xAwp):
    return A*sin(2*pi*(wt-p))

Download: 104 B
Download: 916 B

Please login or Click Here to register for downloads
Creative Commons License
Generate Wav Files by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at
Permissions beyond the scope of this license may be available at