600D Audio Controls?

Started by testaevisual, June 17, 2012, 06:16:10 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

miyake

standby vs standby(recording finish)
@@ -7,19 +7,19 @@
ML_CLK_EN 0f
ML_CLK_CTL 04
ML_SW_RST 00
-ML_REC_PLYBAK_RUN 11
+ML_REC_PLYBAK_RUN 00
ML_MIC_TIM 12
ML_PW_REF_PW_MNG 06
-ML_PW_IN_PW_MNG 0a
+ML_PW_IN_PW_MNG 00
ML_PW_DAC_PW_MNG 00
ML_PW_SPAMP_PW_MNG 00
ML_PW_LOUT_PW_MNG 00
ML_PW_ZCCMP_PW_MNG 02
ML_PW_MICBIAS_VOL 02
-ML_PW_MIC_IN_VOL 3f
-ML_PW_MIC_BOST_VOL 10
+ML_PW_MIC_IN_VOL 10
+ML_PW_MIC_BOST_VOL 00
ML_PW_SPK_AMP_VOL 1b
-ML_PW_AMP_VOL_FUNC 01
+ML_PW_AMP_VOL_FUNC 03
ML_PW_AMP_VOL_FADE 00
ML_SPK_AMP_OUT 00
ML_MIC_IF_CTL 00
@@ -27,8 +27,8 @@
ML_SAI_TRANS_CTL 0b
ML_SAI_RCV_CTL 0b
ML_SAI_MODE_SEL 00
-ML_FILTER_EN 0f
-ML_DVOL_CTL 2e
+ML_FILTER_EN 00
+ML_DVOL_CTL 2c
ML_MIXER_VOL_CTL 10
ML_RECORD_DIG_VOL ff
ML_PLBAK_DIG_VOL ff


recording vs standby(finish recording)
--- AUDIOREG-recording.TXT      2012-07-26 10:02:48.000000000 +0900
+++ AUDIOREG-finishrecording.txt        2012-07-26 10:36:54.000000000 +0900
@@ -7,19 +7,19 @@
ML_CLK_EN 0f
ML_CLK_CTL 04
ML_SW_RST 00
-ML_REC_PLYBAK_RUN 11
+ML_REC_PLYBAK_RUN 00
ML_MIC_TIM 12
ML_PW_REF_PW_MNG 06
-ML_PW_IN_PW_MNG 0a
+ML_PW_IN_PW_MNG 00
ML_PW_DAC_PW_MNG 00
ML_PW_SPAMP_PW_MNG 00
ML_PW_LOUT_PW_MNG 00
ML_PW_ZCCMP_PW_MNG 02
ML_PW_MICBIAS_VOL 02
-ML_PW_MIC_IN_VOL 37
-ML_PW_MIC_BOST_VOL 10
+ML_PW_MIC_IN_VOL 10
+ML_PW_MIC_BOST_VOL 00
ML_PW_SPK_AMP_VOL 1b
-ML_PW_AMP_VOL_FUNC 01
+ML_PW_AMP_VOL_FUNC 03
ML_PW_AMP_VOL_FADE 00
ML_SPK_AMP_OUT 00
ML_MIC_IF_CTL 00
@@ -27,7 +27,7 @@
ML_SAI_TRANS_CTL 0b
ML_SAI_RCV_CTL 0b
ML_SAI_MODE_SEL 00
-ML_FILTER_EN 0f
+ML_FILTER_EN 00
ML_DVOL_CTL 2c
ML_MIXER_VOL_CTL 10
ML_RECORD_DIG_VOL ff




So I thinik , these difference make a stopping audio meter.

miyake

1% I'm restarting my camera every time.
The value is actual cannon firmware.

Another camera's register(AUDIO_SIG1) is added because , compile compatibility.
Dump definition is automatically generated by awk,sed. So never mind.

miyake

