Author Topic: 600D Audio TEST release - 2.3 based  (Read 180500 times)

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio TEST release - 2.3 based
« Reply #150 on: September 03, 2012, 06:26:01 PM »
@a1ex - will look in there.

Quote
What is point of merge to main repo?

To get latest fixes for stuff not being worked on. Buffer not fixed but now work of start wav/stop wav and getting file name is done for you. I can actually combine both but you said it still stuttttters. Maybe try shoot_malloc in a proper way, maybe it didn't work because of my mediocre C. Zebras work with no problems while recording and they are in shoot_malloc too for me.

*128k Buffer gives me 10.6MB/s write.
16k only 2.2 MB

miyake

  • Developer
  • Senior
  • *****
  • Posts: 396
Re: 600D Audio TEST release - 2.3 based
« Reply #151 on: September 04, 2012, 04:13:19 AM »
@Alex

This patch will solve WAV writing issue. I confirmed.
 - current code has no buffer
 - If write speed is not enough, wav data will lost
 - This patch adding a queue for reading. and write_q_task will write asyncronous. So It has no data lost.
 - But actually write speed is not enough, NotifyBox will telling "Use more faster card"
*Now I can write CBR3.0 and WAV recording together with no data lost.
*tested WAV recording + CBR 2.0 CBR 2.5 CBR 2.8

Please test this on your side.

Code: [Select]
diff -r ae36c8b5889b src/beep.c
--- a/src/beep.c        Sun Sep 02 02:50:47 2012 +0900
+++ b/src/beep.c        Tue Sep 04 11:33:29 2012 +0900
@@ -322,12 +322,73 @@
     return ans;
 }

