Stereo WAV & Drop-outs

Started by 1%, October 05, 2012, 06:36:49 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

1%

So  I've had stereo wav enable for a while now like this:


SetSamplingRate(48000, 6);
  MEM(0xC092011C) = 6; //SetASIFADCModeInterleaveINT16

    // 1 = mono uint8
    // 3 = stereo uint8
    // 4 = mono int16
    // 6 = stereo int16
    // => bit 2 = 16bit, bit 1 = stereo, bit 0 = 8bit


I really like the separate wav function but working on the sync and testing further I notice that I get strange dropouts which cause distortion or stutters every once in a while. Like a chunk was lost or mis-timed.

The dropouts look like this:



A clearer one (look in the middle):




And sound like this:

http://www.qfpost.com/file/d?g=sWMNfOzgH

Any ideas on what is happening? Does it come from buffer/write/etc?

I've tried making the buffer bigger

#define QBUF_SIZE 8

But it doesn't seem to help. Any ideas on how to try and fix this?

1%

Ok, getting somewhere. Output from the ADC was int16 and buffers were uint8 and later uint16. I think the signedness caused a problem. I got rid of most of the drops but now it sounds like a speed up/slow down on occasion.

I'm wondering if I should make the big buffer (static int16_t* wav_buf[2] = {0,0};) into uint32 to have larger values or int32 to keep the signedness of the 2 int16 buffers... anyone know. I got a few drops at int32_t so I'll see if uint32_t makes it better or worse.

1%

Learned a little bit:

First we're sampling 16bit mono as uint8 mono.
Then sampling 16bit stereo as int16. I've also done stereo to uint8 and it holds up better but still skips like a scratched cd on occasion.

I used up to 32 bit buffers and it sounds good but then still skips or slows down/speeds up.


Currently I think the method in beep.c is double buffered audio. I wonder if there is a way to get multi-buffer working. Right now can't handle uint8 mono or stereo. In reality slows/down speeds up, just with unit8 mono you don't notice as much. Also part of the reason why audio doesn't match video, esp over time.

Also there is option for circular buffer which is simlar but without constant allocation/deallocation:

http://atastypixel.com/blog/a-simple-fast-circular-buffer-implementation-for-audio-processing/


int 16-> uint8 sampling http://www.fast-files.com/getfile.aspx?file=56170
int 16 -> int16 sampling  http://www.fast-files.com/getfile.aspx?file=56171

Can also try 44.1 sampling but won't it be worse than 48 in 16 or 8 or even mono?

1%

Found a good explanation of wav headers so they can be set correctly:

http://www.topherlee.com/software/pcm-tut-wavformat.html


Also went down to 16bit mono and started using shoot_malloc. Songs still skip occasionally but vocal work should be ok now. Also found out this is affected by CPU usage. When in manual with no LV, wav doesn't skip as much.

https://bitbucket.org/OtherOnePercent/tragic-lantern/src/102ea6b66c535b6cb754c362788bca84f0f4bbf4/src/beep.c

Sounds pretty decent.

scrax

I have to try it, but are this drop-outs only when recording audio and video, or also when recording audio only?

Because for audio memo 22,050Hz 8bit mono is enough and maybe better because it will use less card space
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

1%

I want to use it for audio when an external recorder isn't available. I don't see why it can't save a wav file of decent quality.

Lowering the sampling rate didn't seem to help when I went down to 44.1, you can try.

deleted.account.01

like on first quick look it looks for me like Digital Noize ... its hard to explain but ill try do it on examples.

i got in my computer few Line in and Few Mic In ..and few Out .. but iwant focus on front panel... always when i conecting  to the front panel ( fron panel including x2USB plugs + Line out + Mic in + ...  when i conecting mic to front panel and in same moment i got conected to same Front Panl USB cable i  can hear Digital Noize  what is generated by my Computer.. when i take out USB cable from front panel digital Noize is gone...

same or very similar stuff happend for me when i got turned ON CD audio in Mixer Panel  and all volume from CD AUDIO are on 100% ..

in my opinion this error can coming from MemoryCard reader inside Camera or some another Digital device inside camera..

but this sugestion i got after first quick look on wave file u upload.. ineed to be more sure..i need make same error on my camera

1%

I got drop outs from both laptop audio out and recording vocals with a mic. You can hear it stutter when the actor speaks, there is no extra noise. Expander can take care of hiss anyway, there is very little compared to what I've dealt with. Also sounds worse on monitoring then it actually gets recorded.

With stereo wav, audio length shorter or longer than video. With mono wav, less so but still shorter or longer.

deleted.account.01

i will try find and download nightly bulid soon and i will check that dropouts..looks like i was mean again something diferente