vol70% vs vol0%
--- AUDIOREG-normal.TXT 2012-07-26 10:01:34.000000000 +0900
+++ AUDIOREG-volume0.TXT        2012-07-26 10:47:46.000000000 +0900
@@ -7,19 +7,19 @@
ML_CLK_EN 0f
ML_CLK_CTL 04
ML_SW_RST 00
-ML_REC_PLYBAK_RUN 11
+ML_REC_PLYBAK_RUN 00
ML_MIC_TIM 12
ML_PW_REF_PW_MNG 06
-ML_PW_IN_PW_MNG 0a
+ML_PW_IN_PW_MNG 00
ML_PW_DAC_PW_MNG 00
ML_PW_SPAMP_PW_MNG 00
ML_PW_LOUT_PW_MNG 00
ML_PW_ZCCMP_PW_MNG 02
ML_PW_MICBIAS_VOL 02
-ML_PW_MIC_IN_VOL 3f
-ML_PW_MIC_BOST_VOL 10
+ML_PW_MIC_IN_VOL 10
+ML_PW_MIC_BOST_VOL 00
ML_PW_SPK_AMP_VOL 1b
-ML_PW_AMP_VOL_FUNC 01
+ML_PW_AMP_VOL_FUNC 03
ML_PW_AMP_VOL_FADE 00
ML_SPK_AMP_OUT 00
ML_MIC_IF_CTL 00
@@ -27,10 +27,10 @@
ML_SAI_TRANS_CTL 0b
ML_SAI_RCV_CTL 0b
ML_SAI_MODE_SEL 00
-ML_FILTER_EN 0f
-ML_DVOL_CTL 2e
-ML_MIXER_VOL_CTL 10
-ML_RECORD_DIG_VOL ff
+ML_FILTER_EN 00
+ML_DVOL_CTL 2c
+ML_MIXER_VOL_CTL 00
+ML_RECORD_DIG_VOL 00
ML_PLBAK_DIG_VOL ff
ML_DIGI_BOOST_VOL 00
ML_EQ_GAIN_BRAND0 dd
@@ -89,8 +89,8 @@
ML_OUTPUT_LOUT 00
ML_OUTPUT_SPOUT 06
ML_OUTPUT_LOUTON 00
-AUDIO_IC_SIG1 0a
-AUDIO_IC_SIG2 0a
+AUDIO_IC_SIG1 00
+AUDIO_IC_SIG2 00
AUDIO_IC_IVL 00
AUDIO_IC_IVR 00
AUDIO_IC_PM1 06


vol max vs vol 0
--- AUDIOREG-volmax.TXT 2012-07-26 10:19:16.000000000 +0900
+++ AUDIOREG-volume0.TXT        2012-07-26 10:47:46.000000000 +0900
@@ -30,7 +30,7 @@
ML_FILTER_EN 00
ML_DVOL_CTL 2c
ML_MIXER_VOL_CTL 00
-ML_RECORD_DIG_VOL ff
+ML_RECORD_DIG_VOL 00
ML_PLBAK_DIG_VOL ff
ML_DIGI_BOOST_VOL 00
ML_EQ_GAIN_BRAND0 dd


1%

So max is FF then?

That mixer is 10 but !!! when I power the amp up and leave it on one channel it is 01.. 00 is off I don't think you get sound but try some changes and see. I've done lots of things and haven't had a problem yet. Worst case you reload the "rest" register values.


Rec
13 11 - 13 12  /* Record/Playback Run */  ML_REC_PLYBAK_RUN

21 06 - 21 26 ML_PW_REF_PW_MNG /* MICBIAS */ /* Reference Power Management */
23 0a - 23 00 ML_PW_IN_PW_MNG /* ADC "Capture" + PGA */ /* Input Power Management */
25 00 - 25 02 ML_PW_DAC_PW_MNG /*DAC Power Switch? Playback */ /* DAC Power Management */
27 1f - 27 bf ML_PW_SPAMP_PW_MNG /* SP-AMP Power Management */


2f 02 - 2f 00 ML_PW_ZCCMP_PW_MNG /* ZC Switch */ /* AC-CMP Power Management */

33 3f - 33 30 ML_PW_MIC_IN_VOL /* MIC Input Volume */

39 00 - 39 30 ML_PW_MIC_BOST_VOL /* Mic Boost Volume */
3b 3f - 3b 2c ML_PW_SPK_AMP_VOL /* Speaker AMP Volume */

55 00 - 55 07 - 0111 ML_SPK_AMP_OUT /* DAC Switch + Line in loopback Switch + PGA Switch */ /* Speaker AMP Output Control */
57 01 - 57 03 unknown On/Off (play)

67 83 - 67 3f ML_FILTER_EN /* Filter Func Enable */ /*DC High Pass Fil
69 2c - 69 08 ML_DVOL_CTL /* Volume Control Func Enable */ /* Play Limiter + Capture Limiter + Digital Volume Fade Switch +Digital Switch */

