File: makesound_test.py

package info (click to toggle)
snd 26.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 44,044 kB
  • sloc: ansic: 291,996; lisp: 260,569; ruby: 71,134; sh: 3,293; fortran: 2,342; csh: 1,067; cpp: 294; makefile: 294; python: 87; xml: 27; javascript: 1
file content (15 lines) | stat: -rwxr-xr-x 372 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/python3

import sys
import soundfile

frames = 44100
channel = [0] * frames
channel[10] = 0.5

with soundfile.SoundFile(sys.argv[1]) as f:
    if f.frames != frames:
        raise Exception("expected %d frames but got %d!" % (frames, f.frames))
    if not all(channel == f.read()):
        raise Exception("soundfile data does not match")
    print("success!")