How to use vlc equalizer in python

Question:

I am using vlc in python for a small internet radio player
I have a problem when i try to set the equalizer for audio output

   Instance = vlc.Instance()
    player = Instance.media_player_new()
    radiourl = radios[0][1] # setting the radio streaming url
    Media = Instance.media_new(radiourl)
    player.set_media(Media)
    player.audio_set_volume(playvol) 

    # Create a new equalizer and manually set the gain for each frequency band
    equalizer = vlc.AudioEqualizer()
    equalizer.set_amp_at_index(0, 0)  # 60 Hz
    equalizer.set_amp_at_index(1, 0)  # 170 Hz
    equalizer.set_amp_at_index(2, 0)  # 310 Hz
    equalizer.set_amp_at_index(3, 0)  # 600 Hz
    equalizer.set_amp_at_index(4, 0)  # 1 kHz
    equalizer.set_amp_at_index(5, 0)  # 3 kHz
    equalizer.set_amp_at_index(6, 0)  # 6 kHz
    equalizer.set_amp_at_index(7, 0)  # 12 kHz

    # Set the equalizer for the audio output
    player.audio_set_equalizer(equalizer)

`

i keep getting the following error message

AttributeError: ‘MediaPlayer’ object has no attribute ‘audio_set_equalizer’

I tried looking at the Olivier Aubert wiki for vlc but, being relatively new to python I am simply not understanding how to fix this.

I am sure i am setting the equalizer wrong but, as I said, being a rookie coder in python, I have no clue on why the audio_set_equalizer is not a valid object for the vlc.instance

Thanks in advance!

Asked By: qeimair

||

Answers:

Looking at this list of identifiers, it doesn’t look like there’s an audio_set_equalizer method for the MediaPlayer class.

You might be looking for this instead?

Try changing your code to this:

 # Set the equalizer for the audio output
    player.set_equalizer(equalizer)
Answered By: todundsteuern
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.