DenonAVR Select Sound Mode help

@slemson I see your confusion.
The problem is that the sound modes that are available are dependent on the sound input the receiver gets.

For instance the sound mode “DOLBY TRUEHD” is only available when the receiver is currently playing a Dolby TrueHD encoded surround sound, but cannot be selected when the iput is a simple stereo stream. When the receiver is getting a surround sound source that contains the same amount or more audio channels than you have set up (for instance the source is Dolby TrueHD 7.1 when you only have a 5.1 setup) the sound mode will be fixed to whatever the input is and it is not possible to set the sound mode (in this case it will be Dolby TrueHD), this is also the case when you use the remote of your receiver.

Therefore setting the sound mode is only usefull when the input to your receiver contains less channels than your setup (aka a stereo 2.0 input while you have a 5.1 setup). Your receiver then needs to artificially utilize the other 3 speakers and subwoofer using a sound mode.

Unfortunately the API of Denon/Marantz does not allow to simply provide the exact sound mode you want, all available sound mode commands that I know off have been implemented and are acessible in the frontend of HomeAssistant.
Presuming you have a stereo input and a 5.1 setup the following will apply:

  • ‘MUSIC’, ‘MOVIE’ and ‘GAME’ will put the receiver in the last sound mode you selected for the music, movie or game sound mode button on your remote of your receiver.
  • ‘STEREO’ will put the receiver to stereo sound mode
  • ‘MCH STEREO’ will put the receiver to ‘MULTI CH STEREO’ sound mode.
  • ‘VIRTUAL’ will put the receiver to 'VIRTUAL’ sound mode.
  • ‘PURE DIRECT’ will put the receiver to ‘PURE DIRECT’ sound mode.
  • ‘DTS SURROUND’ will put the receiver to ‘DTS NEO:6 MUSIC’, ‘DTS NEO:6 CINEMA’ or ‘DOLBY D +NEO:X G’ depending on the last selected ‘MUSIC’, ‘MOVIE’ or ‘GAME’ command. Therefore issuing first ‘MOVIE’ command and then ‘DTS SURROUND’ schould put it to ‘DTS NEO:6 CINEMA’.
  • ‘DOLBY DIGITAL’ will put the receiver to ‘PLII MUSIC’, ‘PLII MOVIE’ or ‘PLII GAME’ depending on the last selected ‘MUSIC’, ‘MOVIE’ or ‘GAME’ command. Therefore issuing first ‘MOVIE’ command and then ‘DOLBY DIGITAL’ schould put it to ‘PLII MOVIE’.

Personally I have a Marantz SR5008 and that does not support “DTS Neural:X”, so I do not know which combination of commands you would need to get it in that mode.
Bellow is the complete sound mode structure currently supported by HomeAssistant, the keys in the dict are the commands and the values are the sound modes as reported by the receiver.

SOUND_MODE_MAPPING = OrderedDict(
    [('MUSIC', ['PLII MUSIC', 'DTS NEO:6 MUSIC', 'DOLBY D +NEO:X M',
                'ROCK ARENA', 'JAZZ CLUB', 'MATRIX']),
     ('MOVIE', ['PLII MOVIE', 'PLII CINEMA', 'DTS NEO:X CINEMA',
                'DTS NEO:6 CINEMA', 'DOLBY D +NEO:X C', 'MONO MOVIE',
                'PLIIX CINEMA']),
     ('GAME', ['PLII GAME', 'DOLBY D +NEO:X G', 'VIDEO GAME']),
     ('AUTO', ['None']),
     ('VIRTUAL', ['VIRTUAL']),
     ('PURE DIRECT', ['DIRECT', 'PURE_DIRECT', 'PURE DIRECT']),
     ('DOLBY DIGITAL', ['DOLBY DIGITAL', 'DOLBY D + DOLBY SURROUND',
                        'DOLBY DIGITAL +', 'STANDARD(DOLBY)', 'DOLBY SURROUND',
                        'DOLBY D + +DOLBY SURROUND', 'NEURAL', 'DOLBY HD',
                        'MULTI IN + NEURAL:X', 'DOLBY D + NEURAL:X',
                        'DOLBY DIGITAL + NEURAL:X',
                        'DOLBY DIGITAL + + NEURAL:X', 'DOLBY ATMOS',
                        'DOLBY AUDIO - DOLBY SURROUND', 'DOLBY TRUEHD']),
     ('DTS SURROUND', ['DTS SURROUND', 'DTS NEURAL:X', 'STANDARD(DTS)',
                       'DTS + NEURAL:X', 'MULTI CH IN', 'DTS-HD MSTR',
                       'DTS VIRTUAL:X']),
     ('MCH STEREO', ['MULTI CH STEREO', 'MULTI_CH_STEREO', 'MCH STEREO']),
     ('STEREO', ['STEREO']),
     (ALL_ZONE_STEREO, [ALL_ZONE_STEREO])])
