9 Replies Latest reply on Apr 26, 2018 1:07 AM by circuit_dabba

    ALSA error when recording from Line In with Darkice

    lpsaunders

      I had a set up where Darkice would record from Line In on the Wolfson and stream. However now when starting Darkice it crashes with the following error:

       

      Using config file: /home/pi/Desktop/stream_settings/stream_configuration.cfg

      Using ALSA DSP input device: hw:0,0

      Using POSIX real-time scheduling, priority 98

      DarkIce: AlsaDspSource.cpp:265: Input/output error [0]

      darkice crashed, retrying in 10 seconds.

       

      I have run ./Record_from_lineIn.sh

       

      Output from amixer looks okay (I read this in another post):

       

      ~ $ amixer -Dhw:0 cget name='AIF1TX1 Input 1' | tail -1

      ~ $ amixer -Dhw:0 cget name='AIF1TX2 Input 1' | tail -1

        : values=11

        : values=12

       

      Darkice config is: https://gist.github.com/lukesaunders/521d66a9baa69ea2cf88

       

      I also tried recording from arecord with arecord –c 2 –f S16_LE –r 44100 record_from_line_in.wav but this gives the error

       

      Recording WAVE '–c' : Unsigned 8 bit, Rate 8000 Hz, Mono

      arecord: set_params:1081: Sample format non available

      Available formats:

      - S16_LE

      - S32_LE

       

       

      I'm wondering if it's a hardware problem. Is there any way I can check that? What is the simplest way to check the recording from line in is working?

       

      All help appreciated!

        • Re: ALSA error when recording from Line In with Darkice
          ragnar.jensen

          Try setting

          realtime = no

          in the [general] section of your Darkice config file. I have seen reports that it can help.

           

          I think your arecord command has Unicode characters in it, at least the dashes.

          Type this on the command line, don't copy and paste:

          arecord -Dhw:0 -f cd record_from_line_in.wav

           

          -f cd is shorthand for -f S16_LE -c2 -r44100

          --

          Ragnar


            • Re: ALSA error when recording from Line In with Darkice
              lpsaunders

              Thanks Ragnar. Here's the result:

              ~ $ arecord -Dhw:0 -f cd record_from_line_in.wav

              Recording WAVE 'record_from_line_in.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

              arecord: pcm_read:1801: read error: Input/output error

              Doesn't look too good. Any further ideas?

               

              EDIT: Okay, this is a bit embarrassing, but I tried as a last resort separating the Wolfson from the Pi and then reconnecting it and now everything works. So, it must have come slightly loose and lost connection.

               

              Everything works now!

               

              What does realtime no help with out of interest?

                • Re: ALSA error when recording from Line In with Darkice
                  ragnar.jensen

                  The three most common causes of the input/output error are

                  • Hardware fault (as you've discovered)
                  • Some other program is using the sound card.
                  • Too many overruns, i.e. packets are arriving from the sound card faster than the program can process them.

                   

                  realtime = yes (the default) gives a hint to the kernel that Darkice wants the highest possible scheduling priority, to make sure that it can keep up with the stream of packets arriving from the sound card.

                  Setting realtime to "no" makes Darkice not complain as hard when it can't keep up. Instead it just drops packets it is unable to process. The downside is that it may cause glitches or drop-outs in the output.

                  --

                  Ragnar

                    • Re: ALSA error when recording from Line In with Darkice
                      soundcamp

                      Hi Luke and Ragnar

                       

                      We reported a while back that we were able to stop dropouts and buffer overruns with high quality stereo streams by setting realtime = no.

                       

                      But at the moment the streams are back to having constant dropouts and pops using the Wolfson on-board mics - so have to revise the finding on the realtime setting.

                       

                      We'll update when / if we resolve the issues.

                       

                      bw

                      grant

                        • Re: ALSA error when recording from Line In with Darkice
                          soundcamp

                          Further to that, we think our issue is with the wifi, because we can stream at high quality stereo from the Wolfson on-board microphones with no pops or buffer overruns if we use ethernet.

                           

                          So will try now to troubleshoot the wifi.

                           

                          If anybody has experiences or advice with that, we'd be grateful.

                           

                          Ragnar, incidentally, when you have been streaming successfully yourself eg at 44100 Hz, 16 bit, 256 kbps stereo - were you using wifi or ethernet connection?

                           

                          thx

                          grant

                            • Re: ALSA error when recording from Line In with Darkice
                              ragnar.jensen

                              I'm using a cabled ethernet connection

                              --

                              Ragnar

                                • Re: ALSA error when recording from Line In with Darkice
                                  soundcamp

                                  Thanks, Ragnar

                                   

                                  Well, we are trying to develop a stream box that is very flexible for the user, so they can get it to somewhere that sounds good with a minimum of cabling. Also, we are working on a solution that will be affordable and very resilient. So far, our best versions have been mono, using the Icicle soundcard.

                                   

                                  Luke has set up high quality remote streams over 3G using the Wolfson's line in, and a custom installation with a local Icecast server, which in turn connects to a remote server. These streams have had excellent sound quality. In principle, it should be straightforward to achieve the same think over WiFi, but it has been a tricky process..

                                   

                                  The best permanent open microphone streams from wild soundscapes which we know of (in terms of audio quality) currently use expensive installations (c. $6,000). So we would like to find a (much!) cheaper alternative, to widen participation in the network.

                                   

                                  Ideally, we would like to connect pairs of electret capsules directly to the Wolfson's expansion header pins to draw 5V Plug in Power and take advantage of the Wolfson's preamps. This could potentially provide great quality at low cost.

                                   

                                  Meanwhile, the wifi pops and dropouts to work through..

                                   

                                  bw

                                  grant

                                    • Re: ALSA error when recording from Line In with Darkice
                                      soundcamp

                                      Hi Ragnar and all

                                       

                                      Sorry for very long delay in taking this forward.

                                       

                                      We have finally cleared time to test the latest version of Darkice with the latest Wolfson drivers, installed with Ragnar's help.

                                       

                                      You may remember that we are looking for a cheap low-noise live streaming solution for distribution as part of a live daybreak broadcast project.

                                       

                                      Initial impressions are that this setup is stable over ethernet. Over wifi we continue to have dropouts. These appear to accumulate over time. Each dropout is accompanied by a loudish pop. We still don't understand why the stream drops out over wifi; we think there is plenty of extra bandwidth. The only example we know of with high quality stereo over a wifi was with a local icecast server on the Pi. We still don't know why this worked so well; and it is a very inconvenient setup for our purposes; so we are still exploring how to get Darkice to stream high quality stereo to a remote server over wifi, as we think it is designed to do.

                                       

                                      The onboard microphones have big limitations for our purposes: we need to be able to get the mics away from the board to more interesting sounds. The SEM mics also apparently have limitations in terms of sound quality in general. This may be changing; I haven't been able to be sure about the current position vis a vis electret condensers.

                                       

                                      The mic in designed for gaming on the Wolfson is adequate and the sound is ok. It needs a simple adaptor as when using a microphone into an iPhone headphone socket. It supplies plug in power.  It is mono, with just the left channel supplying audio. This is duplicated so the listener hears identical channels in each ear.

                                       

                                      For a mono stream, we can get better results using an Icicle USB soundcard directly into the Pi - leaving out the Wolfson. But the Wolfson does enable use of an electret microphone, which can give excellent quality vs price. For stereo the Wolfson currently requires an additional soundcard with preamplifier, which adds up to an expensive package, not usually workable for a long-term installation.

                                       

                                      Any other thoughts on how to get high quality stereo into the Pi - with the  Wolfson or indeed another way -  would be great to hear.

                                       

                                      We will update on any progress

                                       

                                      Thanks

                                      Grant (soundCamp)

                        • Re: ALSA error when recording from Line In with Darkice
                          circuit_dabba

                          Aaah,

                           

                          You need to select these formats in your ALSA Driver in snd_pcm_hardware

                           

                          .formats    =   (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S24_LE),

                           

                          Thanks  and Best Regards,

                          Devendra Yadav

                          1 of 1 people found this helpful