Draw audio levels script

  • 22 Replies
  • 4498 Views
*

Offline funnel

  • ****
  • 349
Draw audio levels script
« on: 08 / April / 2012, 07:50:03 »
Advertisements
Hi.

I just want to share this cool script I made. It displays the audio levels while video recording using lua drawings.

It was tested only on sx220. It gets the sound data from two digic audio registers 0xC0920110 and 0xC0920114. I looked at few firmwares and appears that all cameras use the same address.

To run it you start the script, exit alt mode and start recording or edit the script to start it automatically.

EDIT: Updated script.
« Last Edit: 09 / April / 2012, 04:40:18 by funnel »

*

Offline msl

  • *****
  • 1235
  • A720 IS, SX220 HS 1.01a
    • CHDK inside
Re: Draw audio levels script
« Reply #1 on: 08 / April / 2012, 08:20:26 »
Very nice - works fine for me!

You are the hero of the CHDK video functions - HDR video, fps control and now the audio level.  :)

Is there a chance, to control the audio level?

msl
German CHDK pages:  CHDK forum | CHDK inside | CHDK Twitter News by msl | Download CHDK-DE (Autobuild)
Note: SDM violates the GPL rules!

*

Offline funnel

  • ****
  • 349
Re: Draw audio levels script
« Reply #2 on: 08 / April / 2012, 08:40:07 »
Quote
Is there a chance, to control the audio level?

I don't know yet. I have already looked into that and it's complicated. Maybe in the future we figure it out.

*

Offline srsa_4c

  • ******
  • 3654
Re: Draw audio levels script
« Reply #3 on: 08 / April / 2012, 09:02:47 »
Nice work, again.

I think - since the 0xc092xxxx range is ASIO - that this method will only work for models with an audio chip that also does A/D and D/A conversion. Low-end models use the DIGIC's own A/D capability, their audio IC only does lowpass filtering and level control.
I guess all models that can record audio with a sample rate over 11025Hz use external A/D.

Quote
Is there a chance, to control the audio level?
AFAIK all p&s models lack manual control over audio level. That means the audio interface chip is set up to do ALC (automatic level control). There may be a chance to override this (in the future), but it will be hardware-dependent.

Edit:
I was wrong, some higher end P&S models do offer some manual audio level control.
« Last Edit: 09 / April / 2012, 11:47:32 by srsa_4c »


Re: Draw audio levels script
« Reply #4 on: 08 / April / 2012, 12:54:02 »
That's great idea! I was searching the audio levels in memory but never found them.

This thing would be nice to add to the source - could be an option in OSD menu "show audio levels while recording". I find this very usefull. In some cases it could be even more usefull for video than histogram.

I could play with implementing that...

BTW - I have used this and it works on sx130IS. But why when I checked these adresses in memory browser while recording a video it sais 'Invalid adress' ?
« Last Edit: 08 / April / 2012, 13:01:47 by outslider »
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

*

Offline philmoz

  • *****
  • 3070
    • Photos
Re: Draw audio levels script
« Reply #5 on: 08 / April / 2012, 18:06:03 »
BTW - I have used this and it works on sx130IS. But why when I checked these adresses in memory browser while recording a video it sais 'Invalid adress' ?

The camera will crash if you try an access memory outside the firmware, RAM or IO areas.
The memory browser code only knows where the firmware and RAM address ranges are (from the values in sub/firmware/makefile.inc), so IO is treated as invalid.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)

Re: Draw audio levels script
« Reply #6 on: 08 / April / 2012, 23:45:51 »
it dont work on the SX40hs....

 ???
no errors or nothing.... it just does nothing.

Re: Draw audio levels script
« Reply #7 on: 09 / April / 2012, 04:14:49 »
Does it have 'video' button? Since this script uses that. For sx130 I have changed click("video") to click("shoot_full"). However to use this script I had to follow the first way that funnel showed:

-run the script
-turn off the ALT mode
-start video recording.

Hope this helps:)
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick


*

Offline funnel

  • ****
  • 349
Re: Draw audio levels script
« Reply #8 on: 09 / April / 2012, 04:49:21 »
Updated script.

-starts recording automatically
-fixed the disappearing of bars
-fixed a mistake choosing the screen width. Now 480 draws correctly to the end of the screen.

*

Offline philmoz

  • *****
  • 3070
    • Photos
Re: Draw audio levels script
« Reply #9 on: 09 / April / 2012, 06:02:20 »
it dont work on the SX40hs....

 ???
no errors or nothing.... it just does nothing.


Works fine on my SX40HS.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)

 

Related Topics