0

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!

qeimair
  • 13
  • 4
  • Please remember to explain which packages you're using. And not just by name, but include where you installed them from. – Mike 'Pomax' Kamermans Apr 01 '23 at 00:07
  • You are right,sorry. I am using Python 3.9.4 and VLC module version: 3.0.16120 – qeimair Apr 01 '23 at 00:22
  • [in your post, please](/help/how-to-ask). Not as a comment. And again, please make it clear _where_ you got that package from (i.e. did you install it with pip? if so, remember to mention the exact pip install command. Different tool? Same deal, mention what you ran to install it). – Mike 'Pomax' Kamermans Apr 01 '23 at 00:26

1 Answers1

0

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)