+
+
+typedef struct _write_q {
+    int multiplex;
+    void *buf;
+    struct _write_q *next;
+}WRITE_Q;
+
+#define QBUF_SIZE 4
+#define QBUF_MAX 20
+WRITE_Q *rootq;
+
+static void add_write_q(void *buf){
+    WRITE_Q *tmpq = rootq;
+    WRITE_Q *newq;
+
+    int i=0;
+    while(tmpq->next){
+        tmpq = tmpq->next;
+        i++;
+    }
+    if(i > QBUF_MAX){
+        NotifyBox(2000,"Lost WAV data\nUse more faster card");
+        return;
+    }
+
+    if(tmpq->multiplex < QBUF_SIZE){
+        if(!tmpq->buf){
+            tmpq->buf = alloc_dma_memory(WAV_BUF_SIZE*QBUF_SIZE);
+        }
+        int offset = WAV_BUF_SIZE * tmpq->multiplex;
+        memcpy(tmpq->buf + offset,buf,WAV_BUF_SIZE);
+        tmpq->multiplex++;
+    }else{
+        newq = AllocateMemory(sizeof(WRITE_Q));
+        memset(newq,0,sizeof(WRITE_Q));
+        newq->buf = alloc_dma_memory(WAV_BUF_SIZE*QBUF_SIZE);
+        memcpy(newq->buf ,buf,WAV_BUF_SIZE);
+        newq->multiplex++;
+        tmpq->next = newq;
+    }
+}
+
+static void write_q_dump(){
+    WRITE_Q *tmpq = rootq;
+    WRITE_Q *prevq;
+
+    while(tmpq->next){
+        prevq = tmpq;
+        tmpq = tmpq->next;
+        FIO_WriteFile(file, UNCACHEABLE(tmpq->buf), WAV_BUF_SIZE * tmpq->multiplex);
+        free_dma_memory(tmpq->buf);
+        prevq->next = tmpq->next;
+        FreeMemory(tmpq);
+        tmpq = prevq;
+    }
+}
+
+
+
+
 static void asif_rec_continue_cbr()
 {
     if (file == INVALID_PTR) return;

     void* buf = wav_buf[wav_ibuf];
-    FIO_WriteFile(file, UNCACHEABLE(buf), WAV_BUF_SIZE);
+    add_write_q(buf);

     if (audio_recording == 2)
     {
@@ -504,6 +565,21 @@
 static void wav_playback_do();
 static void wav_record_do();

+
+static void write_q_task()
+{
+    TASK_LOOP
+    {
+        if (audio_recording==1 || rootq->next)
+        {
+            write_q_dump();
+        }
+        msleep(500);
+    }
+}
+
+TASK_CREATE( "write_q_task", write_q_task, 0, 0x16, 0x1000 );
+
 static void beep_task()
 {
     TASK_LOOP
@@ -846,7 +922,10 @@
 {
     wav_buf[0] = alloc_dma_memory(WAV_BUF_SIZE);
     wav_buf[1] = alloc_dma_memory(WAV_BUF_SIZE);
-
+    rootq = AllocateMemory(sizeof(WRITE_Q));
+    memset(rootq,0,sizeof(WRITE_Q));
+    rootq->multiplex=100;
+
     beep_sem = create_named_semaphore( "beep_sem", 0 );
     menu_add( "Audio", beep_menus, COUNT(beep_menus) );
     find_next_wav(0,1);


@1%
I just found your post now. Anyway, I can done without shoot_malloc. Do you know where is already described what is difference of AllocateMemory /allocate_dma_memory/shoot_malloc....
I know only these malloc is getting different memory spaces. But I don't know which one is best to use something.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio TEST release - 2.3 based
« Reply #152 on: September 04, 2012, 05:31:51 AM »
Shoot malloc is the shooting buffer, allocate memory is what is available on the debug dialog... dma memory I think the same thing, actually not sure on that one.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: 600D Audio TEST release - 2.3 based
« Reply #153 on: September 04, 2012, 07:19:44 AM »
Thanks miyake, looks very nice. I'll try.

About malloc's:

- malloc: this allocates memory from a small pool (maybe standard C malloc?)

- AllocateMemory: similar, but uses a larger pool

- alloc_dma_memory: same as AllocateMemory, but returns an uncacheable address, allocates 64 bytes before and 64 after the requested size, and also calls TH_map_dma_memory which I don't know what it does.

- shoot_malloc: experimental: this uses memory normally used for shooting (RAW buffers), via a resource manager task (RscMgr). Related strings: m_pfAllocMemoryCBR, AllocateMemoryFromShootMemoryObject. It returns a data structure named MemSuite which contains one or more MemChunk's. I think one MemChunk can have max 32 MB, and I was able to allocate 192 MB total. Looks like Canon code expects shoot memory buffer to be freed when it's not used (on 60D I get ERR70 if such a buffer is left allocated and you are changing custom functions).

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio TEST release - 2.3 based
« Reply #154 on: September 04, 2012, 08:08:47 AM »
Tested it and no more drop outs or stutters.

miyake

  • Developer
  • Senior
  • *****
  • Posts: 396
Re: 600D Audio TEST release - 2.3 based
« Reply #155 on: September 04, 2012, 08:27:20 AM »
@1%
Yay!!

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio TEST release - 2.3 based
« Reply #156 on: September 04, 2012, 07:39:16 PM »
Trying to add wav record for every movie but not sure how to have fps_record_wav in beep.c nor cfg_override_audio in fps-engio.c since they are confined to their respective .c files.

Added the menu in beep.c after sound recorder and tried to modify the fps should record wav return line.


Got it working but still not ideal 1 setting and forgetting solution.

Also, small bug in fps recording, even though sound is turned on empty wav stream is still in the .mov files and gives an error on playback that it can't be decoded (since there is nothing there).


miyake

  • Developer
  • Senior
  • *****
  • Posts: 396
Re: 600D Audio TEST release - 2.3 based
« Reply #157 on: September 05, 2012, 12:59:44 PM »
1%

I was cleanup some old codes.
Then I could save FPS override with separate wav audio.Also we don't need to wait in beep.c.
Now our 600D audio_configure is similar time with another model's one.

miyake

  • Developer
  • Senior
  • *****
  • Posts: 396
Re: 600D Audio TEST release - 2.3 based
« Reply #158 on: September 05, 2012, 04:39:40 PM »
@1% & scrax & Kromofone
PLEASE BE CAREFUL FOR CURRENT 600D AUDIO CODE.
Now I found ML_PLYBAK_BOST_VOL_DEF was -12db. Current code is change to 0db. Then monitoring sound is really loud! :o
It's good to hear monitoring sound for High impedance Headphones.

I think Kromofone don't need to buy Headphone AMP. Yey!!!!!!!!!!!!!!!!

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio TEST release - 2.3 based
« Reply #159 on: September 05, 2012, 05:07:41 PM »
You can still control output volume like before, right? Just higher default and maximum volume? I've got to work but I'll test when I come back.

I think null wav stream in video still happen but thats better than low bitrate or no sound.

Kromofone

  • New to the forum
  • *
  • Posts: 43
Re: 600D Audio TEST release - 2.3 based
« Reply #160 on: September 05, 2012, 05:14:04 PM »
@1% & scrax & Kromofone
PLEASE BE CAREFUL FOR CURRENT 600D AUDIO CODE.
Now I found ML_PLYBAK_BOST_VOL_DEF was -12db. Current code is change to 0db. Then monitoring sound is really loud! :o
It's good to hear monitoring sound for High impedance Headphones.

I think Kromofone don't need to buy Headphone AMP. Yey!!!!!!!!!!!!!!!!

Awesomee!! :D
I'll begin testing it more with caution, thanks for the info! :)
Canon EOS 50D, Helios 44-2, Helios 44M-4, Mir-1B, Zenit 12XP

miyake

  • Developer
  • Senior
  • *****
  • Posts: 396
Re: 600D Audio TEST release - 2.3 based
« Reply #161 on: September 05, 2012, 05:16:55 PM »
Good morning 1%

You can still control output volume like before, right? Just higher default and maximum volume? I've got to work but I'll test when I come back.

I think null wav stream in video still happen but thats better than low bitrate or no sound.

Yes, you can control outout volume same as previously. Previously boost is always -12db. So I changed 0db. The most best way is add a new menu structure which is controlling output volume and this boost together. But now I choose source compatibility for another cameras. It's not so bad.

The "null wav stream" will happen on  FPS override and wav recording toghether. right?? And it's a recorded all null in a file?
In my 600D, the problem was gone. Or another problems?

Anyway, have a good day!

miyake

  • Developer
  • Senior
  • *****
  • Posts: 396
Re: 600D Audio TEST release - 2.3 based
« Reply #162 on: September 05, 2012, 05:19:36 PM »
Awesomee!! :D
I'll begin testing it more with caution, thanks for the info! :)

However , Still problem found on sound recording with video recording together. I already sent patch to alex.
So I will publish next autoexec.bin when my patch is accepted.

Kromofone

  • New to the forum
  • *
  • Posts: 43
Re: 600D Audio TEST release - 2.3 based
« Reply #163 on: September 05, 2012, 05:23:32 PM »
However , Still problem found on sound recording with video recording together. I already sent patch to alex.
So I will publish next autoexec.bin when my patch is accepted.
Alright good, one more thing though, if I may ask. Occasionally, when I turn the Audio override Off or On in Manual mode, I get this blinking bar in the middle of the screen. It is only for a brief moment, like 0.2 seconds and it blinks twice, showing the date and the clock. Are you familiar with it?
Canon EOS 50D, Helios 44-2, Helios 44M-4, Mir-1B, Zenit 12XP

miyake

  • Developer
  • Senior
  • *****
  • Posts: 396
Re: 600D Audio TEST release - 2.3 based
« Reply #164 on: September 05, 2012, 05:49:19 PM »
Quote
I get this blinking bar in the middle of the screen

Ah, Maybe it's a canon menu?right?
I can see it too when I push trash button.  But I can't see when I change override on/off...

Can I see your screen?

Kromofone

  • New to the forum
  • *
  • Posts: 43
Re: 600D Audio TEST release - 2.3 based
« Reply #165 on: September 05, 2012, 05:53:32 PM »
Ah, Maybe it's a canon menu?right?
I can see it too when I push trash button.  But I can't see when I change override on/off...

Can I see your screen?
Yeah I think it's the canon one!
I'll try to reproduce it and catch it on video, will upload as soon as I accomplish it.
Canon EOS 50D, Helios 44-2, Helios 44M-4, Mir-1B, Zenit 12XP

miyake

  • Developer
  • Senior
  • *****
  • Posts: 396
Re: 600D Audio TEST release - 2.3 based
« Reply #166 on: September 05, 2012, 05:55:55 PM »
Yeah I think it's the canon one!
I'll try to reproduce it and catch it on video, will upload as soon as I accomplish it.

Ah, OK....
Maybe I can't solve it. It's not do a negative effect to us. So never mind it.

Kromofone

  • New to the forum
  • *
  • Posts: 43
Re: 600D Audio TEST release - 2.3 based
« Reply #167 on: September 05, 2012, 06:53:12 PM »
Ah, OK....
Maybe I can't solve it. It's not do a negative effect to us. So never mind it.

Okay well...still, if you want to see when and how it happened, it's around 1:03.
Canon EOS 50D, Helios 44-2, Helios 44M-4, Mir-1B, Zenit 12XP

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: 600D Audio TEST release - 2.3 based
« Reply #168 on: September 05, 2012, 07:01:15 PM »
There was a fix for this in the previous version (Xmas), but it caused stability problems, so I've disabled it. Better a small display glitch than more chances to crash, no?

Kromofone

  • New to the forum
  • *
  • Posts: 43
Re: 600D Audio TEST release - 2.3 based
« Reply #169 on: September 05, 2012, 07:05:20 PM »
Good point.
Canon EOS 50D, Helios 44-2, Helios 44M-4, Mir-1B, Zenit 12XP

floatboth

  • Just arrived
  • *
  • Posts: 1
Re: 600D Audio TEST release - 2.3 based
« Reply #170 on: September 05, 2012, 07:11:04 PM »
Hi! In this release, is it possible to turn audio recording off completely in order to record video with higher bitrate on a slow SD card?

miyake

  • Developer
  • Senior
  • *****
  • Posts: 396
Re: 600D Audio TEST release - 2.3 based
« Reply #171 on: September 05, 2012, 07:21:07 PM »
Hi! In this release, is it possible to turn audio recording off completely in order to record video with higher bitrate on a slow SD card?
No.
Faster card needed.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio TEST release - 2.3 based
« Reply #172 on: September 06, 2012, 02:51:47 AM »
Quote
Still problem found on sound recording with video recording together.

Its faster for sure but I tested snapping my fingers and sometimes there is a bit of distortion as if I hit a limiter on a real mixer. Maybe its just the highpass filter? I tried with it off and it was better. Also sounds way better on real headphones instead of through the speaker.


Null stream is gone, I think it was just header so no data was in it
. Not sure, maybe still here.
Still have to test the monitoring.

Wav is mono, wonder if FW supports stereo. Hopefully we have enough memory.


Quote
Okay well...still, if you want to see when and how it happened, it's around 1:03.

I turn off piggybacking completely because I don't like what it does to all of the menus. I use the arrow keys more anyway.



I figured out stereo but what about:

  MEM(0xC092011C) = 4; // SetASIFADCModeSingleINT16
//   MEM(0xC092011C) = 6; //SetASIFADCModeInterleaveINT16

Both respect channels and work for stereo.

Also what about using int16 buffers and int16 stereo?

Do they all just follow this?


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

miyake

  • Developer
  • Senior
  • *****
  • Posts: 396
Re: 600D Audio TEST release - 2.3 based
« Reply #173 on: September 06, 2012, 05:58:31 AM »
1%
Can you share snapping finger with distortion video? I want to know what Hz affect by filter settings.
My finger don't make a sound :-[

Does "piggybacking" a function on ML? Do I have something to do  on our 600D audio codes?

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: 600D Audio TEST release - 2.3 based
« Reply #174 on: September 06, 2012, 06:35:40 AM »
Its for the scroll wheel. Canon menu pops up in the background. Does things like in the video.

I deleted it and went to mode 6 in beep.c. I think it follows that format on all of them. So we're sampling 16bit wav in 8 bit? Or just size?

This is how stereo sounds but BR wasn't very high and only internal mic.

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