1 Like

Here is one of the documentation documents about the Marantz API.

It lookes like their is a “NEURAL” command, could you try:

{
  "entity_id": "media_player.theater_receiver", "sound_mode":"NEURAL"
}

If that does not work, could you open a webbrowser and go to the following “webpage”:
“192.168.1.???/goform/formiPhoneAppDirect.xml?MSNEURAL”
where 192.168.1.??? schould be the IP-adress of your receiver.
oppon “opening” that webpage your receiver schould switch its sound mode to “DTS Neural:X”.

@starkillerOG thanks so much for the speedy and thorough reply. It was an unlock for me.

I did some serious testing and I wanted to post some of those findings for posterity as I know someone will come looking here at some point. For clarity, I own a Denon AVR-X4500H in a Dolby Atmos configuration (11 speakers + 2 subs). That’s noteworthy because this unit will automatically limit which sound modes are available depending on how many speakers you have connected. You should refer to your owner’s manual because the “rules” are complicated and take Denon nine different footnotes and three tables to explain.

So back to the DenonAVR component. For terminology in this thread, let’s call the “Movie”, “Music”, “Game”, and “Pure” buttons “Categories” and the actual modes (i.e. DTS Neural:X) “Sound Modes”.

Some Sound Modes are available to only some Categories. Denon publishes a table in the owners manual (for my unit, it’s on Pages 146-148) that will tell you which Sound Modes are available to which Categories.

Think of the Categories this way. Denon knows there are a lot of Sound Modes and they’re trying to help you choose one most suitable to what you’re listening to on the receiver. The Categories help to limit the list when you’re browsing through them on the receiver’s tiny display. But the actual list of Sound Modes is accessible directly if you don’t care which category they’re in and I suspect that since many of us are building our own UI’s in HA, we don’t really need the Categories, per se.

The DenonAVR component will allow you to change either the Category or the Sound Mode using the same service call with some quirky caveats which I’ll explain below.

If you send "sound_mode":"MOVIE" (case matters)
The unit will act as if you pressed that category’s button and switch the unit to whatever Sound Mode it was in last time you used the Movie button (Note: Repeatedly sending “MOVIE” will not cycle through the different Sound Modes for Movie the way the actual remote works). If all you want to do is simulate the press of one of the category buttons, you’re done. If you’re using lots of different Sound Modes like I am, you’ll want more control so read on.

Some of sound_modes just work when you call them. For example, if you pass "Sound Mode":"STEREO", the receiver will switch to Stereo. It will also automatically switch the Category to the first one that supports Stereo (“Movie”, seems to be what’s happening in my case).

SOME of the Sound Modes, when called directly, will tell you the service call failed, but the command will execute and the receiver will change to that mode. In my setup, those that behaved this way were:

  • “MONO MOVIE”
  • “MATRIX”
  • “ROCK ARENA”
  • “JAZZ CLUB”
  • “DIRECT”
    I’m assuming this is a bug but if you can ignore the Failure message, the receiver is changing. Perhaps @starkillerOG can take a look to see if there’s a way to improve that. I’m not a developer so I can’t contribute beyond this explanation.

I’m attaching a table I made of the sound_modes to which one they map to as well as which ones are causing the service to fail while actually working. I’m sure I’m missing something. Everything you just read came from experimenting with my own setup. YMMV. I hope this was helpful.

This thread is excellent for someone like me who had given up hope of ever understanding my Marantz. It is an SR5009, so probably similar to the 5008.

For anyone interested, here is how my UI looks and how I used this info. Each button changes the sound mode which is reflected using a state_image to swap the button with the “active” version like this:

ui-lovelace.yaml

    - type: image
      image: /local/interface_images/theater/dolby_surround.png
      entity: sensor.denon_sound_mode
      state_image:
       "Dolby Surround": /local/interface_images/theater/dolby_surround_sel.png
      style:
        left: 50%
        top: 60.5%
        width: 14%
      tap_action:
        action: call-service
        service: media_player.select_sound_mode
        service_data:
          entity_id: media_player.theater_receiver
          sound_mode: DOLBY DIGITAL