6d ff - 6d f0 ML_RECORD_DIG_VOL /* Capture/Record Digital Volume */
6f cc - 6f ff Unknown Volume ?

75 dd - 75 d5 /* EQ Band0 Volume ?*/
77 dd - 77 f4 /* EQ Band1 Volume */
79 e7 - 79 f1 /* EQ Band2 Volume */
7b e7 - 7b f0 /* EQ Band3 Volume */
7d e7 - 7d 00 /* EQ Band4 Volume */

81 0d - 81 75 _Band 0 Controls
83 db - 83 2a
85 0c - 85 a1
87 1b - 87 95 _end Band 0

8d 41 - 8d 16  Band1
8f ed - 8f bd  Band1
91 00 - 91 46  start Band2
93 00 - 93 ea
95 00 - 95 9c
97 00 - 97 24 -endband 2
99 00 - 99 6d - start band 3
9b 00 - 9b 08
9d 00 - 9d ca
9f 00 - 9f db - Band 3 end

a9 00 - a9 5a Unknown from play filter

ad 00 - ad bd unknown play filter.

bb 70 - bb 00 ALC Min/max Volume

e1 01 - e1 02 Stereo Switch

miyake

I need to go out from here.
1% if you interested in this things. Please clone my repo. And try yourself.


I think, AUDIOREG-normal.txt is generated just startup.
My guess is, "It's not perfect initialization to common regesters yet"
When we touch recording,vol-change makes a first initialization will work.

How do you think about this?

1%

Logger is good. We'll know when the camera changes our registers back. Some of this is in firmware too.. you need to dump and analyze with arm console.

Problem is headphones and mic never run at the same time officially.

miyake

Quote from: miyake on July 25, 2012, 04:00:45 AM
I think, AUDIOREG-normal.txt is generated just startup.
My guess is, "It's not perfect initialization to common regesters yet"
When we touch recording,vol-change makes a first initialization will work.

My guess is correct !!!
Now 600D audio meter is not stop when finish recording!! and finished to change a volume from cannon menu
I'm rewrite a register value to startup's one  , when finished recording. then audio meter is always working.

Need more testers!Because I am setting reg under follow:
    audio_ic_write(ML_DVOL_CTL | 0x2E);
    audio_ic_write(ML_REC_PLYBAK_RUN | 0x11);
    audio_ic_write(ML_PW_IN_PW_MNG | 0x0a);
    audio_ic_write(ML_PW_MIC_IN_VOL | 0x3f);
    audio_ic_write(ML_PW_MIC_BOST_VOL | 0x10);
    audio_ic_write(ML_PW_AMP_VOL_FUNC | 0x01);
    audio_ic_write(ML_FILTER_EN | 0x0f);
    audio_ic_write(ML_MIXER_VOL_CTL | 0x10);


I guess it's volume setting is also back to this code's specific value.
But I don't know which one is it. Please help me to identify it.

Also 3 audio Property found and confirmed. I checked 0x2050001-0x205001F

https://bitbucket.org/miyake_t/magic-lantern-miyake/changeset/6c92e1942e54
My top priority is accomplished.

a1ex

This is huge progress!

At this point, audio remote shot should be fully working too.

miyake

@ alex

I think
Phase 1: always work audio meter
Phase 2: audio monitor


Now phase 1 is not perfect. If I found good solution. I will send a patch for this.

miyake

I Just push my repo.
I believe this logic is not so bad.

Then we need to find one more thing.

1: The audio register value is default(??) when 600d just launched
2: start recording or change vol, -> canon config value will write to audio IC
3: The audio switches on IC will power off when Stop recording or vol change finishd

3 is solved by my code.
But we don't know Actual audio setting in canon firmware. How can we know it?
when I understand it, I will change my reset_audio_setting() values.

miyake

Audio remote shot is work perfectly!    confirmed.

My wife is shouting in front of my 600D now :D

Alia5

great work!
Also i'm willing to test if needed

juantrueno

Canon 600D. Canon 18-135mm f 4/5.6 / 50mm f 1.8 / Yashica (Análogos) 28mm f 2.8 / 50mm f 1.4 / 135mm f 2.8
Vimeo.com/juantrueno youtube.com/juakinyan @JuanTrueno

1%

I had audio remote shot for a while now. You can just power the mic amp. Just nobody tried it, like everything else.


(ML_PW_IN_PW_MNG | 0x0a) < this is what does it.

(ML_REC_PLYBAK_RUN | 0x11); < rec mode is probably necessary too

