Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions audiogen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .sampler import frame_rate
from .sampler import write_wav


from .generators import tone
from .generators import beep
from .generators import silence
Expand All @@ -14,6 +15,6 @@
from .util import loop
from .util import play

from filters import band_pass
from filters import band_stop
from .filters import band_pass
from .filters import band_stop

4 changes: 2 additions & 2 deletions audiogen/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import itertools
import collections

import util
import sampler
from audiogen import util
from audiogen import sampler

TWO_PI = 2 * math.pi

Expand Down
4 changes: 2 additions & 2 deletions audiogen/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import math
import itertools

import util
import sampler
from audiogen import util
from audiogen import sampler

TWO_PI = 2 * math.pi

Expand Down
3 changes: 1 addition & 2 deletions audiogen/noise.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

import util as util
from audiogen import util

# Arcfour PRNG as a fast source of repeatable randomish numbers; totally unnecessary here, but simple.
def arcfour(key, csbN=1):
Expand Down
6 changes: 3 additions & 3 deletions audiogen/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import errno
import contextlib

from StringIO import StringIO
import io

from .util import hard_clip
from .util import normalize
Expand Down Expand Up @@ -61,7 +61,7 @@ def file_is_seekable(f):
try:
f.tell()
logger.info("File is seekable!")
except IOError, e:
except IOError as e:
if e.errno == errno.ESPIPE:
return False
else:
Expand Down Expand Up @@ -133,7 +133,7 @@ def dummy(*args):

def wave_module_patched():
'''True if wave module can write data size of 0xFFFFFFFF, False otherwise.'''
f = StringIO()
f = io()
w = wave.open(f, "wb")
w.setparams((1, 2, 44100, 0, "NONE", "no compression"))
patched = True
Expand Down
6 changes: 3 additions & 3 deletions audiogen/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .noise import white_noise_samples
from .noise import red_noise

import sampler
from audiogen import sampler

def crop(gens, seconds=5, cropper=None):
'''
Expand Down Expand Up @@ -110,8 +110,8 @@ def crop_at_zero_crossing(gen, seconds=5, error=0.1):

# find min by sorting buffer samples, first by abs of sample, then by distance from optimal
best = sorted(enumerate(end), key=lambda x: (math.fabs(x[1]),abs((buffer_length/2)-x[0])))
print best[:10]
print best[0][0]
print(best[:10])
print(best[0][0])

# todo: better logic when we don't have a perfect zero crossing
#if best[0][1] != 0:
Expand Down