1 8 9 10 11 12 Previous Next 236 Replies Latest reply on Aug 10, 2017 4:39 AM by eutopialabs Go to original post
      • 135. Re: New reworked driver for Wolfson/Cirrus Logic audio card
        psyj

        Michael,

         

        Not a reply from Matthias, but a quick question to your question  .... I presume you want to do more than stream input to output directly, because that can be done with zero CPU overhead.  Which leads to the question as to what you wish to do .... that cannot be done with the cirrus card itself.  I have moved away from using Brutefir or folve as room correction filters, preferring the cirrus card because, whilst slightly inferior, it does give me the opportunity to do analogue in/out filtering in very near real time as well as digital sources and easy splitting of the signal into more than two paths ...... I would love to get hold of the built in DSP logic, which may be capable of doing rather more.  As it is I get 8 biquad filters to improve a stereo signal.

         

        Regards

         

         

        John

        • 136. Re: New reworked driver for Wolfson/Cirrus Logic audio card
          msmithers

          Hi John,

           

          I plan to implement a custom DSP chain - gain, delay, state-space biquads and long FIR - in C/C++. I've done this many times on Windows and Mac. On the Raspberry Pi, it's the ALSA setup that confounds me. (The ALSA model seems like a mess. Some of the ALSA project docs haven't been updated since 2002.)

           

          I'd previously managed to get the ALSA project "latency.c" example compiled and working to pass input to output, to see how low I could push the latency. But it requires buffer settings that push latency out to 40ms+ before it doesn't glitch.

           

          Flatmax Studio's Audio Injector soundcard, for Raspberry Pi, claims very low latency, but the noise performance of the codec is not quite as good as this Cirrus / Wolfson card.

           

          Kind regards,

          Michael

          • 137. Re: New reworked driver for Wolfson/Cirrus Logic audio card
            hiassoft

            I got my "Frankenson" sound card working with a Pi2 .

             

            I didn't de-solder the pogo pins. I found a cover that fits over them nicely - made from a UK 3-pin mains plug protector that all new electrical devices come with. I cut the end off the Earth pin end of the protector. It fits neatly onto the pogo pins. Once the Wolfson card is attached to the Pi, the cover is held nicely in place, and stops them shorting on anything on the Pi.

            That's looking really nice, well done! And I think the cap over the pogo pins is a rather clever idea!

             

            so long,

             

            Hias

            • 138. Re: New reworked driver for Wolfson/Cirrus Logic audio card
              hiassoft

              Hi Michael!

              I plan to implement a custom DSP chain - gain, delay, state-space biquads and long FIR - in C/C++. I've done this many times on Windows and Mac. On the Raspberry Pi, it's the ALSA setup that confounds me. (The ALSA model seems like a mess. Some of the ALSA project docs haven't been updated since 2002.)

               

              I'd previously managed to get the ALSA project "latency.c" example compiled and working to pass input to output, to see how low I could push the latency. But it requires buffer settings that push latency out to 40ms+ before it doesn't glitch.

               

              Which kernel version are you using and did you try running the latency test as root? It's best to use the latest "rpi-update" kernel, kernels before 4.9.13 contained a nasty bug in the DMA driver which could explain your issues: https://github.com/raspberrypi/linux/pull/1858

               

              I did a quick test with kernel 4.9.16, latency.c started as a normal user and option "-r 96000" on RPi3 which worked quite well:

              !!!Scheduler set to Round Robin with priority 99 FAILED!!!
              Playback device is hw:0,0
              Capture device is hw:0,0
              Parameters are 96000Hz, S16_LE, 2 channels, non-blocking mode
              Poll mode: no
              Loop limit is 2880000 frames, minimum latency = 64, maximum latency = 4096
              ...
              Trying latency 128 frames, 1333.333us, 1.333333ms (750.0000Hz)
              Success
              Playback:
              *** frames = 2880128 ***
                state       : RUNNING
                trigger_time: 33.588546808
                tstamp      : 0.000000
                delay       : 80
                avail       : 48
                avail_max   : 76
              Capture:
              *** frames = 2880000 ***
                state       : RUNNING
                trigger_time: 33.588543839
                tstamp      : 0.000000
                delay       : 44
                avail       : 44
                avail_max   : 44
              Maximum read: 28 frames
              Maximum read latency: 291.667us, 0.291667ms (3428.5714Hz)
              Playback time = 33.588546, Record time = 33.588543, diff = 3
              

               

              When running latency as root (so it could set realtime scheduling) it worked fine as well, but locked up the RPi in the end - these are the dangers of using realtime scheduling priority, there seems to be some bug in the software

               

              I have to add that I tested on a headless RPi (i.e. no GUI running).

               

              Have you tried starting your application(s) via "sudo chrt -r 99 ..."? Using realtime scheduling priorities can help a lot with latency issues.

               

              so long,

               

              Hias

              • 139. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                eljot

                Broken Wi-Fi.

                 

                Hi,

                 

                thank you so much for you work! It works so far. But it does not go along well with my wi-fi dongle. I get no connection wehn using the card.

                I flashed the SD-card with the Raspien Jesse lite image (2017-03-02), set my wi-fi, started, updated with rpi-update to the new kernel (4.9.16+) reboot and everything was fine. Then I edited the /boot/config.txt and the

                /etc/modprobe.d/cirrus.conf, reboot the system and it did not work. Reedited the files and It worked again. Then reedited again, took out the dongle and tried with LAN. It works. So wi-fi and card are working but not at the same time.

                I have the original wolfson card on a Raspberry Pi 1 model B The wi-fi dongel is an Edimax EW-7811Un witch is a RTL8188CUS as far as I know I use the Pi headless and can not find my HDMI cable so I can not say if it boots at all I have a TTL cable I could use

                • 140. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                  hiassoft

                   

                  thank you so much for you work! It works so far. But it does not go along well with my wi-fi dongle. I get no connection wehn using the card.

                  I flashed the SD-card with the Raspien Jesse lite image (2017-03-02), set my wi-fi, started, updated with rpi-update to the new kernel (4.9.16+) reboot and everything was fine. Then I edited the /boot/config.txt and the

                  /etc/modprobe.d/cirrus.conf, reboot the system and it did not work. Reedited the files and It worked again. Then reedited again, took out the dongle and tried with LAN. It works. So wi-fi and card are working but not at the same time.

                  I have the original wolfson card on a Raspberry Pi 1 model B The wi-fi dongel is an Edimax EW-7811Un witch is a RTL8188CUS as far as I know I use the Pi headless and can not find my HDMI cable so I can not say if it boots at all I have a TTL cable I could use

                  Not sure what could be causing this. Could you grab dmesg from a non-working setup, with both the wifi dongle and Wolfson card enabled?

                   

                  so long,

                   

                  Hias

                  • 141. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                    msmithers

                    Hi Hias,

                     

                    Thanks for the reply. Yes, a few days ago I did a completely fresh install of Jessie Lite (headless), updated it to 4.9.16 and set it up for the Cirrus card, as per your instructions.

                     

                    I'm testing both a Pi2 and Pi3 with the Cirrus card. I've mostly been testing at 96 kHz, and passing iPod audio through the lineIn and out to headphones. (I prefer polling - only so I can see the actual CPU load (and later watch it change as I add DSP).) I modified latency.c to run for much longer and to allow more than 2 periods per buffer. Thanks for tip wrt RT scheduling... Running latency with sudo allows it to schedule itself as realtime and it's a little more stable. (I also copied the RT scheduling code into the PortAudio example, mentioned below).

                     

                    Regardless of realtime scheduling, buffer settings and more, I have found that latency.c cannot be trusted to run forever without a buffer under/overrun error at some point.

                     

                    In light of this, I installed PortAudio, compiled it for ALSA, configured it for the Cirrus and started playing with the example programs; particularly paex_read_write_wire.c. Whether running default or elevated to RT scheduling, it also can't be trusted to run forever. However...

                     

                    This morning I figured I'd try using a PortAudio callback function in paex_read_write_wire.c, instead of the default write/read looping function calls. It now appears perfectly stable on both the Pi2 and the Pi3. I've been running the Pi2 for a few hours now, whilst running 4 SSH and SFTP sessions, and 2 instances of top. At 96 kHz, the CPU load for paex_read_write_wire is about 7% on the Pi2. (The PortAudio documentation says the callback is treated even more specially than realtime scheduling and running as root.)

                     

                    The next step is to measure the analog-to-analog latency and begin coding some DSP. And another challenge will be trying to extend the DSP across multiple cores with multi-threading!

                     

                    Kind regards,

                    Michael

                    • 142. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                      msmithers

                      Ok, here are some analog-to-analog measurements with the Cirrus on the Pi2. With PortAudio input and output set to:

                      - defaultHighInputLatency, measured latency = 43.06ms (with 6.9% CPU).

                      - defaultLowInputLatency, measured latency = 8.396ms (with 10.6% CPU).

                      Note: loopback in PortAudio callback function.

                      • 143. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                        eljot

                        I just did it everything again on a different SD-Card to try something. Now the kernel version is 4.9.17+ and there is no Problem anymore.

                        It works.

                         

                        so long,

                        Leander

                        • 144. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                          muellerjanla

                          Thank you very much for your hard work on keeping the driver up-to-date and for the libreELEC system.

                          • 145. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                            tovow

                            Hello Matthias,

                            first I would like to thank the great work on the Cirrus Logic Audio Card and congratulate the driver it in the official Kernel has done it.

                            I use an RPI 2B with Moode Audioplayer. After initial difficulties the driver with Kernel 4.9.16 runs perfectly.

                            A few questions I still have.

                            Does the Cirrus Logic Audio Card run in SLAVE or MASTER mode? Background is the one I would like to use one of ALLO.COM Kali I2S reclocker.

                            It should work with the Cirrus Logic Audio Card.

                            The Cirrus_listen.sh script, how can I route Digital IN to Digital OUT or Analog OUT and then still works the volume control?

                            What is the command? Can then possibly a DRC program and Convolver operate?

                             

                             

                            Best regards

                            Theo

                             

                            Ps. translated with Google translator

                            • 146. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                              hiassoft

                              Does the Cirrus Logic Audio Card run in SLAVE or MASTER mode? Background is the one I would like to use one of ALLO.COM Kali I2S reclocker.

                              The Cirrus card is the clock master.

                               

                              More precisely, the WM5102 controls the I2S clock, usually derived from the on-board crystal connected to the WM8804. If you use SPDIF input things change a bit, then the WM8804 syncs onto the signal from the SPDIF input stream and that is used as a reference clock.

                               

                              This allows for slight variations in clocking - crystals and clocks are usually a few ppm off - but you still have to manually configure the card to the correct clock rate.

                               

                              eg if you configure the card to 44.1kHz and then feed a 48kHz digital signal in you'll get garbage. You can use several alsa controls (the ones starting with "IEC958 Capture" to monitor the WM8804 (SPDIF transceiver) status bits - see WM8804 datasheet for details - to check if it's properly locked onto the SPDIF input stream and/or what it thinks the approximate SPDIF rate is.

                              The Cirrus_listen.sh script, how can I route Digital IN to Digital OUT or Analog OUT and then still works the volume control?

                              What is the command?

                              For SPDIF output with the listen script you can adjust the volume via "AIF2TX1 Input 2 Volume" (left channel) and "AIF2TX2 Input 2 Volume" (right channel). These are only coarse-grain volume controls though.

                               

                              For lineout with listen script you have both coarse-grain controls, separated for left and right, "HPOUT2L Input 2 Volume" and "HPOUT2R Input 2 Volume" and a finer-grain control common to both L+R channels, "HPOUT2 Digital Volume".

                               

                              If you specify another mixer number (default is 2) in the listen scripts you'll have to use the same number in the "Input X" names.

                              Can then possibly a DRC program and Convolver operate?

                              Sure, but in this case better setup the card for normal playback/recording instead of using the listen scripts. You can then use eg brutefir to process the audio signals.

                               

                              so long,

                               

                              Hias

                              • 147. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                                tovow

                                Hi Matthias,

                                thanks for the reply.

                                What I do not understand is how I use the Cirrus_listen.sh script.

                                I have to enter something at the command level or change the script as such.

                                 

                                Listen_Out

                                 

                                 

                                An Example of the Digital IN to Digital OUT or sample Command would be good.

                                 

                                 

                                Ciao Theo

                                • 148. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                                  hiassoft

                                  Hi Theo!

                                  What I do not understand is how I use the Cirrus_listen.sh script.

                                  I have to enter something at the command level or change the script as such.

                                   

                                   

                                  An Example of the Digital IN to Digital OUT or sample Command would be good.

                                  The first parameter is the output, the second the input. To listen to SPDIF in on SPDIF out use:

                                  Cirrus_listen.sh spdif spdif
                                  

                                   

                                  To listen to SPDIF in on line out use:

                                  Cirrus_listen.sh line spdif
                                  

                                   

                                  To change lineout to listen on linein use this:

                                  Cirrus_listen.sh line line
                                  

                                   

                                  If you enter all three commands (in the sequence above) you'll get the following results

                                  1. spdif in -> spdif out
                                  2. spdif in -> spdif out and spdif in -> line out
                                  3. spdif in -> spdif out and line in -> line out

                                   

                                  so long,

                                   

                                  Hias

                                  • 149. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                                    psyj

                                    Theo,

                                     

                                    Hopefully I can save Matthias some time.  The two scripts cirrus_listen.sh and rpi-cirrus-functions.sh (upon which it depends) are pretty straightforward (but very useful).  They ultimately generate the primitive amixer commands which are used to control the card via the command line interpreter.  These commands look like

                                     

                                    amixer -Dhw:0 cset name='HPOUT2L Input 1 Volume' 24

                                     

                                    This example (not generated by Matthias script) does the following:- it specifies that we want to change something about HPOUT2 (One of the analogue outputs from the card).  the left channel (hence L).  Each of the outputs on the Cirrus card has a 4 channel mini mixer, and this command changes something (the Volume in this case) associated with input 1 of that mini mixer ...... it sets the volume level to 24 (which if I remember correctly is 0dB gain)

                                     

                                    So Matthias scripts simplifies issuing lots of these commands down to a single line.  As the usage generated by the script says

                                     

                                    usage output input [mixer-num]

                                    output: line, headset, spdif, speaker

                                    input: line, headset, spdif, dmic

                                    mixer-num: 1-4, default is 2

                                     

                                     

                                    "output" decides which of four outputs (line|headset|spdif|speaker) you want to use

                                    "input" decides which of four inputs (line|headset|spdif|dmic) you want to connect to the output you previously selected

                                    "mixer-num" is optional and lets you decide (if you wish) which of the mini mixer inputs you want to use

                                     

                                    So (to answer your question) connecting "digital in" to "digital out" is simply

                                     

                                    ./Cirrus_listen.sh spdif spdif

                                     

                                    and if you want to use another input (eg 3) to the mini mixer associated with the "digital out"

                                     

                                    ./Cirrus_listen.sh spdif spdif 3

                                     

                                    (Why would you want to specify another input? Well by using different numbers you use different inputs to the same mini mixer. For example, I want to setup   analogue line output to

                                         take input from analogue line input on mixer channel 1

                                    and

                                         from a digital source on mixer channel 2. 

                                    That way I can play my digital music library, or listen to LPs (or both at the same time) just by changing volume levels on the mixer)

                                     

                                    (Matthias, I hope that this is exactly correct,  I do not have a system in front of me, just your scripts)

                                     

                                    POSTSCRIPT :- I note that Matthias and I were working on a reply at the same time.  Sorry Matthias

                                    1 8 9 10 11 12 Previous Next