i built noise cancellation setup 2 microphones , 2 different microphone preamplifiers go 2 different channels of stereo recording.
here sample
http://filestore.to/?d=u5fn2ih96k
i tried
char ergebnis[80]; sprintf(ergebnis, "%s.neu.raw", datei); file* ausgabe = fopen(ergebnis, "wb"); file* f = fopen(datei, "rb"); if (f == null) { return; } int = -1; int r1 = 0; int r2 = 0; int l1 = 0; int l2 = 0; int l = 0; int r = 0; int wo = 0; int dif = 0; while (wo != eof) { wo = getc(f); i++; if (i == 0) { r1 = (unsigned)wo; } if (i == 1) { r2 = (unsigned)wo; r = (r2 << 8) + r1; //r1 | r2 << 8; } if (i == 2) { l1 = (unsigned)wo; } if (i == 3) { l2 = (unsigned)wo; l = (l2 << 8) + l1; //l1 | l2 << 8; dif = r - (l * 2); putc((char)( (unsigned)dif & 0xff), ausgabe); putc((char)(((unsigned)dif >> 8) & 0xff), ausgabe); = -1; } } when magic happens in
dif = r - (l * 2); but not eliminate noise surrounding it, create crackling sounds.
how approach task setup instead? prefer practical solutions on "read paper author of paper understands".
while @ it, how normalize final mono output make loud possible without clipping?
i don't know why expect this
dif = r - (l * 2); to cancel noise, can tell why "create[s] crackling sounds". value in dif going out of range of 16-bit audio. when happens, simple conversion function:
putc((char)( (unsigned)dif & 0xff), ausgabe); putc((char)(((unsigned)dif >> 8) & 0xff), ausgabe); will fail. instead of smooth curve, audio jump large positive large negative values. if confuses you, maybe post help.
even if solve problem, few things aren't clear, not least of active noise canceling work assume 1 mike provides source of noise , other provides signal + noise. which in case? did place 2 mikes next each other , hope hear sound source less ambient noise after simple arithmetic? won't work, since both hearing different combinations of signal , noise (not in amplitude, time well). need answer 1. mike source of signal , source of noise? 2. kind of noise trying cancel? 3. distinguishes mikes in ability hear signal , noise? 4. etc.
update: i'm still not clear on setup, here's might help:
you might have setup signal strong in 1 mike , weak in other, , noise applied both mikes. in likelyhood, there signal leak both mikes. nevertheless, assume
l = noise1 r = signal + noise2 note have not assumed same noise values l , r, reflects reality 2 mikes picking different noise values due time delays , other factors. however, case (and may or may not case in setup) noise1 , noise2 correlated @ low frequencies. thus, if have low pass filter, lp, can achieve noise reduction in low frequencies follows:
out = r - lp(l) = signal + noise2 - lp(noise1) this, of course, assumes noise level @ l , r same, may or may not be, depending on setup. may want leave manual parameter purpose manual tuning @ end:
out = r - g*lp(l) where g tuning parameter , close 1. believe in high-end noise reduction systems, g tuned automatically.
selecting cutoff frequency lp filter remains. approximation use highest frequency can cancel has wavelength equal 1/4 distance between mikes. of course, i'm waving arms that, because depends lot on sound coming from, how directional mikes , on, it's starting point.
sample calculation mikes 3 inches apart:
speed of sound = 13 397 inches / sec desired wavelength = 4*3 inches = 12 inches frequency = 13,397 / 12 = 1116 hz so filter should have cutoff frequency of 1116 hz if mikes 3 inches apart.
expect setup cancel significant amount of signal below cutoff frequency well, if there bleed.
Comments
Post a Comment