How to receive data from HarkDataStreamSender

HARK FORUM How to receive data from HarkDataStreamSender

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #1115
    kohira
    Participant

      I’m trying to receive data that HarkDataStreamSender sends.

      But after accept() is succeeded in my server, recv() receives a data of size zero, and connection is closed by client (i.e. HarkDataStreamSender).

      Is there any sample source code for server receiving data send by HarkDataStreamSender?

      Or, is there source code for HarkDataStreamSender?

      Thank you.

      #1121

      Sample code is not provided from the official website, but specifications and source code are available. I hope you find it helpful.
      There is only one point to note. Since the data is transmitted in little endian, it is not in the network byte order generally called.

      Please refer to the next url for specifications.
      https://www.hark.jp/document/hark-document-en/subsec-HarkDataStreamSender.html

      The source code can be obtained with the following command on Ubuntu.
      apt source hark-core

      In the case of Windows environment, it is probably easy to download from the following URL.
      http://archive.hark.jp/harkrepos/dists/bionic/non-free/source/
      You can download any version by clicking the following file name on the browser. The <version> will be in the form of “x.x.x”.
      hark-core_<version>.tar.gz

      Best regards,
      m.takigahira

      #1204
      kohira
      Participant

        Hi,

        For receiving data from HarkDataStreamSender, I made a TCP server.
        A fragment of source code of the server is as below.

        sock = accept(sock0, (struct sockaddr*) & client, &len);
        int sz = recv(sock, pbuff, szbuff, 0);

        Just after executing HARK network the server accepts something, but recv() is blocked, i.e., no data coming.

        Is my connection on HarkDataStreamSender wrong? or other mistakes?
        Could you please tell me wrong point?

        Thank you.
        Kohira

        Attachments:
        #1207
        lapus.er
        Participant

          Hi kohira,

          It is difficult to spot the problem using just the code snippet that you sent because it provides very little context to flow of the program.

          Can you please attach the entire file?

          Cheers,
          HARK Support Team.

          #1213
          kohira
          Participant

            Hi,

            I attached an network file, in which I place HarkDataStreamSender in sub_separation to send data to external server. And version is 3.0.0.

            Thank you.
            Kohira

            #1215
            lapus.er
            Participant

              Hi,

              Can you also share the source code of the server? I would like to check the source code and at the same time replicate the problem that you described.

              Cheers,
              HARK Support Team

              • This reply was modified 4 years, 4 months ago by lapus.er.
              #1217
              kohira
              Participant

                Hi,

                It is very appreciated if you point out wrong portion.

                Attached are server for HARK and client for testing the server. I am using Visual Studio 2019.

                Thank you.

                #1218
                kohira
                Participant

                  Try to upload as zip file.

                  Attachments:
                  #1220
                  lapus.er
                  Participant

                    Hi kohira,

                    I built svr4hark.cpp and ran the network and I was able to reproduce your issue – it can accept() successfully but no data is coming in. I checked the source code and it looks to me that there is nothing wrong with it. I think that no data was being sent from the HarkDataStreamSender node.

                    I will review the network file with the team, and check why no data is being sent to the server.

                    Cheers,
                    Earl

                    #1221
                    kohira
                    Participant

                      Hi Earl,

                      I DO thank you and your team! It would be very appreciated if the server receive data.

                      Thank you.
                      Kohira

                      #1271
                      kohira
                      Participant

                        Hello,

                        I am still having trouble about the issue.
                        could you please tell me solution or any hint?

                        Thank you.

                        お世話になっております。

                        HarkDataStreamSender からデータが送信されない件につきまして、未だ解消できておりません。

                        その後、対処法もしくはヒント等、何かお解かりになりましたでしょうか?

                        よろしくお願いします。

                        #1275
                        nterakado
                        Moderator

                          回答が遅くなり、申し訳ありません。

                          添付いただいたネットワーファイルですが、
                          HarkDataStreamSenderノードのInput/Outputが適切に設定されていませんでした。

                          詳細についてはこちらに記載してありますが、
                          SRC_WAVEを入力する場合、SRC_INFOも入力する必要がございます。

                          6.1.6.5
                          SRC_WAVE, SRC_FFT, SRC_FEATURE, SRC_RELIABILITY の4つの入力端子については, 音源 ID ごとの情報になるため,SRC_INFO の情報が必須である. もし,SRC_INFO を接続せずに,上記4つの入力端子を接続したとしても,何も送信されない. その場合,type は2進数で 0000000000 となる.

                          こちらで修正したネットワークファイルを添付しますので、
                          ご参照いただければと思います。
                          修正点は以下の通りです。
                          HarkDataStreamSenderノードをMAIN_LOOPシートに移動
                          ・sub_localizationシートの出力をHarkDataStreamSenderSRC_INFOに入力
                          ・sub_separationシートの出力をHarkDataStreamSenderSRC_WAVEに入力
                          HarkDataStreamSenderの出力端子を設定

                          以上、よろしくお願いいたします。
                          HARKサポート

                          • This reply was modified 4 years, 3 months ago by nterakado.
                          • This reply was modified 4 years, 3 months ago by nterakado.
                          • This reply was modified 4 years, 3 months ago by nterakado.
                          • This reply was modified 4 years, 3 months ago by nterakado.
                          • This reply was modified 4 years, 3 months ago by nterakado.
                          #1285
                          kohira
                          Participant

                            ありがとうございます。
                            サーバー側で受信したデータを連結して、ひとつのデータファイルを取得できました。

                            それで、教えていただきたいのですが、

                            同データファイルをパースしたところ、type = 0x0c となりました。
                            ビットの情報が重複しているようですが、問題ないでしょうか?
                            (*第3ビットと第4ビットの違いがわかりません)

                            よろしくお願いいたします。

                            #1286
                            nterakado
                            Moderator

                              表記が分かりづらく申し訳ありません。

                              第3ビットはSRC_INFO入力端子が接続されていることを示します。
                              第4ビットはSRC_WAVE入力端子が接続されていることを示しますが、先の投稿で引用したようにSRC_INFOが接続されていない場合、何も送信されないため SRC_INFOと併記しています。
                              したがって、type=0x0cで問題ありません。

                              以上、よろしくお願いいたします。
                              HARKサポート

                              #1287
                              kohira
                              Participant

                                ありがとうございました。
                                リアルタイム処理ではありませんが、サーバー側で、分離された音声データを取得できました。

                                行ったことの概略は下記のとおりです。

                                1.ネットワークのゲインを調整
                                2.サーバー側で受信したデータを連結して、ひとつのデータファイルを作成
                                3.ドキュメント(https://www.hark.jp/document/3.0.0/hark-document-ja/)の
                                「(B-3) 送信アルゴリズム」に沿って、同データファイルをパースし、
                                Table 6.15 にある(j)のデータを id ごとに連結

                                今後とも、よろしくお願いいたします。

                              Viewing 15 posts - 1 through 15 (of 15 total)
                              • You must be logged in to reply to this topic.