13 Replies Latest reply on Jan 29, 2015 11:03 AM by Paridhi_Agrawal

    alsa raw data issue

    Paridhi_Agrawal

      Hi All,

       

      I have two .wav sound files.

      When I do "aplay <filename>"

      One of them is played properly. But the other one is giving a disturbing sound.

      The difference in output of both the files is :

       

      Playing WAVE 'bubble.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

           &

      Playing raw data 'Hello.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono

       

      Does anyone have an idea on this? What exactly playing raw data mean?

       

      Thanks

       

      --Paridhi

        • 1. Re: alsa raw data issue
          mhahn

          IMHO *.wav is not raw data.

          you'd have to give more log data in order to analyze your prob.

          e.g. "aplay -vv" or "aplay -vvv" should already give some more info.

          Besides which of those files plays "correctly"?

          is it correct that one is stereo 16 bit, 44.1kHz and the other only 8bit mono 8kHz?

          • 2. Re: alsa raw data issue
            Paridhi_Agrawal

            Hi mhahn,


            Following is the output for file not working:


            root@quark003356:~# aplay -vvv Hello.wav

            Playing raw data 'Hello.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono

            Plug PCM: Rate conversion PCM (48000, sformat=U8)

            Converter: linear-interpolation

            Protocol version: 10002

            Its setup is:

              stream       : PLAYBACK

              access       : RW_INTERLEAVED

              format       : U8

              subformat    : STD

              channels     : 1

              rate         : 8000

              exact rate   : 8000 (8000/1)

              msbits       : 8

              buffer_size  : 4000

              period_size  : 1000

              period_time  : 125000

              tstamp_mode  : NONE

              period_step  : 1

              avail_min    : 1000

              period_event : 0

              start_threshold  : 4000

              stop_threshold   : 4000

              silence_threshold: 0

              silence_size : 0

              boundary     : 262144000

            Slave: Route conversion PCM (sformat=S16_LE)

              Transformation table:

                0 <- 0

                1 <- 0

            Its setup is:

              stream       : PLAYBACK

              access       : MMAP_INTERLEAVED

              format       : U8

              subformat    : STD

              channels     : 1

              rate         : 48000

              exact rate   : 48000 (48000/1)

              msbits       : 8

              buffer_size  : 24006

              period_size  : 6000

              period_time  : 125000

              tstamp_mode  : NONE

              period_step  : 1

              avail_min    : 6000

              period_event : 0

              start_threshold  : 24000

              stop_threshold   : 24006

              silence_threshold: 0

              silence_size : 0

              boundary     : 1573257216

            Slave: Hardware PCM card 0 'C-Media USB Headphone Set' device 0 subdevice 0

            Its setup is:

              stream       : PLAYBACK

              access       : MMAP_INTERLEAVED

              format       : S16_LE

              subformat    : STD

              channels     : 2

              rate         : 48000

              exact rate   : 48000 (48000/1)

              msbits       : 16

              buffer_size  : 24006

              period_size  : 6000

              period_time  : 125000

              tstamp_mode  : NONE

              period_step  : 1

              avail_min    : 6000

              period_event : 0

              start_threshold  : 24000

              stop_threshold   : 24006

              silence_threshold: 0

              silence_size : 0

              boundary     : 1573257216

              appl_ptr     : 0

              hw_ptr       : 0

            100%

            100%

            100%

            100%

            100%

            100%

            Max peak (1000 samples): 0x00000080 ####################Max peak (1000 samples): 0x00000080 ####################Max peak (1000 samples): 0x00000080 ####################Max peak (1000 samples): 0x00000080 ####################Max peak (1000 samples): 0x00000080 ####################Max peak (1000 samples): 0x00000080 ####################root@quark003356:~#

             

            Thanks

            --Paridhi

            • 3. Re: alsa raw data issue
              Paridhi_Agrawal

              hi mhahn,

               

              This is the output of file "fresh.wav" which is working: (Is there a way I can attach my audio files in this discussion?)

               

               

              root@quark003356:~# aplay -vvv fresh.wav

              Playing WAVE 'fresh.wav' : Unsigned 8 bit, Rate 11025 Hz, Mono

              Plug PCM: Rate conversion PCM (44100, sformat=U8)

              Converter: linear-interpolation

              Protocol version: 10002

              Its setup is:

                stream       : PLAYBACK

                access       : RW_INTERLEAVED

                format       : U8

                subformat    : STD

                channels     : 1

                rate         : 11025

                exact rate   : 11025 (11025/1)

                msbits       : 8

                buffer_size  : 5513

                period_size  : 1378

                period_time  : 125011

                tstamp_mode  : NONE

                period_step  : 1

                avail_min    : 1378

                period_event : 0

                start_threshold  : 5513

                stop_threshold   : 5513

                silence_threshold: 0

                silence_size : 0

                boundary     : 361299968

              Slave: Route conversion PCM (sformat=S16_LE)

                Transformation table:

                  0 <- 0

                  1 <- 0

              Its setup is:

                stream       : PLAYBACK

                access       : MMAP_INTERLEAVED

                format       : U8

                subformat    : STD

                channels     : 1

                rate         : 44100

                exact rate   : 44100 (44100/1)

                msbits       : 8

                buffer_size  : 22056

                period_size  : 5513

                period_time  : 125011

                tstamp_mode  : NONE

                period_step  : 1

                avail_min    : 5513

                period_event : 0

                start_threshold  : 22052

                stop_threshold   : 22056

                silence_threshold: 0

                silence_size : 0

                boundary     : 1445462016

              Slave: Hardware PCM card 0 'C-Media USB Headphone Set' device 0 subdevice 0

              Its setup is:

                stream       : PLAYBACK

                access       : MMAP_INTERLEAVED

                format       : S16_LE

                subformat    : STD

                channels     : 2

                rate         : 44100

                exact rate   : 44100 (44100/1)

                msbits       : 16

                buffer_size  : 22056

                period_size  : 5513

                period_time  : 125011

                tstamp_mode  : NONE

                period_step  : 1

                avail_min    : 5513

                period_event : 0

                start_threshold  : 22052

                stop_threshold   : 22056

                silence_threshold: 0

                silence_size : 0

                boundary     : 1445462016

                appl_ptr     : 0

                hw_ptr       : 0

              21%

              61%

              56%

              21%

              84%

              26%

              19%

              36%

              72%

              10%

              6%

              33%

              22%

              7%

              14%

              33%

              39%

              72%

              63%

              52%

              45%

              66%

              54%

              28%

              26%

              100%

              53%

              42%

              47%

              19%

              57%

              48%

              10%

              27%

              67%

              68%

              38%

              36%

              43%

              61%

              25%

              25%

              10%

              7%

              21%

              7%

              20%

              24%

              23%

              43%

              28%

              26%

              7%

              16%

              28%

              21%

              15%

              33%

              23%

              73%

              71%

              29%

              24%

              25%

              17%

              59%

              14%

              71%

              7%

              17%

              50%

              7%

              3%

              Max peak (1378 samples): 0x0000001c #####               Max peak (1378 samples): 0x0000004f #############       Max peak (1378 samples): 0x00000048 ############        Max peak (1378 samples): 0x0000001c #####               Max peak (1378 samples): 0x0000006c #################   Max peak (1378 samples): 0x00000022 ######              Max peak (1378 samples): 0x00000019 ####                Max peak (1378 samples): 0x0000002f ########            Max peak (1378 samples): 0x0000005d ###############     Max peak (1378 samples): 0x0000000e ###                 Max peak (1378 samples): 0x00000008 ##                  Max peak (1378 samples): 0x0000002b #######             Max peak (1378 samples): 0x0000001d #####               Max peak (1378 samples): 0x0000000a ##                  Max peak (1378 samples): 0x00000012 ###                 Max peak (1378 samples): 0x0000002b #######             Max peak (1378 samples): 0x00000032 ########            Max peak (1378 samples): 0x0000005d ###############     Max peak (1378 samples): 0x00000051 #############       Max peak (1378 samples): 0x00000043 ###########         Max peak (1378 samples): 0x0000003a ##########          Max peak (1378 samples): 0x00000055 ##############      Max peak (1378 samples): 0x00000046 ###########         Max peak (1378 samples): 0x00000024 ######              Max peak (1378 samples): 0x00000022 ######              Max peak (1378 samples): 0x00000080 ####################Max peak (1378 samples): 0x00000045 ###########         Max peak (1378 samples): 0x00000037 #########           Max peak (1378 samples): 0x0000003d ##########          Max peak (1378 samples): 0x00000019 ####                Max peak (1378 samples): 0x0000004a ############        Max peak (1378 samples): 0x0000003e ##########          Max peak (1378 samples): 0x0000000d ###                 Max peak (1378 samples): 0x00000023 ######              Max peak (1378 samples): 0x00000057 ##############      Max peak (1378 samples): 0x00000058 ##############      Max peak (1378 samples): 0x00000031 ########            Max peak (1378 samples): 0x0000002f ########            Max peak (1378 samples): 0x00000038 #########           Max peak (1378 samples): 0x0000004f #############       Max peak (1378 samples): 0x00000020 ######              Max peak (1378 samples): 0x00000020 ######              Max peak (1378 samples): 0x0000000d ###                 Max peak (1378 samples): 0x00000009 ##                  Max peak (1378 samples): 0x0000001c #####               Max peak (1378 samples): 0x0000000a ##                  Max peak (1378 samples): 0x0000001a #####               Max peak (1378 samples): 0x0000001f #####               Max peak (1378 samples): 0x0000001e #####               Max peak (1378 samples): 0x00000038 #########           Max peak (1378 samples): 0x00000025 ######              Max peak (1378 samples): 0x00000022 ######              Max peak (1378 samples): 0x00000009 ##                  Max peak (1378 samples): 0x00000015 ####                Max peak (1378 samples): 0x00000025 ######              Max peak (1378 samples): 0x0000001b #####               Max peak (1378 samples): 0x00000014 ####                Max peak (1378 samples): 0x0000002b #######             Max peak (1378 samples): 0x0000001e #####               Max peak (1378 samples): 0x0000005e ###############     Max peak (1378 samples): 0x0000005b ###############     Max peak (1378 samples): 0x00000026 ######              Max peak (1378 samples): 0x0000001f #####               Max peak (1378 samples): 0x00000020 ######              Max peak (1378 samples): 0x00000016 ####                Max peak (1378 samples): 0x0000004c ############        Max peak (1378 samples): 0x00000013 ###                 Max peak (1378 samples): 0x0000005c ###############     Max peak (1378 samples): 0x00000009 ##                  Max peak (1378 samples): 0x00000016 ####                Max peak (1378 samples): 0x00000041 ###########         Max peak (1378 samples): 0x00000009 ##                  Max peak (1378 samples): 0x00000004 #                   root@quark003356:~#

               

              Thanks

              --Paridhi

              • 4. Re: alsa raw data issue
                Paridhi_Agrawal

                HI mhahn,

                 

                Does it also have to do with the kind of formats my sound card supports irrespective of what aplay can? It was not working on Galileo , so I tried running the same on Ubuntu 12.04. Same issue occurs there.

                 

                Thanks

                --Paridhi

                • 5. Re: alsa raw data issue
                  mhahn

                  sure - just tried to analyze from the very beginning ;-)

                  you could e.g. convert the data format using gstreamer to make it fitting to your sound card

                  • 6. Re: alsa raw data issue
                    Paridhi_Agrawal

                    Hi mhahn

                     

                    Searching about it on internet led me to one of the RasberryPi's forum Raspberry Pi • View topic - USB soundcard...Finally good (non HDMI) Analog Audio ,wherein it says that "Alsa can sometimes be a pain, the recording rate 8000Hz you chose for arecord is probably not supported by the card."

                     

                    Do you know how can I get sampling rate of 8000Hz to work with alsa ? Or do you suggest an alternative to alsa for Galileo?

                     

                    --Paridhi

                    • 7. Re: alsa raw data issue
                      mhahn

                      as mentioned: you might use gstreamer to resample to a fitting rate

                      • 8. Re: alsa raw data issue
                        Paridhi_Agrawal

                        hi mhahn,

                         

                        Can you point me to the gstreamer repo for galileo?

                        I am able to find for edison which is not compatible it says.

                        • 9. Re: alsa raw data issue
                          mhahn

                          not sure which Galileo image you use. If it's the eglibc one from Intel(R) IoT devkit, then you can take from i586/ (gst-*). If you're on a uclibc image AlexT_Intel might be able to add to his repo if you kindly ask him

                          • 10. Re: alsa raw data issue
                            AlexT_Intel

                            Adding gstreamer is definitely a possibility though I suspect that if it doesn't play on the Ubuntu system, then it's neither Galileo nor ALSA is the reason, but the file is simply corrupted (or the sound that was recorded was of the kind you hear back?).

                             

                            Paridhi_Agrawal, you can attach files to your posts, just click on the "Use advanced editor" link in the upper right-hand corned of the post editor and then there will be a link for attaching files in the lower right-hand corned, next to "Mention" and "App". Attach your file, I'd be curious to look at it.

                            • 11. Re: alsa raw data issue
                              mhahn

                              AlexT_Intel only some wav files play. gstreamer would be used to resample to a format the soundcard would support

                              • 12. Re: alsa raw data issue
                                AlexT_Intel

                                Yeah, that might be a card limitation too, I just took the "tried on Ubuntu" as if it was a different card there. Paridhi_Agrawal, do you mean that you've moved the USB sound card + the wav file in question to the Ubuntu machine, then trying to play it back through the same card and it didn't work? Or that Ubuntu machine had a different sound card?

                                • 13. Re: alsa raw data issue
                                  Paridhi_Agrawal

                                  Hello All,

                                   

                                  I have found a workaround solution to my problem

                                   

                                  Here is what I did:

                                   

                                  Since , the .wav raw U8 8 bit 8000Hz Mono format of my file was not playing using aplay on Gen1 (it was giving noise) , I found .mp3 version for same and

                                  did the following  to play it through aplay:

                                   

                                  1) Downloaded http://sourceforge.net/projects/lame/files/lame/3.99/lame-3.99.5.tar.gz

                                       untar

                                       ./configure

                                       make

                                       make install

                                   

                                  2) on the shell: lame --decode gw.mp3 gw_con.wav

                                   

                                  3) aplay gw_con.wav and it works !!

                                   

                                  --Paridhi