Internal 7.1 audio soundcard

Hi everyone,

I’m new to the openHAB community and I’m happy to take part to this adventure.
First question of beginner, I installed openHAB on a windows computer that has a 7.1 internal audio card. I managed to play a sound from OH but now I would like to be able to specify the precise output of my card.

For example :
playSound (“front_right_output”, “doorbell.mp3”)

Would anyone have a solution ?

Thank you infinitely for your help!

  • Platform information:
    • Hardware: amd64 / 2Go Ram / Realtek soundcard
    • OS: Win7 Pro
    • Java Runtime Environment: Java JRE 8 + JDK 8
    • openHAB version: 2.2.0

I don’t think that is possible, I am afraid

Would it be possible use something like Audacity to create spatialised 7.1 Wavs that only have the doorbell sound on the correct channel?

On this setting in the PaperUI you specify to use the system speaker. If you have configured your sound card as the system speaker and you can use audacity to create an mp3 to play on 7.1 system then please try it. I would like to know if it works.

From recollection, standard mp3 files only have stereo channels. I dont know if openhab would play the extended formats needed for 7.1 mp3.

Getting the spatialised sound file is the first step. Trying different formats to save it in that would be supported by openhab would be next!

Hi everybody,

Thank you for your opinion and advice.
I created a mp3 and a wav sound in 5.1. No problem to read with windows media player that spatially the sound correctly. On the other hand, it was impossible for me to read it via openHAB. What a pity !
The idea is good, I don’t know exactly where it blocks…

Could you play the wav from the command line?

When I play a wav sound (from the command line or from the ui), I have a larsen that occurs but no sound.

I may have misexplained. Can you play the sound from the windows cmd.exe prompt. If you can, you could initiate the sound via an exec call.

I tried this command: start C: \ Server \ conf \ sounds \ “sample.mp3”
This opens windows media player (small latency due to opening) and reads the 5.1 file correctly.
How do I add this command inside my rules file ?
This is a first solution that helps, however, impossible to read several sounds simultaneously with this technique. I will continue to search.

Im not near a windows box to test. There are ways to play wavs from the commandline that dont require media player to load. This link might help or there may be other utilities. This may reduce the latency.

Ive seen other topics that talk about executing shell commands from rules. I cant search at this point but may get a chance later

Indeed, it’s a post that I had watched but it explains precisely how to play a sound via windows media player triggered from a command line. I will continue to search and test !

I found a small program that plays mp3 from command line without opening any window. See cmdmp3 .
I tried in a Windows 7 machine it and it plays mp3 from the windows command line. :

c:\>cmdmp3win.exe file_to_play.mp3

You can have a go and test if it works with the exec call from openHab.
Have fun :slight_smile:

1 Like

Very interesting!

Unfortunately, the program is limited to stereo mp3 files and not 7.1 surround files and doesn’t allow multiple simultaneous plays.

It seems impossible to read different music via openhab on each output of my sound card.

I’ll look at the bluetooth speakers or squeezebox speakers but I’m not convinced. What I would like is being able to have the choice to play different music in every room of my house or to listen to the same music throughout the house by controlling all this since openhab.
Unfortunately, I don’t have the budget for sonos, yamaha or other expensive products of this type.

If thats what you want to do, you could do worse than look at logitech media server and the squeezebox binding. This allows individual or whole house music control from openhab (or various other remotes).

Max2play offers a very easy to set up sqeezebox on any raspberry pi - you dont need the latest 3B+. If you pair them with cheap amplified speakers then the total cost per room isnt a lot. With better speakers or some of the DAC hats you can create some pretty high quality streaming players.