How to get audio in decibels - python

I'm writing a script that will automatically adjust the audio levels of a program, So I need a way to get audio levels in python. I've looked online for libs to help with this but I was unable to find anything

Related

Is there a way to play a specific tone using python3?

I'm working on a python3 project (in PyCharm, using Windows 10) and I'm trying to play a series of tones and save them all to a mp3 file.
I can get it to play a series of notes with winsound:
import winsound
while True:
winsound.Beep(1000, 1000)
But I can't save it.
All help appreciated!
If you want to save output to a file, rather than just play it, probably the most ideal way of doing this is to generate midi files. There are a few packages that can help you create midi files in a similar way.
This example uses the package called mido
from mido import Message, MidiFile, MidiTrack
mid = MidiFile()
track = MidiTrack()
mid.tracks.append(track)
track.append(Message('note_on', note=64, velocity=64, time=32))
mid.save('new_song.mid')
You can convert midi files to MP3s easily if needed (many programs or even online tools can do this) although, midi files are generally well-supported in most applications.
See also
Although perhaps dated, you can also check the PythonInMusic wiki for references to more MIDI and other audio libraries.
Alternatively, you can use a separate program to record your audio output when running your python script using winsound.

Sound Decibel Output Python

I have tried using soundmeter for this specific issue, however, did not really find a way to do it so. I want to get the current PC microphone input, and as an output to get the Decibel of the sound that is recorded by my integrated microphone. Any other libraries that you can suggest? Searched a lot, but did not really find something useful.

Can i monitor the system audio on windows and possibly analyze it?

I'm making a chat moderation bot for a friend who streams on twitch.tv and I would like it to perform certain actions when the audio gets to a high level. It would also be incredibly useful to analyze the system audio and compare it to predefined audio files. Is any of this possible, and do libraries exist for this?
The ossaudiodev library might be able to provide the functionality that you need.
https://docs.python.org/2/library/ossaudiodev.html
Specifically, the oss_mixer_device.get function returns the volume of a certain mixer control.

Python Intercepting/reading audio output level in python/linux

I'm trying to write something that catches the audio being played to the speakers/headphones/soundcard and see whether it is playing and what the longest silence is. This is to test an application that is being executed and to see if it stops playing audio after a certain point, as such i don't actually need to really know what the audio itself is, just whether or not there is audio playing.
I need this to be fully programmatic (so not requiring the use of GUI tools or the like, to set up an environment). I know applications like projectM do this, I just can't for the life of me find anything anywhere that denotes how.
An audio level meter would also work for this, as would ossiliscope data or the like, really would take any recommendation.
Here is a very similar question: record output sound in python
You could try to route your output to a new device with jack and record this with portaudio. There are Python Bindings for portaudio called pyaudio and for jack called PyJack. I have never used the latter one but pyaudio works great.

How can I analyze sound output in Python?

Is it possible to get the system output audio (the exact same thing that goes through the speakers) and analyze it in real time with Python? My intention is to build a sound visualizer. I know that it is possible to access the microphone with pyaudio, but I was not able to access the sound card output in any way, I'm looking for a solution that works on Windows.
Thank you for reading.
Not sure how this project is doing these days, it's been a long time since it's been updated. PyVST allows you to run python code in a VST inside a VST host, which makes it possible to handle realtime audio events.
You might want to look at http://code.google.com/p/pyo/ for some ideas about how to handle DSP data as well.

Categories

Resources