You can also call powermicamp from firmware.


Try with external mic.



https://bitbucket.org/OtherOnePercent/tragic-lantern/changeset/c31c454fb9e3

miyake

great work 1%!!
I can't do this without your effort.Thank you very much

Anyway, currently the volume is back to just canon default value.
So I can't check audio level before recording , it is not good for me.(Just only work for audio remote shot )

one more analyzing needed.  and I hope we can use audio monitor .


---
external mic is working fine. Just switching ext mic only!!

miyake

Quote from: 1% on July 25, 2012, 05:23:58 PM
(ML_PW_IN_PW_MNG | 0x0a) < this is what does it.
I don't know too. It's no entry in alsa driver. But this reg  value is 0x0a when a camera just startup

Quote from: 1% on July 25, 2012, 05:23:58 PM
(ML_REC_PLYBAK_RUN | 0x11); < rec mode is probably necessary too
I see. But reason is same. I still not thing about this.

We need find best value in my reset_audio()



Quote from: 1% on July 25, 2012, 05:23:58 PM
You can also call powermicamp from firmware.
Try with external mic.
Why you need to change this?
I think I have no problem to change audio setting in cannon menu.

Also , I don't need both int/ext mic at same time. Do you wanna use both same time?

Let me know what is your objective.

1%

Yea the monitor is a bit harder. Need to feed it through the output mixer with amplification.

Volumes do mess with input levels and everything. Need to find all real values for volumes, some in those arrays I think are invalid.

Also alc is set while recording sometimes:

ML_ALC_MAXMIN_GAIN      0xbb00

rec vs play

bb 70 - bb 00 ALC Min/max Volume

Maybe get rid of canon's volume adjustment eventually since this even happened in manual mode.

1%

External for recording and internal for remote shot?

1%

I can confirm 0a is not default value for input power managment. Camera starts with no meter... I PTP

c 0xFF06A144 0x230a
and

c 0xFF06A144 0x1311 (or 13, hehehe)

Meter works

just setting rec mode does not. have to power the amp first (or after)


*** Maybe we just cut the function to those 2 settings, why set all the other stuff it just messes with things.

Also clone to stereo if you want afterwards for internal mic:

e1=02 - recording 1 channel
e1 = 01 recording 2 channels

miyake

Quote from: 1% on July 25, 2012, 05:42:29 PM
External for recording and internal for remote shot?

??? Are you asking my sentence about "you need to use both"????


1%

Yes, far mic to record audio.. close mic to start recording with the clapper, etc. That way we actually have a use for the internal.

:( post rate limits

miyake

Quote from: 1% on July 25, 2012, 05:53:53 PM
I can confirm 0a is not default value for input power managment. Camera starts with no meter... I PTP
c 0xFF06A144 0x230a
and
c 0xFF06A144 0x1311 (or 13, hehehe)
Meter works


hmmmm, mysterious thing. My camera is 0x230a ,, and meter is working from startup....
startup register values has a more mysterious thins.

One more thing:
You already direct set/get memory value by PTP.  But I just added audio_ic_read/write code in php-chdk.c
I'm not write a PC side yet.

miyake

Quote from: 1% on July 25, 2012, 06:07:19 PM
Yes, far mic to record audio.. close mic to start recording with the clapper, etc. That way we actually have a use for the internal.

:( post rate limits

Ah, I see. but now, AUDIO_SIG1,2 is only multiplexed output, It's my understanding.
Do you know how to get audio signal level separately with int/ext?

1%

Yep, already called it by address to test it. Mostly works. Reading values does not though.


You are probably powering mic at start with

#define AUDIO_IC_SIG2   0x2300... old audio.c always writes here.

Those old registers are 100% incompatible with old audio.c... the meters work because they are from canon internal functions. 100% nothing to do with signal level, forget that old code.

Switching mic type and mic input puts different mic on different channel. Once you understand routing you can route internal to L, external to R or whatever and then move to external completely just before recording starts.

*Bootleg version of above already possible with 

audio_ic_write( ML_MIC_SELECT | pm3[input_source] );
   audio_ic_write( ML_MIC_IF_CTL | micbits[type_source] )

*edit

sound_dev_task is NOT present on 600D... there is a sound device task but it looks like it sets buffers only. other stuff prepares audio, sets gain, etc.

miyake

@1%

done, menu inserted now. But menu handling functions are not working now.

and Good night!