and also swaps a picture of the outputs that are active like this:

    - type: image # Output Indicators
      entity: sensor.denon_sound_mode
      image: /local/interface_images/theater/output_all_off.png
      state_image:
        "Stereo": /local/interface_images/theater/output_f.png
        "Dolby Surround": /local/interface_images/theater/output_all_on.png
        "DTS Neural:X": /local/interface_images/theater/output_all_on.png
        "Multi Ch Stereo": /local/interface_images/theater/output_f_c_s_sb.png
        "Rock Arena": /local/interface_images/theater/output_f_c_s_sb.png
        "Jazz Club": /local/interface_images/theater/output_f_c_s_sb.png
      tap_action: none
      style:
        left: 66%
        top: 35%
        width: 20%

Still want to replace those volume buttons but it’s late and I need sleep. Power button works too and I have a slider at the top for more drastic volume changes. Getting the volume controls working with Node-Red was a huge battle for another thread. I will also add a mute button somewhere.

1 Like

@slemson I just made a Pull Request to Denonavr library: https://github.com/scarface-4711/denonavr/pull/90

Could you please test this code and see if it works on your receiver?
(are you an Hassbian or which platform?)

Could you also test if the “NEURAL” and “STANDARD” commands do something?
According to the API documentation those schould work (have not included them in the PR because I first want to know if they change the sound mode on the receiver).

Very nice and clear post, could not have explained it any better!
And your custom lovelace pannel looks awesome!

Ok you’ll have to hold my hand a bit with Github because I’m a noob. How do I pull down the code you have in PR 90 to test on my system?

@slemson On what kind of install are you: Hassbian, Hass.io or Docker?

Hass.io over here

Alright, I do not think it is possible to pull down delepment code on Hass.io.
So I will test on my system if it does not give any errors and then you just need to wait untill it gets merged to HomeAssistant. Wil probably take about 4 weeks (first merge in denonavr, then merge in HomeAssistant dev and then finally into HomeAssistant release)

@slemson Did you already tried this?
(You can just use the “media_player.select_sound_mode” service)

NEURAL gives me a service error and nothing changes.
STANDARD gives me a service error BUT the receiver changes to DTS Neural:X

Hope that’s helping!

Thanks for the feedback, I have included it in the PR and I have tested it myself and it does not produce errors. Will ask to merge it.

Just found this post…im new to HA, is thre more info on how to get this to work?

turn your denon on, and goto developer tools → states and find the entity, it will show a list of available sound modes

then, use something like this in an automation, or button

service: media_player.select_sound_mode
    data:
      sound_mode: DIRECT
    target:
      entity_id: media_player.denon_avr_x3700h

Thanks you, I get some results.

In my quoted post there is a sensor.denon…
To show pictures of the active speakers. I like then idea. I would love to build something like the denon android app which shows audio codec and active speakers.
Can I just do some thing like

If sound_mode = stereo
Than show xy.jpg

Still figuring out all the amazing HA stuff.

I would be most happy, if this project will get the attention, it deserves.

It looks fabulous, just it does not work wel with my Denon. :frowning:

Why not just write automations for all your inputs.

The Denon already supports auto switching inputs. But you can make the Denon switch to an input based off of other HA sensors for your input devices.

For example, I have automations for my shield and echo link, and smart blue ray player.

When my echo link starts playing music it automatically turns on the Denon x3700h, changes input, changes to stereo(direct), and sets the volume to 50.

When my blue ray turns on it sets the input to blue ray, sets the Denon sound mode to Dolby.

When my shield turns on it sets the input to shield, sound mode to Dolby, and my dashboard displays all the shield apps to launch(Plex/Netflix/Disney+/Amazon video/Hulu). And when the shield is in a specific app it displays the navigation, say for Plex my libraries, and the ability to browse my libraries and start playing something.

That card is nice, but doesn’t seem practical unless you have a dedicated theater tablet, even then the card won’t do anything to actually power on your inputs, or give you the ability to set the media to be played from those inputs. I think you’d be better off building a dynamic dashboard and automations around your specific theater and content you watch.

I turn my kodi player on and the av receiver turns on and patches thru the kodi input to the tv.

So maybe the answer is to control the media player, and the av will follow.

1 Like