Alsa Library for transcoding












0















Can I use ALSA library for transcoding of audio from one format to another.



i.e S32 2 channels to S16 1 Channel audio from file as input source to file output



In one of link I saw statement,
Plugin: File
This plugin stores contents of a PCM stream to file or pipes the stream to a command, and optionally uses an existing file as an input data source (i.e., "virtual mic")



How to setup such pipeline file input and file output, when it is input from file from where does it pick information like format and channels since, API "snd_pcm_file_open" doesn't ask for format related information ? I am hoping this to come from configuration file .asoundrc but, I don't see any doucmentation on how to do it ?










share|improve this question





























    0















    Can I use ALSA library for transcoding of audio from one format to another.



    i.e S32 2 channels to S16 1 Channel audio from file as input source to file output



    In one of link I saw statement,
    Plugin: File
    This plugin stores contents of a PCM stream to file or pipes the stream to a command, and optionally uses an existing file as an input data source (i.e., "virtual mic")



    How to setup such pipeline file input and file output, when it is input from file from where does it pick information like format and channels since, API "snd_pcm_file_open" doesn't ask for format related information ? I am hoping this to come from configuration file .asoundrc but, I don't see any doucmentation on how to do it ?










    share|improve this question



























      0












      0








      0








      Can I use ALSA library for transcoding of audio from one format to another.



      i.e S32 2 channels to S16 1 Channel audio from file as input source to file output



      In one of link I saw statement,
      Plugin: File
      This plugin stores contents of a PCM stream to file or pipes the stream to a command, and optionally uses an existing file as an input data source (i.e., "virtual mic")



      How to setup such pipeline file input and file output, when it is input from file from where does it pick information like format and channels since, API "snd_pcm_file_open" doesn't ask for format related information ? I am hoping this to come from configuration file .asoundrc but, I don't see any doucmentation on how to do it ?










      share|improve this question
















      Can I use ALSA library for transcoding of audio from one format to another.



      i.e S32 2 channels to S16 1 Channel audio from file as input source to file output



      In one of link I saw statement,
      Plugin: File
      This plugin stores contents of a PCM stream to file or pipes the stream to a command, and optionally uses an existing file as an input data source (i.e., "virtual mic")



      How to setup such pipeline file input and file output, when it is input from file from where does it pick information like format and channels since, API "snd_pcm_file_open" doesn't ask for format related information ? I am hoping this to come from configuration file .asoundrc but, I don't see any doucmentation on how to do it ?







      libalsa






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 19 '18 at 9:39







      vishwanath patil

















      asked Nov 19 '18 at 8:37









      vishwanath patilvishwanath patil

      217




      217
























          1 Answer
          1






          active

          oldest

          votes


















          0














          It can't be done since configuration file (asoundrc) as only option to set input file and format as raw or wav as below



          pcm.file {
          format raw
          infile "/home/root/raw.pcm"
          }


          since you can't specify input format you can't transcode, it reads in format that you request from that file. i.e it reads S32 if you request S32 through arecord even if file contains S16.



          But, alternative is to use tools like "sox" for transcoding.



          If it is only to check how does ALSA does transcoding when real mic is present,then dump "snd_pcm_dump" (arecord -v) will give conversion function(equation) that it uses






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370944%2falsa-library-for-transcoding%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            It can't be done since configuration file (asoundrc) as only option to set input file and format as raw or wav as below



            pcm.file {
            format raw
            infile "/home/root/raw.pcm"
            }


            since you can't specify input format you can't transcode, it reads in format that you request from that file. i.e it reads S32 if you request S32 through arecord even if file contains S16.



            But, alternative is to use tools like "sox" for transcoding.



            If it is only to check how does ALSA does transcoding when real mic is present,then dump "snd_pcm_dump" (arecord -v) will give conversion function(equation) that it uses






            share|improve this answer




























              0














              It can't be done since configuration file (asoundrc) as only option to set input file and format as raw or wav as below



              pcm.file {
              format raw
              infile "/home/root/raw.pcm"
              }


              since you can't specify input format you can't transcode, it reads in format that you request from that file. i.e it reads S32 if you request S32 through arecord even if file contains S16.



              But, alternative is to use tools like "sox" for transcoding.



              If it is only to check how does ALSA does transcoding when real mic is present,then dump "snd_pcm_dump" (arecord -v) will give conversion function(equation) that it uses






              share|improve this answer


























                0












                0








                0







                It can't be done since configuration file (asoundrc) as only option to set input file and format as raw or wav as below



                pcm.file {
                format raw
                infile "/home/root/raw.pcm"
                }


                since you can't specify input format you can't transcode, it reads in format that you request from that file. i.e it reads S32 if you request S32 through arecord even if file contains S16.



                But, alternative is to use tools like "sox" for transcoding.



                If it is only to check how does ALSA does transcoding when real mic is present,then dump "snd_pcm_dump" (arecord -v) will give conversion function(equation) that it uses






                share|improve this answer













                It can't be done since configuration file (asoundrc) as only option to set input file and format as raw or wav as below



                pcm.file {
                format raw
                infile "/home/root/raw.pcm"
                }


                since you can't specify input format you can't transcode, it reads in format that you request from that file. i.e it reads S32 if you request S32 through arecord even if file contains S16.



                But, alternative is to use tools like "sox" for transcoding.



                If it is only to check how does ALSA does transcoding when real mic is present,then dump "snd_pcm_dump" (arecord -v) will give conversion function(equation) that it uses







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 27 '18 at 16:47









                vishwanath patilvishwanath patil

                217




                217
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370944%2falsa-library-for-transcoding%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    Xamarin.form Move up view when keyboard appear

                    Post-Redirect-Get with Spring WebFlux and Thymeleaf

                    Anylogic : not able to use stopDelay()