Browse the code
| Differences between 21 and 22 on /. | |||||||
|---|---|---|---|---|---|---|---|
| Number of edited files: | 1 (0 added, 0 deleted and 1 modified) | ||||||
| Author: | Erwan JACQ <> | ||||||
| Log message: | multichannel import (left channel only) | ||||||
| Date: | 2012-04-03 23:51 +0200 | ||||||
|
|||||||
| Old | New | Code |
|---|---|---|
| 239 | 239 |
if fin < 0 : |
| 240 | 240 |
print "Noise estimation failed" |
| 241 | 241 |
return None |
| 242 |
bdf = rms(ech.data[debut:fin]) | |
| 243 |
return bdf | |
| 242 |
else :
| |
| 243 |
bdf = rms(ech.data[debut:fin]) | |
| 244 |
return bdf | |
| 244 | 245 | |
| 245 | 246 |
#Cleaning IR, removing noise |
| 246 | 247 |
def denoise(ech) : |
| 272 | 273 |
else: |
| 273 | 274 |
bornedebut = bornefin |
| 274 | 275 | |
| 276 |
noisecutposition = bornefin | |
| 277 | ||
| 275 | 278 |
if noise == None : |
| 276 |
bornefin = len(ech.data) -1 | |
| 279 |
noisecutposition = len(ech.data)-1
| |
| 277 | 280 |
|
| 278 | 281 |
#clip |
| 279 |
debut = directsoundposition | |
| 280 | 282 |
ech_clipped = copy.copy(ech) |
| 281 |
ech_clipped.data = ech_clipped.data[debut:bornefin] | |
| 283 |
ech_clipped.data = ech_clipped.data[directsoundposition:noisecutposition]
| |
| 282 | 284 |
ech_clipped.update() |
| 283 | 285 | |
| 284 |
noisecutposition = bornefin | |
| 285 | 286 |
return ech_clipped, directsoundposition, noisecutposition |
| 286 | 287 | |
| 287 | 288 | |
| 397 | 398 |
raise "24 bit wav" |
| 398 | 399 | |
| 399 | 400 |
self.samplerate, self.data = scipy.io.wavfile.read(filepath) #doesn't work for 24 bit wave |
| 401 |
if type(self.data[0]) == scipy.ndarray :
| |
| 402 |
self.data = self.data[ : ,0] | |
| 400 | 403 |
self.data = self.data/2.0**(self.samplewidth*8-1) |
| 401 | 404 | |
| 402 | 405 |
self.nframes = data.getnframes() |
| 403 | 406 |

