problem with wios

HARK FORUM problem with wios

Tagged: 

This topic contains 12 replies, has 3 voices, and was last updated by Avatar paul 1 day, 23 hours ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #899
    Avatar
    paul
    Participant

    Whenever I try to play or record something with wios it gives me the error message
    “*** stack smashing detected ***: <unknown> terminated
    Aborted (core dumped)”
    I tried different options with the wios-command, tried wios on Ubuntu 18.04 and 16.04 and on two different computers. Same result. What could be the problem?

    PS: In the screenshot you also have a list of the hardware devices I use for playback and recording

    #915
    Avatar
    Rohan sheelvant
    Participant

    Yes, I am also facing the same error. I tried but was unsuccessful to figure out the problem.

    my command : wios -r -x 0 -d plughw:1,0 -c 6 -f 48000 -t 6 -o test.wav

    Please do let me know on this post if you find a solution.

    There is an alternative to wios. You can use Audacity software to record the multichannel audio data.

    #931

    Thank you for your inquiry.

    wios uses ALSA directly.

    First, make sure you can record and playback using arecord or aplay . If you set the number of bits or encoding that the hardware does not support, it may not work properly. In other words, be aware of the default settings that is used by wios.
    Secondly, wios implements only some of the features of ALSA, so some devices may not be supported. For example, when recording 24-bit PCM with the --encoding 24 option, S24_LE is supported but S24_3LE is not.

    I created a tool that I attached in this post, which can be used do a quick check. But since it has not been tested thoroughly, there may be some problems remaining. But if it works well, the output result may be helpful.

    How to compile:
    g++ wios-check.cpp -lasound -o wios-check

    How to use:
    ./wios-check <device> <type>
    <type> is one of playback , capture or both.
    defaults: <device> is hw:0,0 selected, and <type> is both selected.
    e.g.) ./wios-check plughw:0,0 playback

    Finally, HARKTOOL5 offers a new way to create transfer functions from TSP recordings that have not been synchronized. The information is written below, so I hope you find it useful.

    [HARKTOOL5-GUI documentation] => [Transfer Function Estimation Using Complex Regression Model]

    Best regards,

    #935
    Avatar
    paul
    Participant

    @Masayuki Takigahira: Thank you for your detailed reply and writing an extra tool. I would love to try out the tool because arecord and aplay work just fine and I still dont understand why wios is not working. I dont see any attachments to your post though 🙁

    @Rohan: I wrote a very simple bash-script which records an plays almost simultaneously using arecord and aplay (see end of post). Maybe measure the unavoidable latency between both arecord and aplay commands in a practical experiment were you put speaker and microphone right next to each other. With that information you can maybe later edit the tsp responces accordingly. I will put it to a test soon if I cant get wios working.

    !/bin/sh
    echo “Starting…” 1>&2
    arecord -d 2 -D plughw:1,0 -f S32_LE -r 48000 roomname_distance_d$1.wav &
    aplay tsp.wav

    #940
    Avatar
    Rohan sheelvant
    Participant

    Ok, thank you for the information

    #941
    Avatar
    Rohan sheelvant
    Participant

    @paul do let me know if you manage to get wios working.

    #942

    @paul: The upload failed due to a problem with the file permission. Thank you for contacting me.

    If I can not attach the file to this post again, please see below.

    
    // wios-check (Confirm sound device hardware capabilities.)
    // compile with: g++ wios-check.cpp -lasound -o wios-check
    
    #include <iostream>
    #include <string>
    #include <sstream>
    #include <vector>
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    #include <alsa/asoundlib.h>
    
    #ifdef __cplusplus
    }
    #endif
    
    class WiosSupports {
    private:
      std::vector<snd_pcm_access_t> supported_accesses = {
        SND_PCM_ACCESS_RW_INTERLEAVED
      };
    
      std::vector<snd_pcm_format_t> supported_formats = {
        SND_PCM_FORMAT_U8,
        SND_PCM_FORMAT_S16_LE,
        SND_PCM_FORMAT_S24_LE,
        SND_PCM_FORMAT_S32_LE
      };
    
      std::string name;
      std::vector<snd_pcm_stream_t> stream;
      std::vector<snd_pcm_access_t> accesses;
      std::vector<snd_pcm_format_t> formats;
      std::string channels;
      std::string rates;
    
      std::stringstream ss;
    
    public:
      WiosSupports(){}
      ~WiosSupports(){}
      bool set_stream(std::string dev, snd_pcm_stream_t& val){
        bool ret = false;
        if(val == SND_PCM_STREAM_PLAYBACK || val == SND_PCM_STREAM_CAPTURE){ ret = true; name = dev; stream.push_back(val); }
        return ret;
      }
      bool set_access(snd_pcm_access_t& val){
        bool ret = false;
        for(int i=0; i<supported_accesses.size(); i++){
          if(val == supported_accesses[i]){ ret = true; accesses.push_back(val); break; }
        }
        return ret;
      }
      bool set_format(snd_pcm_format_t& val){
        bool ret = false;
        for(int i=0; i<supported_formats.size(); i++){
          if(val == supported_formats[i]){ ret = true; formats.push_back(val); break; }
        }
        return ret;
      }
      bool set_channels(std::string& val){
        channels = val;
        return true;
      }
      bool set_rates(std::string& val){
        rates = val;
        return true;
      }
      bool generate_usage(){
        ss << "----------------------------------------\n";
    
        if(!stream.empty() && !accesses.empty() && !formats.empty() && !channels.empty() && !rates.empty()){
    
          ss << "You can use following device arguments with the wios command.\n";
          for(int i=0; i<stream.size(); i++){
            if(stream[i] == SND_PCM_STREAM_PLAYBACK){
              ss << "  In case of to use device " << name << " as a playback device.\n";
              ss << "    -p -x 0 -d " << name << "\n";
              ss << "      or\n";
              ss << "    -s -x 0 -y " << name << " -z <recording_device> (for the synchronous recording and playback)\n";
            }
            else if(stream[i] == SND_PCM_STREAM_CAPTURE){
              ss << "  In case of to use device " << name << " as a recording device.\n";
              ss << "    -r -x 0 -a " << name << "\n";
              ss << "      or\n";
              ss << "    -s -x 0 -y <playback_device> -z " << name << " (for the synchronous recording and playback)\n";
            }
          }
          ss << "\n";
    
          ss << "You can use following encoding argument with the wios command.\n";
          for(int i=0; i<formats.size(); i++){
            if(     formats[i] == SND_PCM_FORMAT_U8    ){ ss << "    -e u8 (same as --encoding u8)\n"; }
            else if(formats[i] == SND_PCM_FORMAT_S16_LE){ ss << "    -e 16 (same as --encoding 16)\n"; }
            else if(formats[i] == SND_PCM_FORMAT_S24_LE){ ss << "    -e 24 (same as --encoding 24)\n"; }
            else if(formats[i] == SND_PCM_FORMAT_S32_LE){ ss << "    -e 32 (same as --encoding 32)\n"; }
          }
          ss << "\n";
    
          ss << "You can use following channels argument with the wios command.\n";
          ss << "    -c <channels> (same as --channels <channels>)\n";
          ss << "    *) Please select one of " << channels << " as <channels>.\n\n";
    
          ss << "You can use following sampling rate argument with the wios command.\n";
          ss << "    -f <rate> (same as --frequency <rate>)\n";
          ss << "    *) Please select one of " << rates << " as <rate>.\n\n";
    
        }
        else{
    
          ss << "Currently the device " << name << " is not supported by wios. Although synchronous recording and playback by wios can not be used, there are the following alternatives. First, please record TSP instead of arecord or aplay. Next, create a transfer function using the feature to create a transfer function from the Mouth TSP of HARKTOOL5.\n\n";
    
        }
        std::cout << ss.str() << std::endl;
        return true;
      }
    }; // class WiosSupports
    
    class AudioDevice {
    private:
      std::vector<snd_pcm_access_t> accesses = {
        SND_PCM_ACCESS_MMAP_INTERLEAVED,
        SND_PCM_ACCESS_MMAP_NONINTERLEAVED,
        SND_PCM_ACCESS_MMAP_COMPLEX,
        SND_PCM_ACCESS_RW_INTERLEAVED,
        SND_PCM_ACCESS_RW_NONINTERLEAVED
      };
    
      std::vector<snd_pcm_format_t> formats = {
        SND_PCM_FORMAT_S8,
        SND_PCM_FORMAT_U8,
        SND_PCM_FORMAT_S16_LE,
        SND_PCM_FORMAT_S16_BE,
        SND_PCM_FORMAT_U16_LE,
        SND_PCM_FORMAT_U16_BE,
        SND_PCM_FORMAT_S24_LE,
        SND_PCM_FORMAT_S24_BE,
        SND_PCM_FORMAT_U24_LE,
        SND_PCM_FORMAT_U24_BE,
        SND_PCM_FORMAT_S32_LE,
        SND_PCM_FORMAT_S32_BE,
        SND_PCM_FORMAT_U32_LE,
        SND_PCM_FORMAT_U32_BE,
        SND_PCM_FORMAT_FLOAT_LE,
        SND_PCM_FORMAT_FLOAT_BE,
        SND_PCM_FORMAT_FLOAT64_LE,
        SND_PCM_FORMAT_FLOAT64_BE,
        SND_PCM_FORMAT_IEC958_SUBFRAME_LE,
        SND_PCM_FORMAT_IEC958_SUBFRAME_BE,
        SND_PCM_FORMAT_MU_LAW,
        SND_PCM_FORMAT_A_LAW,
        SND_PCM_FORMAT_IMA_ADPCM,
        SND_PCM_FORMAT_MPEG,
        SND_PCM_FORMAT_GSM,
        SND_PCM_FORMAT_SPECIAL,
        SND_PCM_FORMAT_S24_3LE,
        SND_PCM_FORMAT_S24_3BE,
        SND_PCM_FORMAT_U24_3LE,
        SND_PCM_FORMAT_U24_3BE,
        SND_PCM_FORMAT_S20_3LE,
        SND_PCM_FORMAT_S20_3BE,
        SND_PCM_FORMAT_U20_3LE,
        SND_PCM_FORMAT_U20_3BE,
        SND_PCM_FORMAT_S18_3LE,
        SND_PCM_FORMAT_S18_3BE,
        SND_PCM_FORMAT_U18_3LE,
        SND_PCM_FORMAT_U18_3BE,
        SND_PCM_FORMAT_G723_24,
        SND_PCM_FORMAT_G723_24_1B,
        SND_PCM_FORMAT_G723_40,
        SND_PCM_FORMAT_G723_40_1B,
        SND_PCM_FORMAT_DSD_U8,
        SND_PCM_FORMAT_DSD_U16_LE,
        SND_PCM_FORMAT_DSD_U32_LE,
        SND_PCM_FORMAT_DSD_U16_BE,
        SND_PCM_FORMAT_DSD_U32_BE
      };
    
      std::vector<unsigned int> rates = {
        5512,
        8000,
        11025,
        16000,
        22050,
        32000,
        44100,
        48000,
        64000,
        88200,
        96000,
        176400,
        192000
      };
    
      std::string name;
      snd_pcm_t *pcm;
      snd_pcm_hw_params_t *hw_params;
    
      WiosSupports wios;
      std::stringstream wios_usage;
    
    public:
      AudioDevice(): name(""), pcm(nullptr), hw_params(nullptr){
      }
      ~AudioDevice(){
        if(pcm != nullptr){
          snd_pcm_close(pcm);
          pcm = nullptr;
        }
        if(hw_params != nullptr){
          snd_pcm_hw_params_free(hw_params);
          hw_params = nullptr;
        }
      }
    
      bool is_valid(){
        if(pcm == nullptr){ return false; }
        if(name == ""){ return false; }
        if(hw_params == nullptr){ return false; }
        return true;
      }
    
      bool open_device(std::string& device_name, std::string& type, std::string& mode, bool reopen=true){
        int err = 0;
        snd_pcm_stream_t _type = SND_PCM_STREAM_PLAYBACK;
        int _mode = SND_PCM_NONBLOCK;
        if(type != "playback" && type != "capture"){
          std::cerr << "Cannot open device, because the device type is neither playback nor capture." << std::endl;
          return false;
        }
        if(mode != "non-block" && mode != "async"){
          std::cerr << "Cannot open device, because the device mode is neither non-block nor async." << std::endl;
          return false;
        }
        if(type == "capture"){ _type = SND_PCM_STREAM_CAPTURE; }
        if(mode == "async"){ _mode = SND_PCM_ASYNC; }
        if(pcm != nullptr){
          if(device_name == name){
            if(!reopen){
              std::cout << "Device '" << device_name << "' is already open, so it do nothing." << std::endl;
              return true;
            }
            std::cout << "Device '" << device_name << "' is already open, but 'reopen' has been specified, so it will close and reopen." << std::endl;
          }
          else{
            std::cout << "Device '" << device_name << "' different from the one previously opened was specified. Device '" << name << "' that was previously open are closed." << std::endl;
          }
          snd_pcm_close(pcm);
          name = device_name;
          err = snd_pcm_open(&pcm, device_name.c_str(), _type, _mode);
          wios.set_stream(device_name, _type);
        }
        else{
          name = device_name;
          err = snd_pcm_open(&pcm, device_name.c_str(), _type, _mode);
          wios.set_stream(device_name, _type);
        }
        if(err < 0){
          std::cerr << "Cannot open device '" << device_name << "': " << snd_strerror(err) << std::endl;
          name = "";
          pcm = nullptr;
          hw_params = nullptr;
          return false;
        }
        err = snd_pcm_hw_params_malloc(&hw_params);
        if(err < 0){
          std::cerr << "Cannot allocate hardware parameters: " << snd_strerror(err) << std::endl;
          snd_pcm_close(pcm);
          name = "";
          pcm = nullptr;
          hw_params = nullptr;
          return false;
        }
        err = snd_pcm_hw_params_any(pcm, hw_params);
        if(err < 0){
          std::cerr << "Cannot get hardware parameters: " << snd_strerror(err) << std::endl;
          snd_pcm_close(pcm);
          name = "";
          pcm = nullptr;
          snd_pcm_hw_params_free(hw_params);
          hw_params = nullptr;
          return false;
        }
        return true;
      }
    
      bool print_device(){
        if(!is_valid()){
          std::cerr << "Device is not ready." << std::endl;
          return false;
        }
        std::cout << "Device: " << name << " (type: " << snd_pcm_type_name(snd_pcm_type(pcm)) << ")" << std::endl;
        return true;
      }
    
      bool print_support_accesses(){
        std::stringstream ss;
        if(!is_valid()){
          std::cerr << "Device is not ready." << std::endl;
          return false;
        }
        ss << "Access types:";
        for(int i=0; i<accesses.size(); ++i){
          if(!snd_pcm_hw_params_test_access(pcm, hw_params, accesses[i])){
            ss << " " << snd_pcm_access_name(accesses[i]);
            wios.set_access(accesses[i]);
          }
        }
        std::cout << ss.str() << std::endl;
        return true;
      }
    
      bool print_support_formats(){
        std::stringstream ss;
        if(!is_valid()){
          std::cerr << "Device is not ready." << std::endl;
          return false;
        }
        ss << "Formats:";
        for(int i=0; i<formats.size(); ++i){
          if(!snd_pcm_hw_params_test_format(pcm, hw_params, formats[i])){
            ss << " " << snd_pcm_format_name(formats[i]);
            wios.set_format(formats[i]);
          }
        }
        std::cout << ss.str() << std::endl;
        return true;
      }
    
      bool print_support_channels(){
        int err = 0;
        unsigned int min = 0, max = 0;
        std::stringstream ss;
        if(!is_valid()){
          std::cerr << "Device is not ready." << std::endl;
          return false;
        }
        err = snd_pcm_hw_params_get_channels_min(hw_params, &min);
        if(err < 0){
          std::cerr << "Cannot get minimum channels count: " << snd_strerror(err) << std::endl;
          return false;
        }
        err = snd_pcm_hw_params_get_channels_max(hw_params, &max);
        if(err < 0){
          std::cerr << "Cannot get maximum channels count: " << snd_strerror(err) << std::endl;
          return false;
        }
        ss << "Channels:";
        if(min == max){
          ss << " " << min;
          std::string s("( " + std::to_string(min) + " )");
          wios.set_channels(s);
        }
        else{
          std::stringstream w; w << "(";
          bool seq = false;
          for(int i=min; i<=max; ++i){
            if(!snd_pcm_hw_params_test_channels(pcm, hw_params, i)){
              if(!seq){
                ss << " " << i; w << " " << i;
                seq = true;
              }
              else if(i == max){
                ss << "-" << i; w << "-" << i;
                seq = false;
              }
            }
            else{
              if(seq){
                ss << "-" << i-1; w << "-" << i-1;
                seq = false;
              }
            }
          }
          w << " )";
          std::string s(w.str());
          wios.set_channels(s);
        }
        std::cout << ss.str() << std::endl;
        return true;
      }
    
      bool print_support_rates(){
        int err = 0;
        unsigned int min = 0, max = 0;
        std::stringstream ss;
        if(!is_valid()){
          std::cerr << "Device is not ready." << std::endl;
          return false;
        }
        err = snd_pcm_hw_params_get_rate_min(hw_params, &min, NULL);
        if(err < 0){
          std::cerr << "Cannot get minimum rate: " << snd_strerror(err) << std::endl;
          return false;
        }
        err = snd_pcm_hw_params_get_rate_max(hw_params, &max, NULL);
        if(err < 0){
          std::cerr << "Cannot get maximum rate: " << snd_strerror(err) << std::endl;
          return false;
        }
        ss << "Sample rates:";
        if(min == max){
          ss << " " << min;
          std::string s("( " + std::to_string(min) + " )");
          wios.set_rates(s);
        }
        else if(!snd_pcm_hw_params_test_rate(pcm, hw_params, min + 1, 0)){
          ss << " " << min << "-" << max;
          std::string s("( " + std::to_string(min) + "-" + std::to_string(max) + " )");
          wios.set_rates(s);
        }
        else{
          std::stringstream w; w << "(";
          int any_rate = 0;
          for(int i=0; i<rates.size(); ++i){
            if(!snd_pcm_hw_params_test_rate(pcm, hw_params, rates[i], 0)){
              any_rate = 1;
              ss << " " << rates[i]; w << " " << rates[i];
            }
          }
          if(!any_rate){
            ss << " " << min << "-" << max; w << " " << min << "-" << max;
          }
          w << " )";
          std::string s(w.str());
          wios.set_rates(s);
        }
        std::cout << ss.str() << std::endl;
        return true;
      }
    
      bool print_interrupt_interval(){
        int err = 0;
        unsigned int min = 0, max = 0;
        std::stringstream ss;
        if(!is_valid()){
          std::cerr << "Device is not ready." << std::endl;
          return false;
        }
        err = snd_pcm_hw_params_get_period_time_min(hw_params, &min, NULL);
        if(err < 0){
          std::cerr << "Cannot get minimum period time: " << snd_strerror(err) << std::endl;
          return false;
        }
        err = snd_pcm_hw_params_get_period_time_max(hw_params, &max, NULL);
        if(err < 0){
          std::cerr << "Cannot get maximum period time: " << snd_strerror(err) << std::endl;
          return false;
        }
        ss << "Interrupt interval: " << min << "-" << max << " us";
        std::cout << ss.str() << std::endl;
        return true;
      }
    
      bool print_buffer_size(){
        int err = 0;
        unsigned int min = 0, max = 0;
        std::stringstream ss;
        if(!is_valid()){
          std::cerr << "Device is not ready." << std::endl;
          return false;
        }
        err = snd_pcm_hw_params_get_buffer_time_min(hw_params, &min, NULL);
        if(err < 0){
          std::cerr << "Cannot get minimum buffer time: " << snd_strerror(err) << std::endl;
          return false;
        }
        err = snd_pcm_hw_params_get_buffer_time_max(hw_params, &max, NULL);
        if(err < 0){
          std::cerr << "Cannot get maximum buffer time: " << snd_strerror(err) << std::endl;
          return false;
        }
        ss << "Buffer size: " << min << "-" << max << " us";
        std::cout << ss.str() << std::endl;
        return true;
      }
    
      bool print_usage(){
        wios.generate_usage();
        return true;
      }
    
    }; // class AudioDevice
    
    int main(int argc, char *argv[])
    {
      std::string device_name("hw:0,0");
      std::string device_type("both");  // playback or capture or both
      std::string device_mode("non-block"); // non-block or async
    
      if(argc > 1){ device_name = std::string(argv[1]); }
      if(argc > 2){ device_type = std::string(argv[2]); }
    
      if(device_type == "playback" || device_type == "both"){
        std::string _device_type("playback");
        std::cout << "\nPlayback device\n==============================" << std::endl;
        AudioDevice dev;
        if(dev.open_device(device_name, _device_type, device_mode)){
          if(!dev.print_device()){ return 255; }
          if(!dev.print_support_accesses()){ return 255; }
          if(!dev.print_support_formats()){ return 255; }
          if(!dev.print_support_channels()){ return 255; }
          if(!dev.print_support_rates()){ return 255; }
          if(!dev.print_interrupt_interval()){ return 255; }
          if(!dev.print_buffer_size()){ return 255; }
        }
        dev.print_usage();
      }
      if(device_type == "capture" || device_type == "both"){
        std::string _device_type("capture");
        std::cout << "\nCapture device\n==============================" << std::endl;
        AudioDevice dev;
        if(dev.open_device(device_name, _device_type, device_mode)){
          if(!dev.print_device()){ return 255; }
          if(!dev.print_support_accesses()){ return 255; }
          if(!dev.print_support_formats()){ return 255; }
          if(!dev.print_support_channels()){ return 255; }
          if(!dev.print_support_rates()){ return 255; }
          if(!dev.print_interrupt_interval()){ return 255; }
          if(!dev.print_buffer_size()){ return 255; }
        }
        dev.print_usage();
      }
    
      return 0;
    }
    
    Attachments:
    1. wios-check.zip
    #945
    Avatar
    Rohan sheelvant
    Participant

    @Masayuki Takigahira: I checked arecord and aplay are working with my device.

    Also, I am sure that the default settings of wios are correct as the same recording device works fine using the wios command in another computer I am operating.

    Can you let me know what is the error?

    #946
    Avatar
    Rohan sheelvant
    Participant

    Also, I tried to run the command: g++ wios-check.cpp -lasound -o wios-check

    but I got the following error :
    g++ wios-check.cpp -lasound -o wios-check
    wios-check.cpp:23:3: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
    };
    ^
    wios-check.cpp:30:3: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
    };
    ^
    wios-check.cpp:23:3: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
    };
    ^
    wios-check.cpp:23:3: error: converting to ‘std::vector<_snd_pcm_access>’ from initializer list would use explicit constructor ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = _snd_pcm_access; _Alloc = std::allocator<_snd_pcm_access>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = _snd_pcm_access; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<_snd_pcm_access>]’
    wios-check.cpp:30:3: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
    };
    ^
    wios-check.cpp:30:3: error: could not convert ‘{SND_PCM_FORMAT_U8, SND_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_S24_LE, SND_PCM_FORMAT_S32_LE}’ from ‘<brace-enclosed initializer list>’ to ‘std::vector<_snd_pcm_format>’
    wios-check.cpp:129:3: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
    };
    ^
    wios-check.cpp:179:3: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
    };
    ^
    wios-check.cpp:195:3: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
    };
    ^
    wios-check.cpp:129:3: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
    };
    ^
    wios-check.cpp:129:3: error: could not convert ‘{SND_PCM_ACCESS_MMAP_INTERLEAVED, SND_PCM_ACCESS_MMAP_NONINTERLEAVED, SND_PCM_ACCESS_MMAP_COMPLEX, SND_PCM_ACCESS_RW_INTERLEAVED, SND_PCM_ACCESS_RW_NONINTERLEAVED}’ from ‘<brace-enclosed initializer list>’ to ‘std::vector<_snd_pcm_access>’
    wios-check.cpp:179:3: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
    };
    ^
    wios-check.cpp:179:3: error: could not convert ‘{SND_PCM_FORMAT_S8, SND_PCM_FORMAT_U8, SND_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_S16_BE, SND_PCM_FORMAT_U16_LE, SND_PCM_FORMAT_U16_BE, SND_PCM_FORMAT_S24_LE, SND_PCM_FORMAT_S24_BE, SND_PCM_FORMAT_U24_LE, SND_PCM_FORMAT_U24_BE, SND_PCM_FORMAT_S32_LE, SND_PCM_FORMAT_S32_BE, SND_PCM_FORMAT_U32_LE, SND_PCM_FORMAT_U32_BE, SND_PCM_FORMAT_FLOAT_LE, SND_PCM_FORMAT_FLOAT_BE, SND_PCM_FORMAT_FLOAT64_LE, SND_PCM_FORMAT_FLOAT64_BE, SND_PCM_FORMAT_IEC958_SUBFRAME_LE, SND_PCM_FORMAT_IEC958_SUBFRAME_BE, SND_PCM_FORMAT_MU_LAW, SND_PCM_FORMAT_A_LAW, SND_PCM_FORMAT_IMA_ADPCM, SND_PCM_FORMAT_MPEG, SND_PCM_FORMAT_GSM, SND_PCM_FORMAT_SPECIAL, SND_PCM_FORMAT_S24_3LE, SND_PCM_FORMAT_S24_3BE, SND_PCM_FORMAT_U24_3LE, SND_PCM_FORMAT_U24_3BE, SND_PCM_FORMAT_S20_3LE, SND_PCM_FORMAT_S20_3BE, SND_PCM_FORMAT_U20_3LE, SND_PCM_FORMAT_U20_3BE, SND_PCM_FORMAT_S18_3LE, SND_PCM_FORMAT_S18_3BE, SND_PCM_FORMAT_U18_3LE, SND_PCM_FORMAT_U18_3BE, SND_PCM_FORMAT_G723_24, SND_PCM_FORMAT_G723_24_1B, SND_PCM_FORMAT_G723_40, SND_PCM_FORMAT_G723_40_1B, SND_PCM_FORMAT_DSD_U8, SND_PCM_FORMAT_DSD_U16_LE, SND_PCM_FORMAT_DSD_U32_LE, SND_PCM_FORMAT_DSD_U16_BE, SND_PCM_FORMAT_DSD_U32_BE}’ from ‘<brace-enclosed initializer list>’ to ‘std::vector<_snd_pcm_format>’
    wios-check.cpp:195:3: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
    };
    ^
    wios-check.cpp:195:3: error: could not convert ‘{5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000}’ from ‘<brace-enclosed initializer list>’ to ‘std::vector<unsigned int>’
    wios-check.cpp: In constructor ‘AudioDevice::AudioDevice()’:
    wios-check.cpp:205:32: error: ‘nullptr’ was not declared in this scope
    AudioDevice(): name(“”), pcm(nullptr), hw_params(nullptr){
    ^
    wios-check.cpp: In destructor ‘AudioDevice::~AudioDevice()’:
    wios-check.cpp:208:15: error: ‘nullptr’ was not declared in this scope
    if(pcm != nullptr){
    ^
    wios-check.cpp:212:21: error: ‘nullptr’ was not declared in this scope
    if(hw_params != nullptr){
    ^
    wios-check.cpp: In member function ‘bool AudioDevice::is_valid()’:
    wios-check.cpp:219:15: error: ‘nullptr’ was not declared in this scope
    if(pcm == nullptr){ return false; }
    ^
    wios-check.cpp:221:21: error: ‘nullptr’ was not declared in this scope
    if(hw_params == nullptr){ return false; }
    ^
    wios-check.cpp: In member function ‘bool AudioDevice::open_device(std::__cxx11::string&, std::__cxx11::string&, std::__cxx11::string&, bool)’:
    wios-check.cpp:239:15: error: ‘nullptr’ was not declared in this scope
    if(pcm != nullptr){
    ^
    wios-check.cpp:263:13: error: ‘nullptr’ was not declared in this scope
    pcm = nullptr;
    ^
    wios-check.cpp:272:13: error: ‘nullptr’ was not declared in this scope
    pcm = nullptr;
    ^
    wios-check.cpp:281:13: error: ‘nullptr’ was not declared in this scope
    pcm = nullptr;
    ^
    wios-check.cpp: In member function ‘bool AudioDevice::print_support_channels()’:
    wios-check.cpp:353:28: error: ‘to_string’ is not a member of ‘std’
    std::string s(“( ” + std::to_string(min) + ” )”);
    ^
    wios-check.cpp: In member function ‘bool AudioDevice::print_support_rates()’:
    wios-check.cpp:406:28: error: ‘to_string’ is not a member of ‘std’
    std::string s(“( ” + std::to_string(min) + ” )”);
    ^
    wios-check.cpp:411:28: error: ‘to_string’ is not a member of ‘std’
    std::string s(“( ” + std::to_string(min) + “-” + std::to_string(max) + ” )”);
    ^
    wios-check.cpp:411:56: error: ‘to_string’ is not a member of ‘std’
    std::string s(“( ” + std::to_string(min) + “-” + std::to_string(max) + ” )”);

    #947

    It seems that you need to add -std=c++11 as a compile-time option in environments other than Ubuntu 18.04 or later. This is because the source code was written based on the C++11 specification.

    #948
    Avatar
    paul
    Participant

    @Masayuki Takigahira: Thank you. The script compiled successfully. Unfortunately, it did not give me any new information on how to overcome my problem with wios (see results of my wios_check in attachments). I hope I can do without wios.

    Paul

    #950

    > Unfortunately, it did not give me any new information on how to overcome my problem with wios (see results of my wios_check in attachments).

    @paul: No. I saw your results and understood at least one of the causes.

    
    You can use following channels argument with the wios command.
        -c <channels> (same as --channels <channels>)
        *) Please select one of ( 2 ) as <channels>.
    

    This means that your device only supports 2 channels. If your device supports 1 or 2 channels, you will see the following message:

    
    You can use following channels argument with the wios command.
        -c <channels> (same as --channels <channels>)
        *) Please select one of ( 1-2 ) as <channels>.
    

    Also, while wios defaults to 16 kHz for the sampling rate, your device does not support 16 kHz. Your device supports only the sampling rates below. In other words, 44.1 kHz, 48 kHz, etc. should be selected.

    your playback device:

    
    You can use following sampling rate argument with the wios command.
        -f <rate> (same as --frequency <rate>)
        *) Please select one of ( 44100 48000 96000 192000 ) as <rate>.
    

    your capture device:

    
    You can use following sampling rate argument with the wios command.
        -f <rate> (same as --frequency <rate>)
        *) Please select one of ( 44100 48000 96000 ) as <rate>.
    

    ——
    You will need to do some things:
    – The tsp1.wav that you used is 1 Channel (Mono) data, but you need to make it 2 Chennels (Stereo).
    e.g.) If you use a tool called sox , the following will duplicate the channel after rate conversion:
    sox tsp1.wav -r 48000 tsp2.wav remix 1 1
    Instead, please try using the output tsp2.wav.
    – Please set the channel number explicitly as -c 2 on your device. It is not -c 1 .
    – Please set the sampling rate explicitly as (e.g.) -f 48000 on your device. It is not -f 16000 (This is the wios default if not set).

    ——
    The following commands should work on your device.
    arecord -d 16 -D plughw:0,0 -f S32_LE -c 2 -r 48000 output.wav
    To make it work the same way:
    wios -r -x 0 -t 16 -a plughw:0,0 -e 32 -c 2 -f 48000 -o output.wav

    The following commands should work on your device.
    aplay -D plughw:0,0 tsp.wav
    To make it work the same way:
    wios -p -x 0 -d plughw:0,0 -i tsp.wav
    *) tsp.wav must be 48 kHz, 32-bit (or 16-bit) 2-channel data.

    The settings for syncing your recording and playback devices in this example are:
    wios -s -x 0 -y plughw:0,0 -z plughw:0,0 -e 32 -c 2 -f 48000 -i tsp.wav -o output.wav

    Notes:
    If you get an error message about buffers (for example, buffer overruns), you can work around by setting the buffer size larger than the initial value using the -N and -Z options.

    I hope this answer will help you solve your problem.

    Best regards,

    #951
    Avatar
    paul
    Participant

    @Masayuki Takigahira: I understood the wios_check_results and already tried -c 2 and -f 48000 together. What I did not think of was making the tsp a 48kHz stereo sound before playback with wios. Sadly, the results are the same (see attachment).

Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.