Mercurial > hg > may
view yetilab/stream/test/test_audiofile.yeti @ 169:fb0000d15b53
readMono fix (must still return matrix even though it's only one channel)
author | Chris Cannam |
---|---|
date | Thu, 02 May 2013 09:56:53 +0100 |
parents | 45199077b043 |
children | 3a2be6eb8bd3 |
line wrap: on
line source
module yetilab.stream.test.test_audiofile; af = load yetilab.stream.audiofile; bl = load yetilab.block.block; { compare } = load yetilab.test.test; testfile name = "yetilab/test/data/\(name).wav"; float n is number -> number = // round number to float precision (for comparison with floats) (arr = new float[1]; arr[0] := n; arr[0]); [ "20samples-open": \( f = af.open (testfile "20samples"); compare f.position 0 and compare f.channels 1 and compare f.sampleRate 44100 and compare f.available (Known 20) and compare f.finished? false and ( f.close () ; true ) ), "20samples-read": \( all id (map do opener: f = opener (testfile "20samples"); first15 = f.read 15; last5 = f.read 10; compare first15.size { rows = 1, columns = 15 } and compare last5.size { rows = 1, columns = 5 } and compare (bl.list (first15.getRow 0)) [ float (32767/32768),0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] and compare (bl.list (last5.getRow 0)) [ 0,0,0,0,-1 ] and ( f.close () ; true ) done [ af.open, af.openMono ]); ), ] is hash<string, () -> boolean>