Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Hybrid View

  1. #1
    Junior Member
    Join Date
    Apr 2019
    Posts
    10

    Streaming WAV files to LMS over http question

    Hi All,

    I'm not sure this question is in the right place, but as best as I can tell, this is a general question.

    I recently set up a LMS server, and I love it. I use OpenHAB for home automation, and have run into a curious situation that I'm hoping someone here can help with.

    OpenHAB as a binding for supporting squeezelite players. It works well for controlling the system and playing anything that's on LMS. However, it also has the option to set a squeezlite player as an audio sink. This is very useful in my situation as I can have LMS stream audio over my entire home and OpenHAB can interrupt the audio and broadcast a message as needed (ie, "someone is at the door") and then resume the stream. Great system. However, when the broadcast is in WAV format, LMS just pauses the stream with no audio output. No problem with MP3, FLAC, or other formats. Since I'd like to have the automation system utilize text-to-speech, and that forces WAV files to be produced, it renders the system unusable. If these files are already in LMS as WAV files, there's no problem. It has something to do with sending the WAV files over http for transcoding.

    I have had a Home Assistant automation system user confirms this happens with Home Assistant as well, so it's not just an OpenHAB problem.

    In a perfect world, I'd have a text-to-speech system (in this case, Pico TTS) read a file and output the stream in WAV to the appropriate squeezelite player. However, I'm not sure what's happening in the stream that's causing this. I'm hoping someone here can point me in the right direction to find a reasonable solution to this situation. Any help is appreciated.

  2. #2
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    1,879
    Can you provide some more info about how the file/stream is passed to LMS?
    Paul Webster
    http://dabdig.blogspot.com
    Author Radio France (FIP etc) plugin

  3. #3
    Junior Member
    Join Date
    Apr 2019
    Posts
    10
    Hi Paul,

    It's not long before I'm out of my depth here, but in brief, it's via the Eclipse Smarthome Java console, Karaf in OpenHAB, and directly via Python (or I'm led to believe), in Home Assistant (I have no direct experience with Home Assistant). In both cases (very different automation systems), all file types except WAV seem to work. I can verify this directly with sending MP3 files in OpenHAB that work as anticipated. When WAV files are sent, the UI on LMS show a "Notification" and play no audio at all (though after the duration of the wav file sent has expired, whatever audio was playing before resumes). In the same case with an MP3, the "Notification" shows up and audio is output as expected (then whatever was streaming before streams as usual).

    The best I can probably offer are some links to the github files that process the audio for OpenHAB. I'm more than happy to find out more to help you, but I'm not even sure what you may need at this point.

    FWIW, if I stream the same audio directly to ALSA audio output, it works. The issue seems to be entirely bound to sending WAV to LMS for processing.

    Link to Github OpenHAB Audio.java class

  4. #4
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    17,906
    Quote Originally Posted by RipNCode View Post
    However, when the broadcast is in WAV format, LMS just pauses the stream with no audio output. No problem with MP3, FLAC, or other formats.
    LMS doesn't recognise the stream and IIRC streamign WAV is not part of standard distribution as there is no "de-facto" standard for streaming WAV so for your stream a new audio type and associated handler may be required.

    First, LMS needs info to determine the audio format. This info is usually in the Mime of the stream in the HTTP Content-Type header.
    Examples

    MP3 audio/mpeg,audio/mp3,audio/mp3s,audio/x-mpeg,audio/mpeg3,audio/mpg
    AAC over ADTS audio/aac,audio/aacp
    AAC over MPEG4 audio/m4a,audio/x-m4a,audio/mp4

  5. #5
    Junior Member
    Join Date
    Apr 2019
    Posts
    10
    Quote Originally Posted by bpa View Post
    LMS doesn't recognise the stream and IIRC streamign WAV is not part of standard distribution as there is no "de-facto" standard for streaming WAV so for your stream a new audio type and associated handler may be required.

    First, LMS needs info to determine the audio format. This info is usually in the Mime of the stream in the HTTP Content-Type header.
    Examples

    MP3 audio/mpeg,audio/mp3,audio/mp3s,audio/x-mpeg,audio/mpeg3,audio/mpg
    AAC over ADTS audio/aac,audio/aacp
    AAC over MPEG4 audio/m4a,audio/x-m4a,audio/mp4
    Thanks, bpa. That helps a lot. It's probably the core of what's wrong. I assume LMS would probably need an appropriate plug-in that allows it to recognize the correctly defined audio type?

    Sorry for the newbie questions, but I'm still getting a handle on this...

  6. #6
    Junior Member
    Join Date
    Apr 2019
    Posts
    10
    I also replied to Paul, but the post didn't show up. I pasted it below for reference.

    Hi Paul,

    It's not long before I'm out of my depth here, but in brief, it's via the Eclipse Smarthome Java console, Karaf in OpenHAB, and directly via Python (or I'm led to believe), in Home Assistant (I have no direct experience with Home Assistant). In both cases (very different automation systems), all file types except WAV seem to work. I can verify this directly with sending MP3 files in OpenHAB that work as anticipated. When WAV files are sent, the UI on LMS show a "Notification" and play no audio at all (though after the duration of the wav file sent has expired, whatever audio was playing before resumes). In the same case with an MP3, the "Notification" shows up and audio is output as expected (then whatever was streaming before streams as usual).

    The best I can probably offer are some links to the github files that process the audio for OpenHAB. I'm more than happy to find out more to help you, but I'm not even sure what you may need at this point.

    FWIW, if I stream the same audio directly to ALSA audio output, it works. The issue seems to be entirely bound to sending WAV to LMS for processing.

    Link to Github OpenHAB Audio.java class

  7. #7
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    17,906
    Quote Originally Posted by RipNCode View Post
    Thanks, bpa. That helps a lot. It's probably the core of what's wrong. I assume LMS would probably need an appropriate plug-in that allows it to recognize the correctly defined audio type?

    Sorry for the newbie questions, but I'm still getting a handle on this...
    Not necessarily a plugin as something might already cover it but the stream has to be set up so it is unambiguously a WAV stream. LMS also has to know is it is a "Live" stream (i.e. infinite) or a file (e.g. WAV podcast like) with a defined length (WAV header has a max size of 2Gb so "Live" stream has to break WAV headers). The transport protocol also needs to be defined (e.g. MPEg2 over HTTP, MPEG4 over HTTP, plain http). Side issues of metadata also come into view.

  8. #8
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    17,906
    Since the stream already exists - it is a case of describing the current format and then advice can be given.

    If you're not sure how to describe then play it with mplayer with "-v" verbose and copy the output to a post. It will give all the header and mime and other stream format info necessary to play the stream.

    Years ago - KEXP used to have a uncompressed stream and there various hacks to play it - all of which are now out of date.

    For example - one thread of many
    https://forums.slimdevices.com/showt...P-Uncompressed

  9. #9
    Junior Member
    Join Date
    Apr 2019
    Posts
    10
    Quote Originally Posted by bpa View Post
    Since the stream already exists - it is a case of describing the current format and then advice can be given.

    If you're not sure how to describe then play it with mplayer with "-v" verbose and copy the output to a post. It will give all the header and mime and other stream format info necessary to play the stream.

    Years ago - KEXP used to have a uncompressed stream and there various hacks to play it - all of which are now out of date.

    For example - one thread of many
    https://forums.slimdevices.com/showt...P-Uncompressed
    Thanks, bpa. Below is a sample created with Pico TTS and with output from mplayer. In theory, the format would always be the same (PCM 16-bit signed), but the length would vary as Pico converts various text files to audio.

    Playing test.wav.
    get_path('sub/') -> '/home/rip/.mplayer/sub/'
    [file] File size is 136492 bytes
    STREAM: [file] test.wav
    STREAM: Description: File
    STREAM: Author: Albeu
    STREAM: Comment: based on the code from ??? (probably Arpi)
    libavformat version 58.20.100 (internal)
    Configuration: --enable-gpl --enable-postproc
    LAVF_check: WAV / WAVE (Waveform Audio)
    Checking for YUV4MPEG2
    ASF_check: not ASF guid!
    Checking for REAL
    Checking for SMJPEG
    Searching demuxer type for filename test.wav ext: .wav
    Trying demuxer 17 based on filename extension
    ==> Found audio stream: 0
    ======= WAVE Format =======
    Format Tag: 1 (0x1)
    Channels: 1
    Samplerate: 16000
    avg byte/sec: 32000
    Block align: 2
    bits/sample: 16
    cbSize: 0
    ================================================== ========================
    demux_audio: audio data 0x2C - 0x2152C
    Audio only file format detected.
    Load subtitles in ./
    get_path('sub/') -> '/home/rip/.mplayer/sub/'
    ================================================== ========================
    Opening audio decoder: [pcm] Uncompressed PCM audio decoder
    dec_audio: Allocating 2048 + 131072 = 133120 bytes for output buffer.
    AUDIO: 16000 Hz, 1 ch, s16le, 256.0 kbit/100.00% (ratio: 32000->32000)
    Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
    ================================================== ========================
    Building audio filter chain for 16000Hz/1ch/s16le -> 0Hz/0ch/??...
    [libaf] Adding filter dummy
    [dummy] Was reinitialized: 16000Hz/1ch/s16le
    [dummy] Was reinitialized: 16000Hz/1ch/s16le
    Trying preferred audio driver 'alsa', options '[none]'
    alsa-init: requested format: 16000 Hz, 1 channels, 9
    alsa-init: using ALSA 1.1.7
    alsa-init: setup for 1/2 channel(s)
    alsa-init: using device default
    alsa-init: opening device in blocking mode
    [AO_ALSA] alsa-lib: pcm_dmix.c:1063snd_pcm_dmix_open) unable to create IPC semaphore
    [AO_ALSA] Playback open error: Permission denied
    Failed to initialize audio driver 'alsa'
    Trying every known audio driver...
    ao2: 16000 Hz 1 chans s16le
    audio_setup: using '/dev/dsp' dsp device
    audio_setup: using '/dev/mixer' mixer device
    audio_setup: using 'pcm' mixer device
    [AO OSS] audio_setup: Can't open audio device /dev/dsp: Device or resource busy
    alsa-init: requested format: 16000 Hz, 1 channels, 9
    alsa-init: using ALSA 1.1.7
    alsa-init: setup for 1/2 channel(s)
    alsa-init: using device default
    alsa-init: opening device in blocking mode
    [AO_ALSA] alsa-lib: pcm_dmix.c:1063snd_pcm_dmix_open) unable to create IPC semaphore
    [AO_ALSA] Playback open error: Permission denied
    AO: [pulse] 16000Hz 1ch s16le (2 bytes per sample)
    AO: Description: PulseAudio audio output
    AO: Author: Lennart Poettering
    Building audio filter chain for 16000Hz/1ch/s16le -> 16000Hz/1ch/s16le...
    [dummy] Was reinitialized: 16000Hz/1ch/s16le
    [dummy] Was reinitialized: 16000Hz/1ch/s16le
    Video: no video
    Freeing 0 unused video chunks.
    Starting playback...
    Increasing filtered audio buffer size from 0 to 9024
    A: 4.0 (03.9) of 4.0 (04.0) 0.0%
    ds_fill_buffer: EOF reached (stream: audio)
    ds_fill_buffer: EOF reached (stream: audio)
    A: 4.0 (04.0) of 4.0 (04.0) 0.0%
    ds_fill_buffer: EOF reached (stream: audio)
    A: 4.1 (04.0) of 4.0 (04.0) 0.0%
    EOF code: 1

    Uninit audio filters...
    [libaf] Removing filter dummy
    Uninit audio: pcm
    vo: x11 uninit called but X11 not initialized..

    Exiting... (End of file)

  10. #10
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    4,158
    Another approach may be to take the wav input into liquidsoap and then stream it via icecast to LMS as an mp3.
    VB2.4 storage QNAP TS419p (NFS)
    Living Room - Joggler & SB3 -> Onkyo TS606 -> Celestion F20s
    Office - Pi3+Sreen -> Sony TAFE320 -> Celestion F10s / Pi2+DAC & SB3 -> Onkyo CRN755 -> Wharfedale Modus Cubes
    Dining Room -> SB Boom
    Kitchen -> UE Radio (upgraded to SB Radio)
    Bedroom (Bedside) - Pi2+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) - SB Touch ->Sherwood AVR ->Mordaunt Short M10s
    Everything controlled by iPeng

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •