Announcement

Collapse
No announcement yet.

Announce: WaveInput for Linux

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Announce: WaveInput for Linux

    Summary
    This plugin enables Linux PC audio to be streamed through SqueezeCenter. Similar functionality to the WaveInput for Windows see http://forums.slimdevices.com/showthread.php?t=35718 ).

    This plugin assumes ALSA is the installed audio subsystem. This plugin will not work with an OSS audio subsystem.

    The plugin is minimal mainly 2 conf file so that an ALSA PCM stream is played through Squeezecenter. Normally the ALSA stream used will be the PC audio out but it can be any ALSA stream so that the stream could be a virtual soundcard (e.g. on a PC with no real audio hardware).

    A typical use of this plugin would to play internet streams which work on PC which cannot be played from SC (e.g. flash audio such as NPR or new BBC).

    Install
    Install by unpacking the attached .tar.gz file into the Plugins directory according to your distro. The new directory in Plugins will be called WaveInput. The most difficult part in getting this plugin to work will probably be the ALSA configuration. Typically the user will use an appropriate mixer application (e.g. amixer, alsamixer, Kmixer, Gnome-alsamixer) to configure the correct stream to be used in playback.

    A good installation will have a new FileType WaveInput under Settings/Advanced/File Types. The WaveInput FileType should have at least the WAV and Flac entries enabled - the mp3 entry will only be enabled if lame is installed. Do not confuse the WaveInput File Type with WAV and Wavpack File Types which are audio formats and are not related to this plugin.

    For SC 7.3 and later - use the Extension Downloader Plugins. Add the following URL to the repostory list in teh Extension Downloader settings



    How to use
    There is no user interface. The ALSA stream is played through the URL wavin:<PCM_STREAM> where <PCM_STREAM> is the ALSA PCM name. Typically this will be "default" (i.e. wavin:default ) but it could be any stream named in ALSA configuration files (e.g. .asoundrc, /etc/asound.conf) The user should create an entry in Favorites or My Radio Stations, the name is arbitrary and the URL will be typically wavin:default.

    Setup Hints
    The default custom-convert.conf file uses arecord (normally supplied as part of ALSA) to copy audio stream to SC. However arecord is not great when converting live streams and drops out can occur when overruns occur (i.e. arecord was too slow processing audio) A second conf file is supplied configured to use ecasound (see http://www.eca.cx/ecasound ) - the configuration supplied is much better than arecord but dropouts can still occur - however there are more ecasound options that can be explored. If you have ecasound installed - just save existing custom-convert.conf file in Plugins/WaveInput and then rename custom-convert.conf.eca to custom-convert.conf. Then restart SC.

    As stated above getting ALSA configured correctly may be the difficult part - you may find it easier to test different setting of the mixer while recording using an application such as Audacity, Krecord as they provide visual feedback rather using SC. Sometimes the problem may not be the correct source but incorrect level settings. The configuration settings of mixer will probably depend on the audio hardware and the associated driver. Some drivers do not support the mix facility and so this plugin will not work with those drivers.
    Last edited by bpa; 2008-12-25, 19:07. Reason: File Type clarification

  • #2
    OSS capability for Linux WaveInput plugin

    I've attached a custom-convert.conf file that works with OSS.

    As with ALSA you need to set the line-in levels with a mixer program.

    If your first dsp device is named /dev/dsp and NOT /dev/dsp0, which is usually the case with the OSS drivers, you need to use "wavin:" without the trailing zero for the first input device and "wavin:1" for the second, etc.

    Alternatively you could create a symbolic link from /dev/dsp to /dev/dsp0.

    cd /dev; ln -s dsp dsp0

    If you're using devfsd on a 2.4 kernel add the following lines to devfsd.conf and 'pkill -HUP devfsd' to have the daemon reread the conf file.

    REGISTER ^sound/dsp$ CFUNCTION GLOBAL mksymlink $devname dsp0
    UNREGISTER ^sound/dsp$ CFUNCTION GLOBAL unlink dsp0

    bpa

    I had to add -C to the command lines to have ecasound v2.4.6 exit after stopping the stream or clearing the playlist. I also added -z:xruns to have it exit if buffer over/underruns happen.

    You might want to update custom-convert.conf.eca with these changes.for the alsa users.

    Ralphy

    Updated:

    Apparently the -q option doesn't stop writing to stderr. I've also added -D and a redirect of stderr to /dev/null.

    Additional changes to custom-convert.conf for version 1.0.1
    Last edited by ralphy; 2008-07-19, 21:50.
    Ralphy

    1-Touch, 5-Classics, 3-Booms, 2-UE Radio
    Squeezebox client builds donations always appreciated.

    Comment


    • #3
      I think there must be different build options or behaviour on different distro. On my system (Suse 10.1) ecasound (2.4.5) terminates with "broken pipe" which happens because SC closes the pipe when playing stops.

      Try running from a shell prompt and you should check to see if ecasound stops with "broken pipe".

      Comment


      • #4
        I'm running archlinux 0.7 on a qube 3, kernel version 2.4.36.4, my ecasound has --disable-arts --disable-jack --with-largefile specified on the configure line in the pkgbuild script. I did build the 2.4.6 package myself. I have both alsa and oss installed on this system, so I can load either sound driver for testing. I've been using SC 7.0.2-21032 for testing the plugin.

        When I start SC from an xterm after removing the /dev/null redirect of stderr I get the following messages;

        .....
        found key-value pair: ext-cmd-aac-input = "faad -w -b 1 -f 2 -d %f".
        found key-value pair: ext-cmd-aac-output = "faac -P -o %f -R %s -B %b -C %c -".

        (audioio-raw) Outputting to standard output [rw].

        Pressing pause on the player I get the following but ecasound continues to run;

        (audioio-db-client) WARNING: Overrun in writing to "stdout". Trying to recover.
        (audioio-db-client) WARNING: Overrun in writing to "stdout". Trying to recover.
        Warning: DBC_CHECK failed - "pserver_repp->is_running() != true", audioio-db-client.cpp, 217.
        Warning: DBC_REQUIRE failed - "is_running() != true", audioio-db-server.cpp, 160.
        (audioio-db-client) Serious trouble with the disk-io subsystem! (output)
        (audioio-db-client) WARNING: Overrun in writing to "stdout". Trying to recover.
        (audioio-db-client) Serious trouble with the disk-io subsystem! (output)
        (audioio-db-client) WARNING: Overrun in writing to "stdout". Trying to recover.
        Warning: DBC_CHECK failed - "pserver_repp->is_running() != true", audioio-db-client.cpp, 217.
        Warning: DBC_REQUIRE failed - "is_running() != true", audioio-db-server.cpp, 160.

        Press play and the audio starts up again.

        If I clear the wavin: playlist for the player I get this before ecasound exits.

        (audioio-db-client) Serious trouble with the disk-io subsystem! (output)
        ecasound: Warning! Errors detected during processing.
        (audioio-db-client) There were total 4 xruns.
        Ralphy

        1-Touch, 5-Classics, 3-Booms, 2-UE Radio
        Squeezebox client builds donations always appreciated.

        Comment


        • #5
          You can't expect pausing a live PC audio stream using SC to work indefinitely so at some point you will get overrun. The pipe buffer will determine the current max time (probably a few secs) . Similar things happen if you pause a live internet radio - it generally doesn't work.

          If you want to pause the PC audio output - you need to pause the PC application.

          If you really want to handle it - putting "dd" into the chain between ecasound and SC might help. I think dd may buffer more data better but it is still finite.

          Comment


          • #6
            You're right, I don't expect it to pause indefinitely, but I don't get the broken pipe message even after pausing for 60 seconds. I'll investigate some more and post my findings. Either way, thanks bpa for making a Linux version of this great plugin. Hopefully we can add OSS support in a future version.

            Ralphy.
            Ralphy

            1-Touch, 5-Classics, 3-Booms, 2-UE Radio
            Squeezebox client builds donations always appreciated.

            Comment


            • #7
              You'll only get "broken pipe" when you stop playing the stream - this means pressing and holding pause button or clearing the playlist. When a stream is stopped the pipe connected to Flac output is closed and so Flac terminated and then ecasound should terminate also as pipe to Flac is closed.

              Pressing pause button once will only pause the stream and all pipes are kept open. SC just stops reading from the Flac output pipe. There is no flow control and so intermediate buffers fill up and eventually you get overrun.

              Comment


              • #8
                That explains it. I'd disabled the flac and lame file types while testing.
                Ralphy

                1-Touch, 5-Classics, 3-Booms, 2-UE Radio
                Squeezebox client builds donations always appreciated.

                Comment


                • #9
                  I think I'll post a mod to the plugin which will (optionally) stop rather than pause the stream when the user presses "pause".

                  Comment


                  • #10
                    That would be great!

                    Haven't had a chance to play with the OSS issues yet, with that change I shouldn't need too.

                    Ralphy
                    Ralphy

                    1-Touch, 5-Classics, 3-Booms, 2-UE Radio
                    Squeezebox client builds donations always appreciated.

                    Comment


                    • #11
                      Attached is v1.01. It has changes which makes "Pause" stop the stream so when user presses play a new instance of arecord/ecasound will start and there will be no PC sound buffered.

                      In Settings/Plugins/WaveInput - there is a checkbox to revert the Pause behaviour back to "pause".

                      You can toggle the setting and change behaviour without having to restart SC so you can easily test to see if this fixes the errors messages you are getting.

                      Comment


                      • #12
                        Thanks bpa, I'll test it out this weekend.

                        Ralphy
                        Ralphy

                        1-Touch, 5-Classics, 3-Booms, 2-UE Radio
                        Squeezebox client builds donations always appreciated.

                        Comment


                        • #13
                          Version 1.0.1 is working fine with OSS and ecasound.

                          I've updated the custom-convert.conf file in my original post to keep ecasound from exiting on stdout overruns.

                          Ralphy
                          Ralphy

                          1-Touch, 5-Classics, 3-Booms, 2-UE Radio
                          Squeezebox client builds donations always appreciated.

                          Comment


                          • #14
                            wave input for kubuntu

                            Hi bpa,

                            i have ecasound and i have changed the conf file to use eca.

                            ecasound -i test.wav -o alsa,hw:0,0 in a console opened in my home directory

                            plays some music down the digital optical cable.

                            I have tried tuning into wavin:hw(0,0) and various other attempts and no sound to my SB3.

                            also arecord -l gives
                            **** List of CAPTURE Hardware Devices ****
                            card 0: CMI8768 [C-Media CMI8768], device 0: CMI8738-MC8 [C-Media PCI DAC/ADC]
                            Subdevices: 1/1
                            Subdevice #0: subdevice #0
                            card 0: CMI8768 [C-Media CMI8768], device 2: CMI8738-MC8 [C-Media PCI IEC958]
                            Subdevices: 1/1
                            Subdevice #0: subdevice #0

                            also
                            arecord -v
                            ALSA lib confmisc.c:768parse_card) cannot find card 'CMI8738MC8'
                            ALSA lib conf.c:3513_snd_config_evaluate) function snd_func_card_driver returned error: No such device
                            ALSA lib confmisc.c:392snd_func_concat) error evaluating strings
                            ALSA lib conf.c:3513_snd_config_evaluate) function snd_func_concat returned error: No such device
                            ALSA lib confmisc.c:1251snd_func_refer) error evaluating name
                            ALSA lib conf.c:3513_snd_config_evaluate) function snd_func_refer returned error: No such device
                            ALSA lib conf.c:3985snd_config_expand) Evaluate error: No such device
                            ALSA lib pcm.c:2144snd_pcm_open_noupdate) Unknown PCM default
                            arecord: main:546: audio open error: No such device



                            Any ideas? or what am I doing wrong/

                            Mike.
                            Last edited by mudlark; 2008-09-05, 16:23.
                            Transporter or Cyrus streamX>CyrusDACXP>ESPAudio P09B Active filter>Cyrus X x 2>Rhapsody, Avondale and Naim cable, Kubuntu 16.10 server, various boxes for storage.
                            SB3 Flycatcher 3A linear power supply. Touch also.
                            Using SqueezeBoxServer (LMS) 7.9
                            Also piCorePlayer>Rega DAC>B4>Avondale 260>Royd Eden Kubuntu 14.10
                            also naim 32.5>hicap>140>Akroyd Coniston

                            Comment


                            • #15
                              I had similar problems setting the plugin up in the first place. I found it was best to try "wavein:default" first.

                              For initial test purposes I used something like amarok to play music continuously and then used ecasound or arecord to record into a file.

                              For application which do not use ALSA by default (i.e. they play through /dev/dsp) - with KDE using artsdsp is supposed to help when trying to capture audio through ALSA

                              Comment

                              Working...
                              X
                              😀
                              🥰
                              🤢
                              😎
                              😡
                              👍
                              👎