save the Meter Toolbars level value in a text file

Hello,
do you know how to save the Meter Toolbars level value in a text file ?
or have access to this value using a python program ?
perhaps with mod-script-pipe?
thank you.

I don’t think there’s a way of doing that but if you are recording (or if you already have a file) the file contains all of that information.

What information do you need? There are tools for finding the peak, RMS, or “loudness”. There is a quick trick to find the peak… If you run the Amplify effect it will indirectly tell you the maximum. Audacity has already pre-scanned your file and the Amplify effect will default to whatever gain is needed for 0dB peaks. So for example, if Amplify defaults to +3dB your peaks are currently -3dB.

thank you for your reply. I want to get the decibel level in real time. For example when playing a video on youtube, my python program sends an instruction to AUDACITY. I made a robot that is able to move its lips to simulate human speech. I would like to make it move according to the sound of the Youtube videos. For the moment I have made a sensor connected to a speaker, but I would like to remove my device to capture the sound level directly in Audity live of all the sounds passing through my computer. [Advert removed]

Audacity is primarily designed for “off-line” (non-real time) use. There is currently very little “real-time” ability in Audacity.

Audacity does not provide an API for the meters.


Perhaps you could use PyAudio to capture the audio stream, avoiding the need for Audacity.
I found this example that may be useful: Python script for a VU meter using a Raspberry Pi · GitHub

but I would like to remove my device to capture the sound level directly in Audity live of all the ysounds passing through my computer.

I’ve never used Python (and I’ve never actually done any audio programming) but that should be possible (without Audacity). But then the information has to be sent to the robot somehow…

If you’re not familiar with how digital audio works see [u]Digital Audio Fundamentals[/u]. The file* or audio stream is simply a sequence of amplitude samples. Of course the sample values change too fast for mouth movement but can find the peaks, or take a moving-average of the peaks or a moving average of the positive or absolute values. (The “normal” average is zero since half of the samples are positive and half are negative.)


For the moment I have made a sensor connected to a speaker

You mean a microphone picking-up sound? You can do the same thing with the electrical signal to the amplifier or speaker. There is a circuit called a “peak detector” or “envelope follower” that puts-out varying DC voltage that represents the loudness, similar to what you can do by averaging in software. I’ve made some sound activated lighting effects and I use a peak detector with line-level audio signals to read the moment-to-moment loudness.


\

  • Of course, compressed files have to be decoded to get the sample values. And, uncompressed files may have to be scaled depending on the bit depth (24-bit files have bigger “numbers” than 16-bit files) but Python probably has libraries to handle all of that.

Thank you for your answer and the time spent. Yes my old robot worked with an Arduino Nano microcontroller which captured the voltage at the speaker output, it worked very well. But now I want to make holographic robots, with 3D bodies.
I know PyAudio which I currently use to move the lips of my 3D robot according to the live sound from the PC. I just wanted to know if it was possible to use Audacity as another way, because it seems to me that there is less latency than with PYAudio .