[go: up one dir, main page]

JP3658661B2 - Data receiving apparatus and data transmitting apparatus - Google Patents

Data receiving apparatus and data transmitting apparatus Download PDF

Info

Publication number
JP3658661B2
JP3658661B2 JP35912196A JP35912196A JP3658661B2 JP 3658661 B2 JP3658661 B2 JP 3658661B2 JP 35912196 A JP35912196 A JP 35912196A JP 35912196 A JP35912196 A JP 35912196A JP 3658661 B2 JP3658661 B2 JP 3658661B2
Authority
JP
Japan
Prior art keywords
data
variable
transfer
received
word
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP35912196A
Other languages
Japanese (ja)
Other versions
JPH10190636A5 (en
JPH10190636A (en
Inventor
義徳 矢代
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Casio Computer Co Ltd
Original Assignee
Casio Computer Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Casio Computer Co Ltd filed Critical Casio Computer Co Ltd
Priority to JP35912196A priority Critical patent/JP3658661B2/en
Publication of JPH10190636A publication Critical patent/JPH10190636A/en
Application granted granted Critical
Publication of JP3658661B2 publication Critical patent/JP3658661B2/en
Publication of JPH10190636A5 publication Critical patent/JPH10190636A5/ja
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Electrophonic Musical Instruments (AREA)
  • Detection And Prevention Of Errors In Transmission (AREA)
  • Communication Control (AREA)
  • Computer And Data Communications (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、通信手段を介して接続された2つの装置間でデータを転送する技術に関する。
【0002】
【従来の技術】
音声発音機能を備えた装置、例えば電子楽器では、その音声発音機能によって発音できる音声(楽音)の選択肢を広げるために、音声(楽音)を発音するための音声データを他の装置(ここでは、転送側装置と呼ぶことにする)から必要に応じて供給するようなことも行われている。転送側装置から音声データを必要に応じて供給するようにした場合には、電子楽器(音声発音側の装置)は様々な音色で楽音を発音させることができるという利点に加えて、データを格納するためのメモリ容量が小さくて済むことから、コストを低減することができるという利点も得ることができる。
【0003】
【発明が解決しようとする課題】
上記のように、2つの装置間で音声データの転送を行った場合、その音声データによって発音される音声に不具合が生じないように、受信側である電子楽器はそれを正常に受信したか否かのチェックを行っている。そのチェックを行った結果、音声データの転送(受信)に異常(エラー)が発生していた場合、電子楽器は音声データの転送を転送側装置に再度要求して、それの受信を再度行っていた。
【0004】
しかし、このような音声データの従来の転送方法では、エラーの発生時におけるデータ転送に要する時間はそうでないときの2倍以上かかり、非常に長くなる。このため、例えば曲の演奏途中に行った音色の切り替え時にエラーが発生すると、発音させるべき楽音の発音タイミングが遅れたり、或いは発音できないことがあるという問題があった。
【0005】
周知のように、人間は発音タイミングの僅かなズレを認識することができる。発音タイミングの僅かなズレによって、人が受ける音楽的な(聴感上の)印象が大きく変わることも多い。これらのことからも明らかなように、発音タイミングのズレが音楽上で与える影響は非常に大きい。このことから、たとえデータの転送エラーの発生頻度が小さくとも、例えばエラー発生時のデータ転送にかかる時間を短縮するといったように、そのエラーの発生によって生じる影響を低減(或いは回避)することが強く望まれていた。
【0006】
本発明の課題は、データ転送に発生したエラーの影響を低減することにある。
【0007】
【課題を解決するための手段】
本発明の第1の態様によるデータ受信装置は、所定の通信手段を介して接続された外部装置から転送される処理単位のデータを受信することを前提とし、外部装置に対し、データの転送を要求する要求手段と、外部装置から転送されたデータを受信する受信手段と、データを構成するワードデータを処理内容に基づいて複数のワードデータ群に分類して、受信手段がデータを正常に受信したか否かをワードデータ群単位で判定する判定手段と、判定手段が正常でないと判定したワードデータ群が存在していた場合に、受信手段の受信状態に応じて、該ワードデータ群、及び他のワードデータ群の少なくとも一方を変更する変更手段と、を具備する。
【0011】
なお、上記の構成に加えて、判定手段が正常でないと判定したワードデータ群の再転送を要求するか否か決定する決定手段と、ワードデータ群の再転送を要求すると決定手段が決定した場合に、該ワードデータ群の再転送を外部装置に要求する再転送要求手段と、を更に具備し、変更手段は、ワードデータ群の再転送を要求しないと決定手段が決定した場合に、該ワードデータ群、及び他のワードデータ群の少なくとも一方を変更する、ことが望ましい。
【0012】
本発明のデータ送信装置は、上記データ受信装置にデータを送信することを前提とし、データ受信装置からのデータの転送要求、及びワードデータ群の再転送要求を受信する受信手段と、受信手段が受信した要求の内容に応じて、データ、及びワードデータ群の少なくとも一方をデータ受信装置に送信する送信手段と、を具備する。
【0015】
本発明の第1の態様のデータ受信装置は、転送を要求することで送信されてきたデータを、ワードデータ群単位でエラー発生の有無を監視し、エラーが発生していた場合に、その受信状態に応じて、例えばワードデータ群間の整合性をとるようにワードデータ群を変更する。これにより、エラーによって生じる不具合を低減することが可能となる。
【0016】
本発明のデータ送信装置は、上記データ受信装置からのデータの転送要求、或いは再転送要求に応じて、データ全体、或いはワードデータ群の送信を行う。これにより、上記データ受信装置は、必要なデータ、或いはワードデータ群だけを、必要に応じて得ることが可能となる。
【0017】
【発明の実施の形態】
以下、図面を参照しながら、本発明の実施の形態につき詳細に説明する。
<第1の実施の形態>
図1は、第1の実施の形態が適用されたシステムの概観図である。
【0018】
図1に示すように、上記システムは、ユーザに演奏操作される鍵盤102を備えた電子楽器101と、それにケーブル104によって接続されたパーソナルコンピュータ(以降、パソコンと記す)103とから構成されている。第1の実施の形態によるデータ受信装置は電子楽器101に、第1の実施の形態によるデータ送信装置はパソコン103に適用されている。
【0019】
図2は、上記電子楽器101の全体回路図である。次に、図2を参照して、その構成、及び動作について説明する。また、パソコン103の動作についても合わせて説明する。
【0020】
図2に示すように、電子楽器101は、楽器全体の制御を実行するCPU201と、プログラムや制御データ、自動演奏データ等を格納したROM202と、CPU201がワーク用に使用するRAM203と、不図示のコネクタを介してパソコン103を含む他の装置とのデータの送受信を行うインターフェイス(I/F)204と、鍵盤102のスキャンを行うキーマトリクス回路205と、そのキーマトリクス回路205によってスキャンされるスイッチ群206と、CPU201の指示に従って楽音を発音するサウンドシステム207とを備えて構成されている。
【0021】
以上の構成において、その概略動作を説明する。
楽器101の電源がオンされると、CPU201は、ROM202からプログラムを読み出してそれを実行することにより、楽器101の制御を開始する。その制御は、鍵盤102やスイッチ群206に対してユーザが行った操作、更にはインターフェイス204を介して他の装置から送信されたデータに応じて行われる。なお、他の装置については、混乱を避けるために、パソコン103に特定して以降の説明を行うことにする。
【0022】
上記スイッチ群206は、自動演奏モードの設定用の自動演奏モードスイッチ、自動演奏のスタートやストップを指示するためのスタート/ストップスイッチ、音色の変更を指示するためのトーンボタン、音色や自動演奏させる曲などを番号で指定するための0〜9ボタン等の各種スイッチをまとめて表したものである。CPU201は、キーマトリクス回路205に鍵盤102やスイッチ群206のスキャンを行わせ、そのスキャン後の信号を解析することにより、それらの操作状態や、行われた操作を検出して、その検出結果に従って楽器101全体の制御を実行する。
【0023】
ユーザが鍵盤102の操作を行った場合、CPU201は、ユーザが操作した鍵、及びその操作内容を特定し、それら特定した内容に応じて制御コマンドを生成してサウンドシステム207に出力する。それにより、サウンドシステム207は、ユーザが鍵盤102に行った操作に応じて楽音の発音を開始したり、発音中の楽音を消音させる。
【0024】
上記サウンドシステム207は、例えば音源LSI、D/Aコンバータ、アンプ、及びスピーカから構成されている。音源LSIは、例えばPCM方式で符号化された波形データを内部のメモリに格納し、その波形データを読み出す速さを変えることにより、様々な音高の波形データを生成し、必要に応じて、生成した波形データに音響効果を付加する処理を施してD/Aコンバータに出力する。D/Aコンバータは、波形データをアナログのオーディオ信号に変換してアンプに出力し、アンプはそれの増幅を行ってスピーカに出力する。アンプからスピーカにオーディオ信号が出力されることにより、楽音が発音される。
【0025】
上記音源LSI内のメモリに格納させる波形データは、例えばROM202に、その構成を表す情報と合わせてファイル形式で格納されている。CPU201は、ユーザがスイッチ群206を介して指定した音色に応じて、ROM202から波形データを読み出して音源LSIに送出することにより、音色の切り換えを行う。なお、そのファイル形式で格納されたデータ一式については、波形データと区別するために、音声データと呼ぶことにする。
【0026】
ROM202に格納されていない音声データは、音声データを供給するアプリケーションプログラムをパソコン103上で起動させることで取得することができる。このアプリケーションプログラムは、例えばパソコン103のハードディスク上にインストールさせて使用するようにしたものであっても良いが、CD−ROMといった記憶媒体に格納して配布し、その記憶媒体から必要に応じて主記憶装置上にロードさせて(例えばドライブに装着時)使用するようにしたものであっても良い。第1の実施の形態では、様々な音声データを用意しなければならないことから後者を採用し、アプリケーションプログラムを音声データ等とともに記憶媒体に格納させて配布している。
【0027】
ユーザがROM202に格納されていない音声データの音色を選択した場合、CPU201は、パソコン103に対し、インターフェイス204を介して、ユーザが選択した音色に対応する音声データの転送を要求する音声データ転送要求コマンドを送る。他方のパソコン103は、その要求コマンドを受け取ると、その内容に従って記憶媒体(例えばCD−ROM)から該当する音声データを含むファイルを検索し、電子楽器101に検索した音声データを転送する。
【0028】
図3は、上記音声データの構成図である。図3に示すように、音声データはヘッダ部とPCMデータ部とから構成され、そのPCMデータ部はストレート部とループ部とから構成されている。
【0029】
上記ヘッダ部は、PCMデータ部を適切に制御するために必要なワードデータ群であり、そのデータ転送や発音処理は、ヘッダ部に格納された情報に基づいて行われる。そのヘッダ部には、第1及び第2バイト目にはストレート部のデータ数、第3バイト目にはそのストレート部のチェックサム値、第4及び第5バイト目にはループ部のデータ数、第6バイト目にはループ部のチェックサム値が格納されている。
【0030】
PCMデータ部は、実際の音声のアナログ信号をサンプリングしてデジタルデータに変換した1ワードが8ビットのデータ群である。それを構成するストレート部には、楽音の発音において1回だけ処理されるデータが格納され、ループ部には、ストレート部の処理に引き続いて繰り返し処理されるデータが格納されている。
【0031】
なお、音声データが声のデータであった場合には、上記ストレート部は発音の頭の子音部分に相当するワードデータ群であり、他方のループ部は発音の後ろのほうの母音部分に相当するワードデータ群である。
【0032】
図4は、上記音声データ要求コマンドの構成図である。図4に示すように、3バイトのデータとして構成されている。
第1バイト目に格納されるコマンドIDは、パソコン103に要求する内容を表すコマンドのコードである。第2バイト目の音声データ番号は、転送を要求する音声データを指定するデータである。第3バイト目のデータ転送形式は、音声データのなかで転送を要求する部分を指定するコードである。
【0033】
第1の実施の形態では、データ転送形式として、3種類の値を用意、換言すれば音声データを転送する形式を3種類に分けている。ここでは、上記3種類の値を、DATA HEADER 、DATA STRAIGHT 、DATA LOOP とする。DATA HEADER は、音声データの全ての転送を要求していることを表し、DATA STRAIGHT はPCMデータ部全ての転送を、DATA LOOP はPCMデータ部中のループ部のみの転送を要求していることをそれぞれ表している。
【0034】
電子楽器101側のCPU201は、ユーザが音色の指定を行うと、コマンドIDには音声データ転送要求コマンドである旨を示すコードの値、音声データ番号にはユーザが音色の指定に入力した番号、データ転送形式にはDATA HEADER をそれぞれ格納したコマンドを生成してインターフェイス204に出力し、インターフェイス204を介してパソコン103にコマンドを送る。
【0035】
データ転送には、何らかの理由からエラーが発生することがある。このため、CPU201は、上記コマンドを送った後に開始されるパソコン103のデータ転送が正常に行われているか否かの監視を、音声データの各部毎に行う。その監視を行った結果、正常に転送されていない部分を検出すると、その部分のデータの転送を要求する音声データ転送要求コマンドを生成してそれをパソコン103に送る。
【0036】
他方のパソコン103は、電子楽器101からコマンドを受け取ると、コマンドIDからそのコマンドの種別を特定し、電子楽器101の要求に応じてデータを転送するといった処理を行う。そのコマンドが音声データ転送要求コマンドであった場合には、音声データ番号で指定された音声データをCD−ROM等の記憶媒体から取得し、その取得した音声データから、データ転送形式で指定された部分を抽出して電子楽器101に転送する。これにより、電子楽器101側の要求に応じて、音声データの全て、或いはその一部分がパソコン103から電子楽器101に転送される。
【0037】
電子楽器101のCPU201は、パソコン103から転送されたデータを、インターフェイス204を介して受け取り、RAM203に格納する。そのデータ転送が正常に完了すると、その音声データをサウンドシステム207に送出する。それにより、パソコン103から転送された音声データで楽音を発音させることができる。
【0038】
第1の実施の形態では、上述したように、音声データを処理内容に基づいて複数の部分に分割し、各部分毎に独立してデータ転送を行えるようにしている。このため、エラーが発生しても、そのエラーが発生した部分だけの再転送を行うだけで良く、転送が正常に行われた部分の再転送を回避することができる。それにより、エラー発生時でのデータ転送にかかる時間を短縮することができ、発音タイミングの遅れ等を回避、或いはその遅れ等を小さくすることができる。
【0039】
以上が、電子楽器101、及びパソコン103の動作の概略である。次に、図5〜図7を参照して電子楽器101の動作を、また、図8を参照してパソコン103の動作を詳細に説明する。
【0040】
図5は、電子楽器101で実行される全体処理の動作フローチャートである。始めに、図5を参照して、全体処理について詳細に説明する。なお、全体処理は、CPU201が、ROM202に格納されているプログラムを読み出して実行することにより実現される処理である。
【0041】
楽器101の電源がオンされると、CPU201は、ROM202からプログラムを読み出してその制御を開始する。その制御の開始時には、ステップ501が実行される。
【0042】
そのステップ501では、楽器101を予め定められた状態に初期設定するイニシャル処理を実行する。このイニシャル処理を実行することにより、RAM203、或いはCPU201内のレジスタに保持される各種制御用の変数には、それぞれ、予め定められた初期値が代入される。例えば音声データの転送に関わる変数byDataReceivingStatus 、wDataCounter、wLoopNum、byCheckSumには、それぞれ、DATA HEADER 、0、6、0が代入される。このようなイニシャル処理が終了した後、ステップ502に移行する。
【0043】
なお、上記変数byDataReceivingStatus は、パソコン103が音声データのどの部分を転送しているかを管理するための変数である。他の変数については、変数wDataCounterは音声データの各部分で受信したデータ(ワード)数をカウントするための変数、変数wLoopNumは各部分で受信すべきデータ(ワード)数が代入される変数であり、ヘッダ部のデータ数は6であることから、上記イニシャル処理では6が代入される。最後の変数byCheckSumは、各部(ここでは、ストレート部とループ部)でデータを正確に受信できたか否かを判定するために使用される。具体的には、各部においてそれまでに受信したデータのチェックサムの計算結果(例えば排他的論理和)が代入される。
【0044】
ステップ502では、スイッチ群206の操作状態、及び各種のスイッチに対して行われた操作を検出し、その検出結果に基づいて各種の設定等を行うスイッチ処理を実行する。このスイッチ処理の実行により、ユーザはスイッチ群206に対する操作を介して各種モードや音色、テンポ、自動演奏させる曲等を設定することができる。
【0045】
ステップ502に続くステップ503では、鍵盤102に対して行われた操作を検出し、その検出結果に基づいて楽音を発音させる鍵盤処理を実行する。この鍵盤処理の実行により、ユーザは鍵盤102への操作を介して所望の楽音を随時発音させることができる。
【0046】
鍵盤処理が終了すると、ステップ504に移行する。そのステップ504では、自動演奏データに従って曲を再生する曲再生処理を実行する。その曲再生処理を終了した後、ステップ505に移行する。
【0047】
なお、上記自動演奏データは、例えばスタンダードMIDIファイル(SMF)の形式で用意されたデータである。SMFは、MIDIのイベントデータに時間情報を付加して構成されたデータストリームである。このため、自動演奏データに従った曲の再生は、その時間情報に従って順次MIDIイベントを処理していくことで行われる。
【0048】
ステップ505では、データ受信処理を実行する。実際のデータの受信は、後述するインタラプト処理で行っている。ここで行われるのは、その受信したデータに対する処理であり、受信した音声データのサウンドシステムへの送出は、ここで行われる。
【0049】
ステップ505に続くステップ506では、パソコン103に、音声データの転送を要求する音声データ要求処理を実行する。ここで要求される音声データは、ステップ502のスイッチ処理、ステップ503の鍵盤処理、或いはステップ504の曲再生処理を実行することで特定したものである。その音声データ要求処理を終了すると、ステップ502に戻る。
【0050】
このように、ステップ502〜506で形成される処理ループが繰り返し実行される。これにより、ユーザが指定した曲の自動演奏や、所望する楽音が所望の音色で発音されることになる。
【0051】
図6は、上記全体処理内でステップ506として実行される音声データ要求処理の動作フローチャートである。次に、図6を参照して、そのサブルーチン処理について詳細に説明する。
【0052】
なお、音声データの転送の要求は、ユーザがスイッチ群206を操作して指定した音色や、自動演奏データ中のプログラムチェンジが指定する音色が電子楽器101(ROM202)に用意されていないときに生じる。また、設定方法等についての説明は省略するが、鍵盤102の各鍵毎、或いは1つ以上の鍵で構成させた各グループ毎に、異なる音色、或いは楽音を割り当てた場合には、鍵盤102をユーザが操作する度に音色データの転送を要求する必要が生じる。音色データ要求処理では、これらのようなことから必要になった音声データの転送をパソコン103に要求することが行われる。
【0053】
先ず、ステップ601では、ステップ502のスイッチ処理、ステップ503の鍵盤処理、或いはステップ504の曲再生処理を実行することによって必要と認識した音声データの転送を要求する音声データ転送要求コマンドを作成する。このとき、第3バイト目のデータ転送形式には、音声データの全てが必要であることから、DATA HEADER が格納される。
【0054】
ステップ601に続くステップ602では、上記作成した音声データ転送要求コマンドを送信データバッファに書き込む。その書き込みが終了した後、一連の処理を終了する。
【0055】
上記送信データバッファは、インターフェイス204内のバッファに設けられた送信用の記憶領域である。このため、ステップ602の処理は、CPU201が、インターフェイス204に作成した音声データ転送要求コマンドを出力し、そのコマンドを、内部に備えたバッファ内の送信データバッファ(記憶領域)に書き込ませることで実現される。
【0056】
パソコン103は、ケーブル104を介して、インターフェイス204のバッファにアクセスする。このため、インターフェイス204内のバッファに音声データ転送要求コマンドを書き込むことにより、そのコマンドがパソコン103に送られることになる。
【0057】
なお、上述した音声データ要求処理の処理動作は、パソコン103に音声データの転送を要求する場合のものである。音声データの転送を要求する必要がない場合には、ステップ601及び602の処理を実行せずに一連の処理が終了することになる。
【0058】
図7は、データ受信インタラプト処理の動作フローチャートである。次に、図7を参照して、このインタラプト処理について詳細に説明する。
音声データ転送要求コマンドを受け取ったパソコン103は、そのコマンドが指定する音声データを1バイト(ワード)ずつ転送する。インターフェイス204は、パソコン103からデータを内部のバッファに格納するとともに、CPU201に対して割り込みを発生させる。データ受信インタラプト処理は、その割り込みの発生により実行される処理である。
【0059】
CPU201は、音声データの転送をパソコン103に要求した場合、音声データを格納する領域を各部分毎にRAM203内に用意し、パソコン103から転送される音声データをその領域に一旦格納する。データ受信インタラプト処理では、インターフェイス204が受信したデータが音声データ中のどの部分のものであるか、また、各部分のデータが正常に転送されているかを判定しながら、音声データをRAM203に格納することが行われる。
【0060】
先ず、ステップ701では、変数byDataReceivingStatus に代入されている値を判定する。上記したように、変数byDataReceivingStatus は、現在受信中のデータが音声データのどの部分かを把握するための変数であり、DATA HEADER 、DATA STRAIGHT 、及びDATA LOOP の3種類の値のうちの一つが代入される。DATA HEADER はヘッダ部のデータを受信中であることを表し、DATA STRAIGHT はストレート部、DATA LOOP はループ部のデータを受信中であることをそれぞれ表している。
【0061】
変数byDataReceivingStatus にDATA HEADER が代入されていた場合、ステップ702に移行する。そのステップ702では、受信データを、RAM203内のヘッダ部用のデータ格納領域に格納する。その格納が終了すると、ステップ707に移行する。
【0062】
変数byDataReceivingStatus にDATA STRAIGHT が代入されていた場合には、ステップ703に移行する。そのステップ703では、受信データを、RAM203内のPCMデータ部用のデータ格納領域に格納し、続くステップ704では、チェックサム値の計算を行い、その計算結果を変数byCheckSumに代入する。それが終了すると、ステップ707に移行する。
【0063】
チェックサム値としては、図3に示すように、PCMデータ部を構成するストレート部、ループ部の2つの値をヘッダ部に格納させている。チェックサムの計算はストレート部とループ部とで別々に行うようにしている。これにより、受信を正常に行えたか否かを部分毎に判定することができるようになっている。なお、チェックサム値の計算は、例えば、それまでに受信したデータの排他的論理和を算出、即ち変数byCheckSumと受信データの排他的論理和を算出することで行われる。
【0064】
変数byDataReceivingStatus にDATA LOOP が代入されていた場合には、ステップ705に移行する。そのステップ705では、受信データを、RAM203内のPCMデータ部用のデータ格納領域に格納し、続くステップ706では、チェックサム値の計算を行い、その計算結果を変数byCheckSumに代入する。それが終了すると、ステップ707に移行する。
【0065】
このように、ステップ701〜706では、受信データが音声データのどの部分に属しているかに応じてRAM203に格納することが行われる。
上記ステップ707では、音声データとして1バイト(ワードデータ)を受信したことから、変数wDataCounterの値のインクリメントを行う。その後、ステップ708に移行する。
【0066】
ステップ708では、変数wDataCounterの値が変数wLoopNumの値と等しいか否か判定する。変数wLoopNumは、ヘッダ部、ストレート部、或いはループ部の各部分を構成しているデータ(ワード)の総数が代入される変数であり、ヘッダ部のデータを受信している場合には6、ストレート部のデータを受信している場合にはヘッダ部の第1及び第2バイト目のデータ、ループ部のデータを受信している場合にはヘッダ部の第4及び第5バイト目のデータがそれぞれ代入される。このため、現在受信中の部分のデータを全て受信した場合、その判定はYESとなってステップ709に移行する。そうでない場合には、その判定はNOとなって一連の処理を終了する。
【0067】
ステップ709以降では、音声データを構成する1部分のデータの受信が完了したと判断して、それに伴う処理が行われる。その部分のデータの受信が正常に行えたか否か判定、即ちエラーの発生の有無を判定し、その判定結果に応じた処理はここで行われる。
【0068】
先ず、ステップ709では、変数wDataCounterの値をクリア、即ちそれに0を代入する。続くステップ710では、変数byDataReceivingStatus に代入されている値を判定する。変数byDataReceivingStatus にDATA HEADER が代入されていた場合、ステップ711に移行して、変数byDataReceivingStatus とwLoopNumの更新を行う。具体的には、ヘッダ部の受信が完了したことから、変数byDataReceivingStatus にDATA STRAIGHT を代入し、他方の変数wLoopNumには、受信が完了したヘッダ部の第1及び第2バイト目のデータで構成される16ビットの値(第1バイト目が上位8ビット、第2バイト目が下位8ビットである)を代入する。それが終了した後に一連の処理を終了する。
【0069】
変数byDataReceivingStatus にDATA STRAIGHT が代入されていた場合には、ステップ712に移行する。そのステップ712では、変数byCheckSumに代入されているチェックサム値が、受信したヘッダ部の第3バイト目のチェックサム値と一致するか否か判定する。ストレート部の受信が正常に行われた場合、それらチェックサム値は一致することから判定はYESとなり、ステップ713に移行する。そうでない場合には、即ちエラーが発生している場合には、その判定はNOとなってステップ714に移行する。
【0070】
ステップ713では、変数byDataReceivingStatus 、wLoopNum、及びbyCheckSumの更新を行う。具体的には、ストレート部の受信を正常に完了したことから、変数byDataReceivingStatus にDATA LOOP を代入し、変数wLoopNumには、受信が完了したヘッダ部の第4及び第5バイト目のデータで構成される16ビットの値(第4バイト目が上位8ビット、第5バイト目が下位8ビットである)を代入し、変数byCheckSumには0を代入する。それが終了した後に一連の処理を終了する。
【0071】
他方のステップ714では、ストレート部の受信にエラーが発生したことから、このストレート部の転送を要求する音声データ転送要求コマンド(第3バイト目のデータ転送形式をDATA STRAIGHT としたコマンドである)を生成し、続くステップ715でそのコマンドをインターフェイス204の送信データバッファに書き込む。その後、一連の処理を終了する。
【0072】
上記再作成した音声データ転送要求コマンドを送信データバッファに書き込むことにより、パソコン103からストレート部のデータが再転送される。エラーが発生した場合、変数byDataReceivingStatus の更新を行っていないので、上記コマンドを送出後にパソコン103から転送されるデータはストレート部のデータとして受信される。
【0073】
一方、変数byDataReceivingStatus にDATA LOOP が代入されていた場合には、ステップ710からステップ716に移行する。そのステップ716では、変数byCheckSumに代入されているチェックサム値が、受信したヘッダ部の第6バイト目のチェックサム値と一致するか否か判定する。ループ部の受信が正常に行われた場合、それらチェックサム値は一致することから判定はYESとなり、ステップ717に移行する。そうでない場合には、即ちエラーが発生している場合には、その判定はNOとなってステップ718に移行する。
【0074】
ステップ717では、変数byDataReceivingStatus 、wLoopNum、及びbyCheckSumの更新を行う。具体的には、ループ部の受信を正常に完了、即ち音声データの受信を全て正常に完了したことから、変数byDataReceivingStatus にDATA HEADER を代入し、変数wLoopNumにはヘッダ部の全データ(ワード)数である6を代入し、変数byCheckSumには0を代入する。それが終了した後に一連の処理を終了する。
【0075】
他方のステップ718では、ループ部の受信にエラーが発生したことから、このループ部の転送を要求する音声データ転送要求コマンド(第3バイト目のデータ転送形式をDATA LOOP としたコマンドである)を生成し、続くステップ719でそのコマンドをインターフェイス204の送信データバッファに書き込む。その後、一連の処理を終了する。
【0076】
このように、第1の実施の形態では、ヘッダ部を除く各部分毎にデータ転送にエラーが発生したか否か判定し、エラーが発生していると判定すれば、そこでデータ転送を中断させて、エラーが発生した部分からデータ転送を再開するようにしている。
【0077】
各部分毎に独立にエラーを検出するようにしたことで、音声データ全体の転送が終了する前の段階で、即ち発生したエラーを迅速に検出することができる。エラーが発生した部分に限定してデータの再転送を行えるようにしたことで、実際に必要としているデータの転送にかかる時間を短縮することができる。エラーが発生した部分でデータの転送を中断させることにより、エラーの発生によって廃棄されるデータの転送にかかる時間を短縮することができる。これらにより、エラー発生時におけるデータ転送をより短時間で行うことができ、エラー発生時の影響を低減することができる。
【0078】
以上が電子楽器101側が実行する主要な処理である。次に、図8を参照して、パソコン103側が実行する動作について詳細に説明する。図8は、パソコン103が実行する全体処理の動作フローチャートである。
【0079】
なお、第1の実施の形態では、パソコン103から音声データを供給するアプリケーションプログラムをその音声データ等とともにCD−ROMで配布している。このことから、図8に示す全体処理は、そのCD−ROMに格納されているアプリケーションプログラムを起動、即ちそのアプリケーションプログラムを主記憶装置上にロードし、それにパソコン103のCPUの制御を割り当てることで実現される。
【0080】
また、図8に示す動作フローチャートは、上記アプリケーションプログラムをパソコン103のCPUが実行した際の処理動作のなかから、本発明に特に関わる部分を抜粋して示したものである。
【0081】
先ず、ステップ801では、コマンドを受信したか否か判定する。上記したように、パソコン103は、電子楽器101のインターフェイス204内のバッファにアクセスする。より具体的には、パソコン103のCPUは、パソコン103側のインターフェイス、ケーブル104を介して電子楽器101のインターフェイス204内のバッファにアクセスする。例えば上記インターフェイスは、インターフェイス204内に割り当てられた送信データバッファに何らかのコマンドが書き込まれていた場合に割り込み信号を出力し、その旨をCPUに通知するようになっている。このため、その送信データバッファ内に何らかのコマンドが書き込まれていた場合、その判定はYESとなってステップ802に移行する。そうでない場合には、その判定はNOとなって一連の処理を終了する。
【0082】
ステップ802では、上記送信データバッファに書き込まれていたコマンドを読み出して(受信して)解析を行う。それに続くステップ803では、コマンドを解析した結果、そのコマンドが音声データ転送要求コマンドか否か判定する。電子楽器101のインターフェイス204の転送データバッファ内に音声データ転送要求コマンドが書き込まれていた場合、その判定はYESとなってステップ805に移行する。そうでない場合には、その判定はNOとなってステップ804に移行する。
【0083】
ステップ804では、音声データ転送要求コマンド以外のコマンドに応じた処理を実行する。このコマンドに応じた処理では、一例を挙げればCDーROMに格納されている自動演奏データを電子楽器101に転送するといったことが行われる。それが終了した後、ステップ801に戻る。
【0084】
他方のステップ805では、音声データ転送要求コマンドの第2バイト目に格納されている音声データ番号に該当するファイルをCD−ROMから検索する。その検索が終了した後、ステップ806に移行し、検索したファイルから、上記コマンドの第3バイト目であるデータ転送形式で要求された部分のデータを抽出してその送信を行う。それが終了した後、ステップ801に戻る。
【0085】
上記したように、音声データは、8ビット(1ワード)毎に、電子楽器101側の受信に合わせて順次転送するようにしている。このため、実際のデータ転送は、インタラプト処理で行っている。
【0086】
そのインタラプト処理は、例えばパソコン103が備えたケーブル104に接続されているインターフェース(図示せず)が出力した割り込み信号(入出力割り込み)によって実行される処理である。それを実行することにより、1バイトのデータを電子楽器101側の動作に合わせて出力する。このようなことから、ステップ806でのデータの送信は、例えばその送信を開始することを電子楽器101に通知するといったことだけが行われる。
【0087】
なお、音声データを構成する各部分は、電子楽器101側に合わせて、ヘッダ部、ストレート部、ループ部の順序で転送される。また、音声データ転送要求コマンドのデータ転送形式の内容に応じて転送する部分についても、電子楽器101側の動作に合わせて設定される。即ち例えばデータ転送形式がDATA STRAIGHT であった場合には、PCMデータ部を構成するストレート部とループ部が共に転送される。
【0088】
上記のような処理動作が、上記アプリケーションプログラムの実行時にパソコン103上で行われる。これにより、電子楽器101からのデータ転送の要求、即ち音声データ転送要求コマンドに応じて、パソコン103から電子楽器101に音声データが1バイトずつ転送される。
【0089】
なお、第1の実施の形態では、音声データをヘッダ部、ストレート部、及びループ部の3つの部分に分割してデータ転送を行っているが、例えば各部のデータ量に応じてより細かく分割するようにしても良い。具体的には、例えばストレート部のデータ量が他の部分と比較して大きいような場合、そのストレート部を複数の部分に更に分割するようにしても良い。
<第2の実施の形態>
上記第1の実施の形態では、音声データをヘッダ部、ストレート部、及びループ部に分割して、それら各部のデータが正常に転送されたか否かをチェックし、エラーの発生を検出した時点でそのエラーが発生した部分のデータを無条件で再送するようにしている。これに対し、第2の実施の形態は、エラーの発生を検出したときのデータの再送を行うか否か選択できるようにしたものである。
【0090】
データの転送にエラーが発生した場合、転送されたデータで楽音を発音させると、エラーの内容によって程度は異なるが、聴感上、何らかの不具合を人に与える。しかし、例えば自動演奏中におけるプログラムチェンジ(音色変更)のように(このときには、ユーザの鍵盤102に対する押鍵に応じて楽音を発音させる必要もある)、迅速な発音のための処理を行わなければならない状況では、データの再送によって発音タイミングの遅れが発生することもありえるため、エラーの発生時にデータの再送を行うことは必ずしも得策とは限らない。このようなことから、第2の実施の形態は、データの再送を行うか否かを選択することで、ユーザがより快適な状態で楽音を発音させられることを実現できるようにさせたものである。
【0091】
第2の実施の形態による電子楽器は、第1の実施の形態によるそれと構成は基本的に同じであり、また、処理動作も基本的に同じである。パソコンについては、第1の実施の形態から構成、及び処理動作が変わっていない。このため、第1の実施の形態で使用した符号をそのまま使用して、第2の実施の形態による電子楽器101が第1の実施の形態によるそれから異なっている部分のみ説明することにする。
【0092】
第2の実施の形態では、エラー発生時にデータの再送を行うか否かを、ユーザが選択できるようにしている。その選択用として、図2に示すように、スイッチ群206を構成するスイッチの一つとして再送スイッチ206aを備えている。データの再送を行うか否かを示す変数(フラグ)として、bReTransferFlag を用意している。CPU201は、ユーザが上記再送スイッチ206aを操作する毎に、その変数bReTransferFlag に代入する値の変更を行う。
【0093】
なお、変数bReTransferFlag に代入される値は、データを再送するか否かの2種類であるが、それに代入されている値の意味を明確にするために、データを再送する場合(再送モード時)の値をTRUEと記載することにする。CPU201は、変数bReTransferFlag にTRUEを代入した場合には、例えば不図示のLEDを点灯させてその旨をユーザに通知することを合わせて行う。
【0094】
また、第2の実施の形態では、データ転送中に発生するデータの欠落を検出するために、それ用の1ワードのデータをPCMデータ部に挿入させている。
図9は、第2の実施の形態で用いられる音声データの構成図である。ループ部の先頭には、図9に示すように、1バイトの標識データを追加している。その標識データは、最上位ビットの値は1とし、PCMデータ部の他のデータは7ビットのデータ(最上位ビット(MSB)の値は0)としている。これにより、標識データを他のデータと区別することができるようにしている。
【0095】
図9に示すような音声データを転送した場合、上記標識データを受信したタイミングにより、データの欠落が発生したか否かを判定することができる。例えばヘッダ部の第1及び第2バイト目に格納されているデータ数だけデータを受信する前に標識データを受信した場合には、ヘッダ部、或いはストレート部でデータの欠落が発生したことになる。
【0096】
データの欠落は、データ全体の用法に影響することが多く、データを正確に受信できなかったときよりも聴感上の不具合が大きくなるのが普通である。第2の実施の形態では、エラーの内容によって影響の大きさが異なることから、影響の大きさを基にエラーを2種類に分類し、不具合が比較的に大きいエラーの発生時にはデータの再送を無条件で行い、それが比較的に小さいときにはユーザの指定(再送モードが設定されているか否か)に応じてデータの再送を行っている。
【0097】
以上が、第2の実施の形態の概要である。次に、上記エラー発生時におけるデータの再送を実現するための第2の実施の形態におけるCPU201の動作について詳細に説明する。
【0098】
第2の実施の形態における処理動作の流れは、第1の実施の形態のそれと同じである。その処理内容としては、データ受信インタラプト処理が第1の実施の形態から最も異なっている。他の処理においては、相違点が無いか、相違点が有ったとしても僅かである。このため、図10に示すその動作フローチャートを参照して、データ受信インタラプト処理のみ説明する。
【0099】
先ず、ステップ1001では、変数byDataReceivingStatus に代入されている値を判定する。上記したように、変数byDataReceivingStatus は、現在受信中のデータが音声データのどの部分かを把握するための変数であり、DATA HEADER 、DATA STRAIGHT 、及びDATA LOOP の3種類の値のうちの一つが代入される。
【0100】
変数byDataReceivingStatus にDATA HEADER が代入されていた場合、ステップ1002に移行する。そのステップ1002では、受信データを、RAM203内のヘッダ部用のデータ格納領域に格納する。その格納が終了すると、ステップ1012に移行する。
【0101】
変数byDataReceivingStatus にDATA STRAIGHT が代入されていた場合には、ステップ1003に移行する。そのステップ1003では、受信データが標識データか否か判定する。その受信データの最上位ビットの値が1であった場合、標識データを受信したとして判定はYESとなり、ステップ1006に移行する。そうでない場合には、その判定はNOとなってステップ1004に移行する。
【0102】
ステップ1004では、受信データを、RAM203内のPCMデータ部用のデータ格納領域に格納し、続くステップ1005では、チェックサム値の計算を行い、その計算結果を変数byCheckSumに代入する。それが終了すると、ステップ1012に移行する。
【0103】
ステップ1006に移行時には、ヘッダ部の第1及び第2バイト目に格納されているデータ数のデータの受信を行う前にストレート部の転送が終了したことになる。即ちデータの欠落が発生したことになる。このため、ステップ1006〜1008では、それに応じた処理を行う。具体的には、ステップ1006では、変数byDataReceivingStatus にDATA HEADER を、変数wLoopNumには6を、変数wDataCounterには0をそれぞれ代入し、ステップ1007ではデータ転送形式にDATA HEADER を格納した音声データ転送要求コマンドを再作成し、ステップ1008では、その再作成したコマンドをインターフェイス204の送信データバッファに格納する。それらが終了した後、一連の処理を終了する。
【0104】
変数byDataReceivingStatus にDATA LOOP が代入されていた場合には、ステップ1001からステップ1009に移行する。そのステップ1009では、受信データが標識データか否か判定する。その受信データの最上位ビットの値が1であった場合、それは標識データであることから、その判定はYESとなって一連の処理を終了する。そうでない場合には、その判定はNOとなってステップ1010に移行する。
【0105】
上記したように、ループ部の転送が開始する前にデータの欠落が発生すると、音声データ全体の再送を行っている。このため、ループ部の受信の開始時には、その先頭に追加した標識データを受信することになる。その標識データは楽音の再生には使用しないデータである。このため、電子楽器101側ではそれを廃棄している。
【0106】
他方のステップ1010では、受信データを、RAM203内のPCMデータ部用のデータ格納領域に格納し、続くステップ1011では、チェックサム値の計算を行い、その計算結果を変数byCheckSumに代入する。それが終了すると、ステップ1012に移行する。
【0107】
このように、ステップ1001〜1011では、受信データが音声データのどの部分に属しているかに応じてRAM203に格納するとともに、データの欠落が発生したか否かに応じて音声データの再送が行われる。
【0108】
上記ステップ1012では、音声データとして1バイト(1ワード)を受信したことから、変数wDataCounterの値のインクリメントを行う。その後、ステップ1013に移行する。
【0109】
ステップ1013では、変数wDataCounterの値が変数wLoopNumの値と等しいか否か判定する。変数wLoopNumは、ヘッダ部、ストレート部、或いはループ部の各部分を構成しているワードの総数が代入される変数であり、ヘッダ部のデータを受信している場合には6、ストレート部のデータを受信している場合にはヘッダ部の第1及び第2バイト目のデータ、ループ部のデータを受信している場合にはヘッダ部の第4及び第5バイト目のデータがそれぞれ代入される。このため、現在受信中の部分のデータを全て受信した場合、その判定はYESとなってステップ1014に移行する。そうでない場合には、その判定はNOとなって一連の処理を終了する。
【0110】
ステップ1014以降では、音声データを構成する1部分のデータの受信が完了したと判断して、それに伴う処理が行われる。その部分のデータの受信が正常に行えたか否か判定、即ちエラーの発生の有無を判定して、その判定結果に応じた対処が行われる。
【0111】
先ず、ステップ1014では、変数wDataCounterの値をクリア、即ちそれに0を代入する。続くステップ1015では、変数byDataReceivingStatus に代入されている値を判定する。変数byDataReceivingStatus にDATA HEADER が代入されていた場合、ステップ1016に移行して、変数byDataReceivingStatus とwLoopNumの更新を行う。具体的には、ヘッダ部の受信が完了したことから、変数byDataReceivingStatus にDATA STRAIGHT を代入し、他方の変数wLoopNumには、受信が完了したヘッダ部の第1及び第2バイト目のデータで構成される16ビットの値(第1バイト目が上位8ビット、第2バイト目が下位8ビットである)を代入する。それが終了した後に一連の処理を終了する。
【0112】
変数byDataReceivingStatus にDATA STRAIGHT が代入されていた場合には、ステップ1017に移行する。そのステップ1017では、変数byCheckSumに代入されているチェックサム値が、受信したヘッダ部の第3バイト目のチェックサム値と一致するか否か判定する。ストレート部の受信が正常に行われた場合、それらチェックサム値は一致することから判定はYESとなり、ステップ1018に移行する。そうでない場合には、即ちエラーが発生している場合には、その判定はNOとなってステップ1019に移行する。
【0113】
ステップ1018では、変数byDataReceivingStatus 、wLoopNum、及びbyCheckSumの更新を行う。具体的には、ストレート部の受信を正常に完了したことから、変数byDataReceivingStatus にDATA LOOP を代入し、変数wLoopNumには、受信が完了したヘッダ部の第4及び第5バイト目のデータで構成される16ビットの値(第4バイト目が上位8ビット、第5バイト目が下位8ビットである)を代入し、変数byCheckSumには0を代入する。それらが終了した後に一連の処理を終了する。
【0114】
他方のステップ1019では、変数bReTransferFlag にTRUEが代入されているか否か判定する。ユーザが再送スイッチ206aを操作してエラー発生時のデータの再送を指定、即ち再送モードを設定していた場合、その判定はYESとなってステップ1020に移行する。そうでない場合には、即ちエラー発生時にもデータの転送の続行をユーザが指定していた場合には、その判定はNOとなって上述のステップ1018に移行する。
【0115】
ステップ1020では、データ転送形式にDATA STRAIGHT を格納した音声データ転送要求コマンドを再作成する。続くステップ1021では、その再作成したコマンドをインターフェイス204の送信データバッファに格納する。その後、一連の処理を終了する。
【0116】
このように、変数bReTransferFlag に代入されている値に応じて、エラー発生時にデータの再送が行われる。変数bReTransferFlag に代入されている値は、再送スイッチ206aに対する操作によって変化させることができる。このため、ユーザは、楽音の発音状態を制御することができ、より快適に電子楽器101を使用することができる。即ち再送モードを設定しない場合には発音タイミングの遅れを回避、或いはその遅れを最小限に抑えさせることができ、それを設定した場合には、発音される楽音の音質の低下を回避させることができる。
【0117】
一方、変数byDataReceivingStatus にDATA LOOP が代入されていた場合には、ステップ1015からステップ1022に移行する。そのステップ1022では、変数byCheckSumに代入されているチェックサム値が、受信したヘッダ部の第6バイト目のチェックサム値と一致するか否か判定する。ループ部の受信が正常に行われた場合、それらチェックサム値は一致することから判定はYESとなり、ステップ1023に移行する。そうでない場合には、即ちエラーが発生している場合には、その判定はNOとなってステップ1024に移行する。
【0118】
ステップ1023では、変数byDataReceivingStatus 、wLoopNum、及びbyCheckSumの更新を行う。具体的には、ループ部の受信を正常に完了、即ち音声データの受信を全て正常に完了したことから、変数byDataReceivingStatus にDATA HEADER を代入し、変数wLoopNumにはヘッダ部の全データ(ワード)数である6を代入し、変数byCheckSumには0を代入する。それらの終了後、一連の処理を終了する。
【0119】
他方のステップ1024では、ループ部の受信にエラーが発生したことから、このループ部の転送を要求する音声データ転送要求コマンド(第3バイト目のデータ転送形式をDATA LOOP としたコマンドである)を生成し、続くステップ1025でそのコマンドをインターフェイス204の送信データバッファに書き込む。その後、一連の処理を終了する。
【0120】
このように、第2の実施の形態では、ストレート部の受信でエラーが発生すると、再送モードが設定されているか否かに応じてデータの再送を要求するが、ループ部の受信でエラーが発生すると無条件でデータの再送を要求している。これは、ストレート部は発音において1回だけ処理される部分であることから、繰り返し処理されるループ部よりもエラーの影響が比較的に小さいためである。
【0121】
このことから判るように、音声データをヘッダ部、ストレート部、及びループ部とに分ける分割方法は、各部分の重要度に着目した分割方法でもある。各部分のデータの処理内容に応じてデータを分割することにより、重要度に着目した分割を行うことができる。このため、上記のように、重要度に応じたデータの再送を行うことができるようになる。換言すれば、エラー発生時には階層的に対処することができ、ユーザの様々な要求に柔軟に対応できる。
【0122】
なお、第2の実施の形態では、データ欠落検出用の標識データを一つだけ音声データ中に挿入しているが、例えばストレート部の先頭、更にはループ部の最後といったように、それを複数挿入して、各部毎にデータの欠落を検出できるようにしても良い。このようにした場合、データの欠落の検出時には、各部毎にデータの再送を要求すれば良い。その再送の要求は、エラーを検出して直ちに行っても良いが、音声データ全体の転送が終了した後に行うようにしても良い。
【0123】
また、第2の実施の形態では、エラー発生時にデータの再送を行うか否かをユーザに選択させているが、その選択を自動的に行うようにしても良い。例えば、自動演奏モードによる曲の演奏中か否かといった設定状態に基づいて、データの再送を行うか否か決定するようにしても良い。
<第3の実施の形態>
上記第2の実施の形態では、上述したように、データの欠落を検出した場合、直ちに音声データの再送を要求するようにしている。これに対し、第3の実施の形態は、データの欠落を検出した場合において、データを再送させるか否かの選択を更に行えるようにしたものである。
【0124】
第3の実施の形態による電子楽器は、第2の実施の形態によるそれと構成は基本的に同じであり、また、処理動作も基本的に同じである。パソコンについては、第1の実施の形態から構成、及び処理動作が変わっていない。このため、第1の実施の形態で使用した符号をそのまま使用して、第3の実施の形態による電子楽器101が第2の実施の形態によるそれから異なっている部分のみ説明することにする。
【0125】
第2の実施の形態では、エラーを、データの欠落と、データの不正確な受信(転送)との2種類に分類し、前者のエラー発生時にはデータの再送、後者のそれの発生時にはユーザの指定、即ち再送モードが設定されているか否かに応じたデータの再送を行っている。第3の実施の形態では、再送モードが設定されているか否かに応じて、データが欠落したエラーの発生時におけるデータの再送を行うようにしている。
【0126】
音声データを用いた楽音の発音は、基本的にヘッダ部に格納されている情報を基に行われる。データが欠落すると、そのヘッダ部の情報と実際のデータの構成とが一致しなくなる。このため、第3の実施の形態では、データの欠落の発生(検出)にデータの再送を行わない場合、データの受信状態に応じてヘッダ部の情報の変更を行い、整合性をとっている。
【0127】
以上が、第3の実施の形態の概要である。次に、上記エラー発生時におけるデータの再送を実現するための第3の実施の形態におけるCPU201の動作について詳細に説明する。
【0128】
第3の実施の形態における処理動作の流れは、第1及び第2の実施の形態のそれと同じである。その処理内容としては、データ受信インタラプト処理が第2の実施の形態から最も異なっている。他の処理においては、相違点が無いか、相違点が有ったとしても僅かである。このため、図11に示すその動作フローチャートを参照して、データ受信インタラプト処理のみ説明する。
【0129】
先ず、ステップ1101では、変数byDataReceivingStatus に代入されている値を判定する。上記したように、変数byDataReceivingStatus は、現在受信中のデータが音声データのどの部分かを把握するための変数であり、DATA HEADER 、DATA STRAIGHT 、及びDATA LOOP の3種類の値のうちの一つが代入される。
【0130】
変数byDataReceivingStatus にDATA HEADER が代入されていた場合、ステップ1102に移行する。そのステップ1102では、受信データを、RAM203内のヘッダ部用のデータ格納領域に格納する。その格納が終了すると、ステップ1115に移行する。
【0131】
変数byDataReceivingStatus にDATA STRAIGHT が代入されていた場合には、ステップ1103に移行する。そのステップ1103では、受信データが標識データか否か判定する。その受信データの最上位ビットの値が1であった場合、標識データを受信したとして判定はYESとなり、ステップ1106に移行する。そうでない場合には、その判定はNOとなってステップ1104に移行する。
【0132】
ステップ1104では、受信データを、RAM203内のPCMデータ部用のデータ格納領域に格納し、続くステップ1105では、チェックサム値の計算を行い、その計算結果を変数byCheckSumに代入する。それが終了すると、ステップ1115に移行する。
【0133】
ステップ1106に移行時には、ヘッダ部の第1及び第2バイト目に格納されているデータ数のデータの受信を行う前にストレート部の転送が終了したことになる。即ちデータの欠落が発生したことになる。このため、ステップ1106〜1111では、データ欠落時における処理が行われる。
【0134】
先ず、ステップ1106では、変数bReTransferFlag にTRUEが代入されているか否か判定する。ユーザが再送スイッチ206aを操作して再送モードを設定していた場合、その判定はYESとなってステップ1107に移行する。そうでない場合には、その判定はNOとなってステップ1110に移行する。
【0135】
ステップ1107〜1109では、データ欠落のエラー発生に応じてデータの再送を要求する処理が行われる。具体的には、ステップ1107では変数wDataCounterに0を代入し、ステップ1108ではデータ転送形式にDATA STRAIGHT を格納した音声データ転送要求コマンドを再作成し、ステップ1109では再作成したコマンドをインターフェイス204内の送信データバッファに書き込む。それらが終了した後、一連の処理を終了する。
【0136】
他方のステップ1110、及び1111では、データ欠落に応じたデータの再送を行わないことから、その欠落に対処するための処理が行われる。
ステップ1110では、既に受信したヘッダ部のデータの書き換えを行う。具体的には、RAM203内に割り当てたヘッダ部のデータ格納領域に格納されているヘッダ部の第1及び第2バイト目のデータを、変数wDataCounterに代入されている実際に受信したストレート部のデータ数に書き換える。それが終了した後、ステップ1111に移行し、変数byDataReceivingStatus にDATA LOOP 、変数wLoopNumにヘッダ部の第4及び第5バイト目のデータ、変数wDataCounterに0をそれぞれ代入する。標識データは、ループ部の先頭に挿入されている。このため、変数byDataReceivingStatus にDATA LOOP を代入することにより、標識データに続いて転送されるループ部のデータを受信することができる。そのステップ1111を終了した後、一連の処理を終了する。
【0137】
このように、再送モードの未設定時にストレート部でデータの欠落が発生した場合、ストレート部の実際の受信状態に応じたヘッダ部のデータの書き換えを行い、ヘッダ部とストレート部の間の整合性をとっている。これにより、データ欠落によって生じる聴感上の不具合を最小限に抑えることができる。
【0138】
一方、変数byDataReceivingStatus にDATA LOOP が代入されていた場合には、ステップ1101からステップ1112に移行する。そのステップ1112では、受信データが標識データか否か判定する。その受信データの最上位ビットの値が1であった場合、それは標識データであることから、その判定はYESとなって一連の処理を終了する。そうでない場合には、その判定はNOとなってステップ1113に移行する。
【0139】
上記したように、ループ部の転送が開始する前にデータの欠落が発生すると、音声データの再送、或いはヘッダ部のデータの書き換えが行われている。このため、ループ部の受信の開始時には、その先頭に追加されている標識データを受信していることになる。その標識データは楽音の再生には使用しないデータである。このため、標識データを受信した場合にはそれを廃棄している。
【0140】
ステップ1113では、受信データを、RAM203内のPCMデータ部用のデータ格納領域に格納し、続くステップ1114では、チェックサム値の計算を行い、その計算結果を変数byCheckSumに代入する。それが終了すると、ステップ1115に移行する。
【0141】
このように、ステップ1101〜1114では、受信データが音声データのどの部分に属しているかに応じてRAM203に格納するとともに、データの欠落が発生したか否か、及び再送モードが設定されているか否かに応じて音声データの再送、或いはヘッダ部のデータの書き換えが行われる。
【0142】
上記ステップ1115では、音声データとして1バイト(1ワード)を受信したことから、変数wDataCounterの値のインクリメントを行う。その後、ステップ1116に移行する。
【0143】
ステップ1116では、変数wDataCounterの値が変数wLoopNumの値と等しいか否か判定する。変数wLoopNumは、ヘッダ部、ストレート部、或いはループ部の各部分を構成しているワードの総数が代入される変数であり、ヘッダ部のデータを受信している場合には6、ストレート部のデータを受信している場合にはヘッダ部の第1及び第2バイト目のデータ、ループ部のデータを受信している場合にはヘッダ部の第4及び第5バイト目のデータがそれぞれ代入される。このため、現在受信中の部分のデータを全て受信した場合、その判定はYESとなってステップ1117に移行する。そうでない場合には、その判定はNOとなって一連の処理を終了する。
【0144】
ステップ1117以降では、音声データを構成する1部分のデータの受信が完了したと判断して、それに伴う処理が行われる。その部分のデータの受信が正常に行えたか否か判定、即ちエラーの発生の有無を判定して、その判定結果に応じた対処が行われる。
【0145】
先ず、ステップ1117では、変数wDataCounterの値をクリア、即ちそれに0を代入する。続くステップ1118では、変数byDataReceivingStatus に代入されている値を判定する。変数byDataReceivingStatus にDATA HEADER が代入されていた場合、ステップ1119に移行して、変数byDataReceivingStatus とwLoopNumの更新を行う。具体的には、ヘッダ部の受信が完了したことから、変数byDataReceivingStatus にDATA STRAIGHT を代入し、他方の変数wLoopNumには、受信が完了したヘッダ部の第1及び第2バイト目のデータで構成される16ビットの値(第1バイト目が上位8ビット、第2バイト目が下位8ビットである)を代入する。それが終了した後に一連の処理を終了する。
【0146】
変数byDataReceivingStatus にDATA STRAIGHT が代入されていた場合には、ステップ1120に移行する。そのステップ1120では、変数byCheckSumに代入されているチェックサム値が、受信したヘッダ部の第3バイト目のチェックサム値と一致するか否か判定する。ストレート部の受信が正常に行われた場合、それらチェックサム値は一致することから判定はYESとなり、ステップ1121に移行する。そうでない場合には、即ちエラーが発生している場合には、その判定はNOとなってステップ1122に移行する。
【0147】
ステップ1121では、変数byDataReceivingStatus 、wLoopNum、及びbyCheckSumの更新を行う。具体的には、ストレート部の受信を正常に完了したことから、変数byDataReceivingStatus にDATA LOOP を代入し、変数wLoopNumには、受信が完了したヘッダ部の第4及び第5バイト目のデータで構成される16ビットの値(第4バイト目が上位8ビット、第5バイト目が下位8ビットである)を代入し、変数byCheckSumには0を代入する。それが終了した後に一連の処理を終了する。
【0148】
他方のステップ1122では、変数bReTransferFlag にTRUEが代入されているか否か判定する。ユーザが再送スイッチ206aを操作して再送モードを設定していた場合、その判定はYESとなってステップ1123に移行する。そうでない場合には、即ちエラー発生時にもデータの転送の続行をユーザが指定していた場合には、その判定はNOとなってステップ1121に移行する。
【0149】
ステップ1123では、データ転送形式にDATA STRAIGHT を格納した音声データ転送要求コマンドを再作成する。続くステップ1124では、その再作成したコマンドをインターフェイス204の送信データバッファに格納する。その後、一連の処理を終了する。
【0150】
このように、変数bReTransferFlag に代入されている値に応じて、エラー発生時にデータの再送が行われる。変数bReTransferFlag に代入されている値は、再送スイッチ206aに対する操作によって変化させることができる。このため、ユーザは、再送モードを設定しない場合には発音タイミングの遅れを回避させることができ、それを設定した場合には、発音される楽音の音質の低下を回避させることができる。
【0151】
一方、変数byDataReceivingStatus にDATA LOOP が代入されていた場合には、ステップ1118からステップ1125に移行する。そのステップ1125では、変数byCheckSumに代入されているチェックサム値が、受信したヘッダ部の第6バイト目のチェックサム値と一致するか否か判定する。ループ部の受信が正常に行われた場合、それらチェックサム値は一致することから判定はYESとなり、ステップ1126に移行する。そうでない場合には、即ちエラーが発生している場合には、その判定はNOとなってステップ1127に移行する。
【0152】
ステップ1126では、変数byDataReceivingStatus 、wLoopNum、及ぶbyCheckSumの更新を行う。具体的には、ループ部の受信を正常に完了、即ち音声データの受信を全て正常に完了したことから、変数byDataReceivingStatus にDATA HEADER を代入し、変数wLoopNumにはヘッダ部の全データ(ワード)数である6を代入し、変数byCheckSumには0を代入する。それが終了した後に一連の処理を終了する。
【0153】
他方のステップ1127では、ループ部の受信にエラーが発生したことから、このループ部の転送を要求する音声データ転送要求コマンド(第3バイト目のデータ転送形式をDATA LOOP としたコマンドである)を生成し、続くステップ1128でそのコマンドをインターフェイス204の送信データバッファに書き込む。その後、一連の処理を終了する。
【0154】
なお、第3の実施の形態では、再送モードの設定に応じてデータ欠落時におけるデータの再送を行うようにしているが、エラーの大きさに応じて、例えばデータが欠落したエラーと、転送が正確に行われなかったエラーとで別々に、そのエラー発生時にデータの再送を行うか否か設定できるようにしても良い。また、上記したように、データの再送を行うか否かを自動的に選択させるようにしても良い。更には、データの再送を行う部分を個別に選択できるようにしても良い。
【0155】
また、第3の実施の形態では、データの欠落が発生した場合、その欠落状態に応じてヘッダ部のデータの書き換えを行っているが、ヘッダ部のデータに合わせて、データが欠落した部分のほうの書き換えを行うようにしても良い。例えば欠落したデータ数が比較的に少ない場合には、データが欠落した部分の所定のデータをコピーして、その欠落分を補うようにようにしても良い。
【0156】
また、本実施の形態(第1〜第3の実施の形態)は、電子楽器101とパソコン103に本発明を適用した場合のものであるが、本発明が適用されるのはこれらの装置に限定されるものではない。例えば2つのパソコンに、それぞれ、本発明によるデータ受信装置、及びデータ送信装置を適用させ、それらの間で双方向に本発明に基づくデータの送受信を行えるようにすることもできる。即ち、上述した電子楽器101、及び/或いは、パソコン103の動作を実現するためのプログラムを実行できる装置であれば、既存の装置であってもそのプログラムをロードさせることで本発明を搭載させることができる。このことから明らかなようにに、本発明は柔軟に適用(搭載)させることができるものである。
【0157】
また、それらの間で送受信するデータについては、当然のことながら、音声データに限定されるものでもない。また、データの分割においては、本実施の形態のように、データ(ワードデータ)の処理内容に着目した分割の他に、例えば項目といったデータ(ワードデータ)の種類に着目した分割を行うようにしても良い。また、それらを組み合わせた分割を行っても良い。データの分割においても、そのデータによって様々な方法を用いることができる。
【0158】
【発明の効果】
以上説明したように本発明の第1の態様のデータ受信装置は、転送を要求することで送信されてきたデータを、ワードデータ群単位でエラー発生の有無を監視し、エラーが発生していた場合に、その受信状態に応じて、例えばワードデータ群間の整合性をとるようにワードデータ群を変更する。このため、エラーによって生じる不具合を極めて迅速に低減することができる。
【0161】
本発明のデータ送信装置は、上記データ受信装置からのデータの転送要求、或いは再転送要求に応じて、データ全体、或いはワードデータ群の送信を行う。このため、上記データ受信装置は、必要なデータ、或いはワードデータ群だけを、必要に応じて得ることができる。
【図面の簡単な説明】
【図1】第1の実施の形態が適用されたシステムの外観図である。
【図2】電子楽器の全体回路図である。
【図3】音声データの構成図である。
【図4】音声データ転送要求コマンドの構成図である。
【図5】全体処理の動作フローチャートである。
【図6】音声データ要求処理の動作フローチャートである。
【図7】データ受信インタラプト処理の動作フローチャートである。
【図8】パソコンの全体処理の動作フローチャートである。
【図9】音声データの構成図である(第2の実施の形態)。
【図10】データ受信インタラプト処理の動作フローチャートである(第2の実施の形態)。
【図11】データ受信インタラプト処理の動作フローチャートである(第3の実施の形態)。
【符号の説明】
101 電子楽器
103 パソコン
201 CPU
202 ROM
203 RAM
204 インターフェイス
206 スイッチ群
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a technique for transferring data between two devices connected via communication means.
[0002]
[Prior art]
In an apparatus having a sound generation function, for example, an electronic musical instrument, in order to expand the choices of sound (musical sound) that can be generated by the sound generation function, sound data for sound generation (musical sound) is transmitted to another apparatus (here, (It will be referred to as a transfer-side device) and is supplied as necessary. When audio data is supplied from the transfer-side device as needed, the electronic musical instrument (speech sound-generating device) can store musical data in addition to the advantage that it can generate musical tones with various tones. Since the memory capacity for doing so is small, an advantage that the cost can be reduced can be obtained.
[0003]
[Problems to be solved by the invention]
As described above, when the audio data is transferred between the two devices, whether or not the electronic musical instrument on the receiving side has received it normally so that the sound produced by the audio data is not defective. We are checking that. As a result of the check, if an error (error) has occurred in the transfer (reception) of the audio data, the electronic musical instrument requests the transfer side device to transfer the audio data again and receives it again. It was.
[0004]
However, in such a conventional transfer method of audio data, the time required for data transfer when an error occurs takes more than twice as long as that otherwise, and becomes very long. For this reason, for example, if an error occurs when switching timbres performed during the performance of a song, there is a problem that the sound generation timing of a musical sound to be generated may be delayed or may not be generated.
[0005]
As is well known, human beings can recognize slight deviations in pronunciation timing. A slight shift in pronunciation timing often changes the musical (audience) impression that people receive. As is clear from these facts, the influence of the timing of pronunciation on the music is very large. Therefore, even if the frequency of occurrence of data transfer errors is small, it is strongly possible to reduce (or avoid) the effects caused by the occurrence of such errors, for example, to shorten the time required for data transfer when an error occurs. It was desired.
[0006]
An object of the present invention is to reduce the influence of errors occurring in data transfer.
[0007]
[Means for Solving the Problems]
  The data receiving device according to the first aspect of the present invention is based on the premise that data of a processing unit transferred from an external device connected via a predetermined communication means is received, and transfers data to the external device. Requesting means for requesting, receiving means for receiving data transferred from an external device, and classifying the word data constituting the data into a plurality of word data groups based on processing contents, and the receiving means receives the data normally If there is a determination unit that determines whether or not the word data group is determined, and a word data group that the determination unit determines to be not normal, the word data group, according to the reception state of the reception unit,as well asOther word data groupsAt least one ofAnd changing means for changing.
[0011]
  In addition to the above configuration, a determination unit that determines whether or not to request retransfer of the word data group determined that the determination unit is not normal, and a case where the determination unit determines to request retransfer of the word data group And a re-transmission requesting means for requesting the external device to re-transfer the word data group, and the changing means determines that the word data group is re-transferred when the determining means determines that the re-transfer of the word data group is not requested. Data group,as well asOther word data groupsAt least one ofIt is desirable to change.
[0012]
  The data transmitting apparatus of the present invention is based on the premise that data is transmitted to the data receiving apparatus, and receiving means for receiving a data transfer request and a word data group retransfer request from the data receiving apparatus, and a receiving means Depending on the content of the received request, data,as well asWord data groupAt least one ofTransmitting means for transmitting the data to the data receiving device.
[0015]
Of the present inventionFirstThe data reception device of the aspect of the above, the data transmitted by requesting the transfer, the presence or absence of an error occurrence is monitored in units of word data groups, and if an error has occurred, depending on the reception state, For example, the word data group is changed so as to maintain consistency between the word data groups. As a result, it is possible to reduce problems caused by errors.
[0016]
The data transmitting apparatus of the present invention transmits the entire data or word data group in response to a data transfer request or a retransfer request from the data receiving apparatus. Thereby, the data receiving apparatus can obtain only necessary data or a word data group as necessary.
[0017]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
<First Embodiment>
FIG. 1 is an overview of a system to which the first embodiment is applied.
[0018]
As shown in FIG. 1, the system includes an electronic musical instrument 101 having a keyboard 102 that is operated by a user, and a personal computer (hereinafter referred to as a personal computer) 103 connected to the electronic musical instrument 101 by a cable 104. . The data receiving apparatus according to the first embodiment is applied to the electronic musical instrument 101, and the data transmitting apparatus according to the first embodiment is applied to the personal computer 103.
[0019]
  FIG. 2 is an overall circuit diagram of the electronic musical instrument 101. Next, the configuration and operation will be described with reference to FIG. PC103The operation is also described.
[0020]
As shown in FIG. 2, an electronic musical instrument 101 includes a CPU 201 that controls the entire musical instrument, a ROM 202 that stores programs, control data, automatic performance data, and the like, a RAM 203 that the CPU 201 uses for work, and a not-illustrated An interface (I / F) 204 that transmits / receives data to / from other devices including the personal computer 103 via the connector, a key matrix circuit 205 that scans the keyboard 102, and a switch group that is scanned by the key matrix circuit 205 206 and a sound system 207 that generates a musical tone in accordance with an instruction from the CPU 201.
[0021]
The general operation of the above configuration will be described.
When the power source of the musical instrument 101 is turned on, the CPU 201 starts control of the musical instrument 101 by reading a program from the ROM 202 and executing it. The control is performed in accordance with an operation performed by the user on the keyboard 102 and the switch group 206 and also data transmitted from another device via the interface 204. In order to avoid confusion, other devices will be specified as the personal computer 103 and will be described below.
[0022]
The switch group 206 includes an automatic performance mode switch for setting an automatic performance mode, a start / stop switch for instructing start and stop of automatic performance, a tone button for instructing a change in tone, and a tone and automatic performance. Various switches such as 0 to 9 buttons for designating a song or the like by numbers are collectively shown. The CPU 201 causes the key matrix circuit 205 to scan the keyboard 102 and the switch group 206 and analyzes the signals after the scan to detect the operation state and the performed operation, and according to the detection result. Control of the entire musical instrument 101 is executed.
[0023]
When the user operates the keyboard 102, the CPU 201 specifies the key operated by the user and the operation content, generates a control command according to the specified content, and outputs the control command to the sound system 207. Thereby, the sound system 207 starts sound generation according to the operation performed on the keyboard 102 by the user, or silences the sound being sounded.
[0024]
The sound system 207 includes, for example, a sound source LSI, a D / A converter, an amplifier, and a speaker. The sound source LSI, for example, stores waveform data encoded by the PCM method in an internal memory, generates waveform data of various pitches by changing the speed of reading the waveform data, and if necessary, The generated waveform data is subjected to processing for adding an acoustic effect and output to the D / A converter. The D / A converter converts the waveform data into an analog audio signal and outputs the analog audio signal to the amplifier. The amplifier amplifies the signal and outputs it to the speaker. An audio signal is output from the amplifier to the speaker, so that a musical sound is produced.
[0025]
The waveform data to be stored in the memory in the tone generator LSI is stored in the ROM 202 in a file format together with information representing the configuration, for example. The CPU 201 switches timbres by reading out waveform data from the ROM 202 and sending it to the sound source LSI in accordance with the timbre specified by the user via the switch group 206. The set of data stored in the file format is referred to as audio data in order to distinguish it from waveform data.
[0026]
Audio data not stored in the ROM 202 can be acquired by starting an application program for supplying audio data on the personal computer 103. The application program may be installed and used on the hard disk of the personal computer 103, for example. However, the application program is stored and distributed on a storage medium such as a CD-ROM. It may be used by being loaded on a storage device (for example, when mounted on a drive). In the first embodiment, since the various audio data must be prepared, the latter is adopted, and the application program is stored in a storage medium along with the audio data and distributed.
[0027]
When the user selects a timbre of audio data not stored in the ROM 202, the CPU 201 requests the personal computer 103 to transfer the audio data corresponding to the timbre selected by the user via the interface 204. Send a command. When the other personal computer 103 receives the request command, it searches the storage medium (for example, a CD-ROM) for a file containing the corresponding audio data according to the content, and transfers the searched audio data to the electronic musical instrument 101.
[0028]
FIG. 3 is a configuration diagram of the audio data. As shown in FIG. 3, the audio data is composed of a header portion and a PCM data portion, and the PCM data portion is composed of a straight portion and a loop portion.
[0029]
The header portion is a word data group necessary for appropriately controlling the PCM data portion, and the data transfer and sound generation processing are performed based on information stored in the header portion. In the header part, the number of data in the straight part in the first and second bytes, the checksum value in the straight part in the third byte, the number of data in the loop part in the fourth and fifth bytes, In the sixth byte, the checksum value of the loop part is stored.
[0030]
The PCM data portion is an 8-bit data group in which one word obtained by sampling an actual audio analog signal and converting it into digital data. The straight part constituting it stores data that is processed only once in the tone generation, and the loop part stores data that is repeatedly processed following the straight part process.
[0031]
When the voice data is voice data, the straight part is a word data group corresponding to the consonant part at the beginning of the pronunciation, and the other loop part is equivalent to the vowel part after the pronunciation. It is a word data group.
[0032]
FIG. 4 is a configuration diagram of the voice data request command. As shown in FIG. 4, it is configured as 3-byte data.
The command ID stored in the first byte is a command code representing the content requested to the personal computer 103. The audio data number in the second byte is data specifying audio data for which transfer is requested. The data transfer format of the third byte is a code that designates a portion of audio data that requires transfer.
[0033]
In the first embodiment, three types of values are prepared as the data transfer format, in other words, the format of transferring audio data is divided into three types. Here, the three types of values are DATA HEADER, DATA STRAIGHT, and DATA LOOP. DATA HEADER indicates that all transfer of audio data is requested, DATA STRAIGHT indicates that all PCM data portions are transferred, and DATA LOOP indicates that only loop portions in the PCM data portion are requested. Represents each.
[0034]
When the user designates a timbre, the CPU 201 on the electronic musical instrument 101 side specifies a code value indicating that the command is a voice data transfer request command in the command ID, a voice data number is a number input in the designation of the timbre, As the data transfer format, a command storing DATA HEADER is generated and output to the interface 204, and the command is sent to the personal computer 103 via the interface 204.
[0035]
An error may occur in data transfer for some reason. For this reason, the CPU 201 monitors, for each part of the audio data, whether or not the data transfer of the personal computer 103 started after sending the command is normally performed. As a result of the monitoring, when a portion that is not normally transferred is detected, a voice data transfer request command for requesting transfer of the data of the portion is generated and sent to the personal computer 103.
[0036]
When the other personal computer 103 receives a command from the electronic musical instrument 101, the personal computer 103 performs processing such as specifying the type of the command from the command ID and transferring data in response to a request from the electronic musical instrument 101. If the command is a voice data transfer request command, the voice data specified by the voice data number is acquired from a storage medium such as a CD-ROM, and the data transfer format is specified from the acquired voice data. The portion is extracted and transferred to the electronic musical instrument 101. As a result, all or part of the audio data is transferred from the personal computer 103 to the electronic musical instrument 101 in response to a request from the electronic musical instrument 101 side.
[0037]
The CPU 201 of the electronic musical instrument 101 receives the data transferred from the personal computer 103 via the interface 204 and stores it in the RAM 203. When the data transfer is completed normally, the audio data is sent to the sound system 207. As a result, a musical sound can be generated by the audio data transferred from the personal computer 103.
[0038]
In the first embodiment, as described above, audio data is divided into a plurality of parts based on the processing content, and data transfer can be performed independently for each part. For this reason, even if an error occurs, it is only necessary to re-transfer only the portion where the error has occurred, and re-transfer of the portion where the transfer was normally performed can be avoided. As a result, the time required for data transfer when an error occurs can be shortened, and a delay in sound generation timing or the like can be avoided or the delay or the like can be reduced.
[0039]
The outline of the operation of the electronic musical instrument 101 and the personal computer 103 has been described above. Next, the operation of the electronic musical instrument 101 will be described in detail with reference to FIGS. 5 to 7, and the operation of the personal computer 103 will be described in detail with reference to FIG.
[0040]
FIG. 5 is an operation flowchart of overall processing executed by the electronic musical instrument 101. First, the entire process will be described in detail with reference to FIG. Note that the overall process is a process realized by the CPU 201 reading and executing a program stored in the ROM 202.
[0041]
When the power of the musical instrument 101 is turned on, the CPU 201 reads a program from the ROM 202 and starts its control. At the start of the control, step 501 is executed.
[0042]
In step 501, initial processing for initializing the musical instrument 101 to a predetermined state is executed. By executing this initial process, predetermined initial values are assigned to various control variables held in the RAM 203 or the registers in the CPU 201, respectively. For example, DATA HEADER, 0, 6, and 0 are assigned to variables byDataReceivingStatus, wDataCounter, wLoopNum, and byCheckSum related to the transfer of audio data, respectively. After such initial processing is completed, the routine proceeds to step 502.
[0043]
The variable byDataReceivingStatus is a variable for managing which part of the audio data is transferred by the personal computer 103. For other variables, the variable wDataCounter is a variable for counting the number of data (words) received in each part of the audio data, and the variable wLoopNum is a variable to which the number of data (words) to be received in each part is substituted. Since the number of data in the header part is 6, 6 is substituted in the initial process. The last variable “byCheckSum” is used to determine whether or not each part (here, the straight part and the loop part) has received data correctly. Specifically, the calculation result (for example, exclusive OR) of the checksum of the data received so far in each unit is substituted.
[0044]
In step 502, an operation state of the switch group 206 and operations performed on various switches are detected, and switch processing for performing various settings and the like based on the detection results is executed. By executing this switch processing, the user can set various modes, timbres, tempos, songs to be automatically played, and the like through operations on the switch group 206.
[0045]
  In step 503 following step 502, an operation performed on the keyboard 102 is detected, and a musical sound is generated based on the detection result.Keyboard processingExecute. thisKeyboard processingBy executing the above, the user can sound a desired musical tone at any time through an operation on the keyboard 102.
[0046]
When the keyboard process ends, the process proceeds to step 504. In step 504, a music reproduction process for reproducing a music according to the automatic performance data is executed. After the music reproduction process is completed, the process proceeds to step 505.
[0047]
The automatic performance data is data prepared in a standard MIDI file (SMF) format, for example. The SMF is a data stream configured by adding time information to MIDI event data. Therefore, the reproduction of the music according to the automatic performance data is performed by sequentially processing the MIDI event according to the time information.
[0048]
In step 505, data reception processing is executed. Actual data reception is performed by an interrupt process described later. What is performed here is processing for the received data, and transmission of the received audio data to the sound system is performed here.
[0049]
In step 506 following step 505, voice data request processing for requesting the personal computer 103 to transfer voice data is executed. The audio data requested here is specified by executing the switch process in step 502, the keyboard process in step 503, or the music reproduction process in step 504. When the voice data request process is completed, the process returns to step 502.
[0050]
Thus, the processing loop formed in steps 502 to 506 is repeatedly executed. Thereby, the automatic performance of the music designated by the user and the desired musical tone are generated with the desired tone color.
[0051]
FIG. 6 is an operation flowchart of the voice data request process executed as step 506 in the overall process. Next, the subroutine processing will be described in detail with reference to FIG.
[0052]
The voice data transfer request is generated when the timbre specified by the user by operating the switch group 206 or the timbre specified by the program change in the automatic performance data is not prepared in the electronic musical instrument 101 (ROM 202). . Further, although description of the setting method and the like is omitted, when different tones or musical sounds are assigned to each key of the keyboard 102 or to each group constituted by one or more keys, the keyboard 102 is It is necessary to request transfer of timbre data every time the user operates. In the timbre data request process, the personal computer 103 is requested to transfer the voice data that is necessary because of the above.
[0053]
  First, in step 601, step 502 is executed.switchBy executing the process, the keyboard process in step 503, or the music piece reproduction process in step 504, a voice data transfer request command for requesting transfer of voice data recognized as necessary is created. At this time, since the data transfer format of the third byte requires all of the audio data, DATA HEADER is stored.
[0054]
In step 602 following step 601, the created voice data transfer request command is written in the transmission data buffer. After the writing is finished, a series of processing is finished.
[0055]
The transmission data buffer is a transmission storage area provided in a buffer in the interface 204. For this reason, the processing in step 602 is realized by the CPU 201 outputting the voice data transfer request command created in the interface 204 and writing the command in the transmission data buffer (storage area) in the buffer provided inside. Is done.
[0056]
The personal computer 103 accesses the buffer of the interface 204 via the cable 104. For this reason, by writing an audio data transfer request command into the buffer in the interface 204, the command is sent to the personal computer 103.
[0057]
Note that the processing operation of the voice data request process described above is for a case where the personal computer 103 is requested to transfer voice data. When there is no need to request transfer of audio data, the series of processing ends without executing the processing in steps 601 and 602.
[0058]
FIG. 7 is an operation flowchart of the data reception interrupt process. Next, the interrupt process will be described in detail with reference to FIG.
The personal computer 103 that has received the voice data transfer request command transfers the voice data designated by the command one byte (word) at a time. The interface 204 stores data from the personal computer 103 in an internal buffer and generates an interrupt to the CPU 201. The data reception interrupt process is a process executed when the interrupt occurs.
[0059]
When the CPU 201 requests the personal computer 103 to transfer audio data, the CPU 201 prepares an area for storing the audio data in the RAM 203 for each part, and temporarily stores the audio data transferred from the personal computer 103 in the area. In the data reception interrupt process, the audio data is stored in the RAM 203 while determining which part of the audio data the data received by the interface 204 is, and whether the data of each part has been normally transferred. Is done.
[0060]
First, in step 701, the value assigned to the variable byDataReceivingStatus is determined. As mentioned above, the variable byDataReceivingStatus is a variable for determining which part of the audio data is currently being received, and one of the three values of DATA HEADER, DATA STRAIGHT, and DATA LOOP is assigned. Is done. DATA HEADER indicates that data in the header portion is being received, DATA STRAIGHT indicates that data in the straight portion and DATA LOOP indicates that data in the loop portion is being received.
[0061]
If DATA HEADER is assigned to the variable byDataReceivingStatus, the process proceeds to step 702. In step 702, the received data is stored in the data storage area for the header portion in the RAM 203. When the storage ends, the process proceeds to step 707.
[0062]
If DATA STRAIGHT is assigned to the variable byDataReceivingStatus, the process proceeds to step 703. In step 703, the received data is stored in the data storage area for the PCM data portion in the RAM 203, and in the subsequent step 704, a checksum value is calculated and the calculation result is substituted into a variable byCheckSum. When that is finished, the routine proceeds to step 707.
[0063]
As the checksum value, as shown in FIG. 3, two values of a straight part and a loop part constituting the PCM data part are stored in the header part. The checksum is calculated separately for the straight part and the loop part. As a result, it is possible to determine for each part whether or not reception has been performed normally. The checksum value is calculated, for example, by calculating an exclusive OR of the data received so far, that is, calculating an exclusive OR of the variable byCheckSum and the received data.
[0064]
  In variable byDataReceivingStatusDATA LOOP If is substituted, the process proceeds to step 705. In step 705, the received data is stored in the data storage area for the PCM data portion in the RAM 203, and in the subsequent step 706, a checksum value is calculated and the calculation result is substituted into a variable byCheckSum. When that is finished, the routine proceeds to step 707.
[0065]
As described above, in steps 701 to 706, the received data is stored in the RAM 203 according to which part of the audio data belongs.
In step 707, since 1 byte (word data) is received as audio data, the value of the variable wDataCounter is incremented. Thereafter, the process proceeds to step 708.
[0066]
In step 708, it is determined whether or not the value of the variable wDataCounter is equal to the value of the variable wLoopNum. The variable wLoopNum is a variable to which the total number of data (words) constituting each part of the header part, straight part, or loop part is substituted. If the data of the header part is received, the data of the first and second bytes of the header part, and if the data of the loop part is received, the data of the fourth and fifth bytes of the header part are respectively Assigned. For this reason, when all the data of the part currently being received is received, the determination is YES and the process proceeds to step 709. Otherwise, the determination is no and the series of processing ends.
[0067]
In step 709 and subsequent steps, it is determined that reception of a portion of data constituting the audio data has been completed, and processing associated therewith is performed. It is determined whether or not the data of the portion has been normally received, that is, whether or not an error has occurred, and processing according to the determination result is performed here.
[0068]
First, in step 709, the value of the variable wDataCounter is cleared, that is, 0 is substituted for it. In the subsequent step 710, the value assigned to the variable byDataReceivingStatus is determined. If DATA HEADER is assigned to the variable byDataReceivingStatus, the process proceeds to step 711, and the variables byDataReceivingStatus and wLoopNum are updated. Specifically, since the reception of the header part is completed, DATA STRAIGHT is substituted for the variable byDataReceivingStatus, and the other variable wLoopNum is composed of the first and second byte data of the header part that has been received. 16-bit value (the first byte is the upper 8 bits and the second byte is the lower 8 bits) is substituted. After it is finished, a series of processing is finished.
[0069]
If DATA STRAIGHT is assigned to the variable byDataReceivingStatus, the process proceeds to step 712. In step 712, it is determined whether or not the checksum value assigned to the variable byCheckSum matches the checksum value of the third byte of the received header part. If the straight part is received normally, the checksum values match, so the determination is yes, and the process proceeds to step 713. If not, that is, if an error has occurred, the determination is no and the process moves to step 714.
[0070]
In step 713, the variables byDataReceivingStatus, wLoopNum, and byCheckSum are updated. Specifically, since the reception of the straight part has been normally completed, DATA LOOP is substituted for the variable byDataReceivingStatus, and the variable wLoopNum is composed of the fourth and fifth byte data of the header part that has been received. A 16-bit value (the fourth byte is the upper 8 bits and the fifth byte is the lower 8 bits) is substituted, and 0 is substituted for the variable byCheckSum. After it is finished, a series of processing is finished.
[0071]
On the other hand, in step 714, since an error has occurred in reception of the straight part, an audio data transfer request command (a command in which the data transfer format of the third byte is DATA STRAIGHT) requesting transfer of the straight part is issued. In step 715, the command is written to the transmission data buffer of the interface 204. Thereafter, the series of processing is terminated.
[0072]
By writing the re-created audio data transfer request command in the transmission data buffer, the data in the straight portion is re-transferred from the personal computer 103. When an error occurs, the variable byDataReceivingStatus is not updated, so that data transferred from the personal computer 103 after sending the command is received as straight portion data.
[0073]
  On the other hand, the variable byDataReceivingStatusDATA LOOP If is substituted, the process proceeds from step 710 to step 716. In step 716, it is determined whether the checksum value assigned to the variable byCheckSum matches the checksum value of the sixth byte of the received header part. If the reception of the loop part is performed normally, the checksum values match, so the determination is yes and the process moves to step 717. If not, that is, if an error has occurred, the determination is no and the process moves to step 718.
[0074]
In step 717, the variables byDataReceivingStatus, wLoopNum, and byCheckSum are updated. Specifically, since the reception of the loop part has been completed normally, that is, the reception of all audio data has been completed normally, DATA HEADER is substituted for the variable byDataReceivingStatus, and the total number of data (words) in the header part is assigned to the variable wLoopNum. 6 is substituted, and 0 is substituted for the variable byCheckSum. After it is finished, a series of processing is finished.
[0075]
On the other hand, in step 718, since an error has occurred in the reception of the loop part, an audio data transfer request command (a command in which the data transfer format of the third byte is DATA LOOP) requesting transfer of this loop part is issued. In step 719, the command is written into the transmission data buffer of the interface 204. Thereafter, the series of processing is terminated.
[0076]
As described above, in the first embodiment, it is determined whether or not an error has occurred in the data transfer for each part except the header part. If it is determined that an error has occurred, the data transfer is interrupted there. Thus, the data transfer is resumed from the portion where the error has occurred.
[0077]
By detecting the error independently for each part, it is possible to quickly detect the error that has occurred before the transfer of the entire audio data is completed. By making it possible to re-transfer data only to the part where an error has occurred, it is possible to shorten the time required to transfer data that is actually required. By interrupting the data transfer at the portion where the error has occurred, the time taken to transfer the data discarded due to the occurrence of the error can be shortened. As a result, data transfer when an error occurs can be performed in a shorter time, and the influence when an error occurs can be reduced.
[0078]
The above is the main processing executed by the electronic musical instrument 101 side. Next, the operation executed by the personal computer 103 will be described in detail with reference to FIG. FIG. 8 is an operation flowchart of overall processing executed by the personal computer 103.
[0079]
In the first embodiment, an application program for supplying audio data from the personal computer 103 is distributed along with the audio data on a CD-ROM. From this, the entire process shown in FIG. 8 starts the application program stored in the CD-ROM, that is, loads the application program onto the main storage device and assigns the control of the CPU of the personal computer 103 to it. Realized.
[0080]
  Further, the operation flowchart shown in FIG.CPUFIG. 4 shows an excerpt of a part particularly related to the present invention from among the processing operations when executed.
[0081]
First, in step 801, it is determined whether a command has been received. As described above, the personal computer 103 accesses the buffer in the interface 204 of the electronic musical instrument 101. More specifically, the CPU of the personal computer 103 accesses a buffer in the interface 204 of the electronic musical instrument 101 via the interface on the personal computer 103 side and the cable 104. For example, the interface outputs an interrupt signal when a command is written in a transmission data buffer allocated in the interface 204, and notifies the CPU to that effect. For this reason, if any command is written in the transmission data buffer, the determination is YES and the process proceeds to step 802. Otherwise, the determination is no and the series of processing ends.
[0082]
  In step 802, the command written in the transmission data buffer is read (received) and analyzed. In subsequent step 803, as a result of analyzing the command, it is determined whether or not the command is a voice data transfer request command. In the transfer data buffer of the interface 204 of the electronic musical instrument 101voiceIf a data transfer request command has been written, the determination is yes and the process moves to step 805. Otherwise, the determination is no and the process moves to step 804.
[0083]
  In step 804,voiceExecutes processing according to commands other than data transfer request commands. In the process according to this command, for example, automatic performance data stored in a CD-ROM is transferred to the electronic musical instrument 101. After that is completed, the process returns to step 801.
[0084]
  In the other step 805, it is stored in the second byte of the voice data transfer request command.voiceA file corresponding to the data number is searched from the CD-ROM. After the search is completed, the process proceeds to step 806, where the data of the requested portion in the data transfer format that is the third byte of the command is extracted from the searched file and transmitted. After that is completed, the process returns to step 801.
[0085]
As described above, the audio data is sequentially transferred every 8 bits (1 word) in accordance with reception on the electronic musical instrument 101 side. For this reason, actual data transfer is performed by interrupt processing.
[0086]
The interrupt process is a process executed by an interrupt signal (input / output interrupt) output from an interface (not shown) connected to the cable 104 provided in the personal computer 103, for example. By executing this, 1-byte data is output in accordance with the operation on the electronic musical instrument 101 side. For this reason, the data transmission in step 806 is only performed, for example, by notifying the electronic musical instrument 101 to start the transmission.
[0087]
Each part constituting the audio data is transferred in the order of the header part, the straight part, and the loop part according to the electronic musical instrument 101 side. Further, the portion to be transferred according to the data transfer format of the voice data transfer request command is also set in accordance with the operation on the electronic musical instrument 101 side. That is, for example, when the data transfer format is DATA STRAIGHT, both the straight part and the loop part constituting the PCM data part are transferred.
[0088]
The above processing operations are performed on the personal computer 103 when the application program is executed. As a result, in response to a data transfer request from the electronic musical instrument 101, that is, a voice data transfer request command, voice data is transferred from the personal computer 103 to the electronic musical instrument 101 byte by byte.
[0089]
In the first embodiment, audio data is divided into three parts, a header part, a straight part, and a loop part, to perform data transfer. For example, the data is divided more finely according to the data amount of each part. You may do it. Specifically, for example, when the data amount of the straight portion is larger than that of other portions, the straight portion may be further divided into a plurality of portions.
<Second Embodiment>
In the first embodiment, the voice data is divided into a header part, a straight part, and a loop part, and it is checked whether or not the data of each part has been normally transferred, and when the occurrence of an error is detected. The data where the error has occurred is retransmitted unconditionally. On the other hand, in the second embodiment, it is possible to select whether or not to retransmit data when the occurrence of an error is detected.
[0090]
When an error occurs in the data transfer, if a musical tone is generated by the transferred data, some degree of inconvenience is given to the person depending on the content of the error. However, for example, a program change (tone change) during automatic performance (in this case, it is also necessary to generate a musical sound in response to a user's key press on the keyboard 102), a process for prompt pronunciation must be performed. Under such circumstances, it is possible that a delay in sound generation timing may occur due to the retransmission of data. Therefore, it is not always a good idea to retransmit data when an error occurs. For this reason, in the second embodiment, it is possible to realize that a user can generate a musical sound in a more comfortable state by selecting whether or not to retransmit data. is there.
[0091]
The configuration of the electronic musical instrument according to the second embodiment is basically the same as that of the first embodiment, and the processing operation is also basically the same. As for the personal computer, the configuration and the processing operation have not changed from the first embodiment. For this reason, only the part from which the electronic musical instrument 101 by 2nd Embodiment differs from it by 1st Embodiment is demonstrated using the code | symbol used in 1st Embodiment as it is.
[0092]
  In the second embodiment, the user can select whether or not to retransmit data when an error occurs. For that choice,FIG.As shown in FIG. 4, a retransmission switch 206a is provided as one of the switches constituting the switch group 206. BReTransferFlag is prepared as a variable (flag) indicating whether or not to retransmit data. The CPU 201 changes the value assigned to the variable bReTransferFlag every time the user operates the retransmission switch 206a.
[0093]
Note that there are two types of values assigned to the variable bReTransferFlag: whether to retransmit the data, but when retransmitting the data to clarify the meaning of the value assigned to it (in retransmission mode) Will be described as TRUE. When assigning TRUE to the variable bReTransferFlag, the CPU 201 performs, for example, turning on an unillustrated LED and notifying the user accordingly.
[0094]
Further, in the second embodiment, in order to detect data loss that occurs during data transfer, one word of data is inserted into the PCM data portion.
FIG. 9 is a configuration diagram of audio data used in the second embodiment. As shown in FIG. 9, 1-byte indicator data is added to the head of the loop portion. In the indicator data, the value of the most significant bit is 1, and the other data in the PCM data portion is 7-bit data (the value of the most significant bit (MSB) is 0). Thereby, the marker data can be distinguished from other data.
[0095]
When audio data as shown in FIG. 9 is transferred, it can be determined whether or not data loss has occurred according to the timing at which the marker data is received. For example, when the marker data is received before receiving the data corresponding to the number of data stored in the first and second bytes of the header part, it means that data is missing in the header part or the straight part. .
[0096]
Missing data often affects the usage of the entire data, and usually causes more auditory problems than when the data could not be received correctly. In the second embodiment, since the magnitude of the effect differs depending on the content of the error, the error is classified into two types based on the magnitude of the effect, and data is retransmitted when an error with a relatively large defect occurs. This is performed unconditionally, and when it is relatively small, data is retransmitted according to the user's specification (whether or not the retransmission mode is set).
[0097]
The above is the outline of the second embodiment. Next, the operation of the CPU 201 in the second embodiment for realizing the retransmission of data when the error occurs will be described in detail.
[0098]
The flow of processing operations in the second embodiment is the same as that in the first embodiment. As the processing contents, the data reception interrupt processing is the most different from the first embodiment. In other processing, there is no difference, or even if there is a difference. Therefore, only the data reception interrupt process will be described with reference to the operation flowchart shown in FIG.
[0099]
First, in step 1001, the value assigned to the variable byDataReceivingStatus is determined. As mentioned above, the variable byDataReceivingStatus is a variable for determining which part of the audio data is currently being received, and one of the three values of DATA HEADER, DATA STRAIGHT, and DATA LOOP is assigned. Is done.
[0100]
If DATA HEADER is assigned to the variable byDataReceivingStatus, the process proceeds to step 1002. In step 1002, the received data is stored in the data storage area for the header portion in the RAM 203. When the storage ends, the process proceeds to step 1012.
[0101]
If DATA STRAIGHT is assigned to the variable byDataReceivingStatus, the process proceeds to step 1003. In step 1003, it is determined whether or not the received data is marker data. If the value of the most significant bit of the received data is 1, the determination is YES because the marker data has been received, and the routine goes to Step 1006. Otherwise, the determination is no and the process moves to step 1004.
[0102]
In step 1004, the received data is stored in the data storage area for the PCM data portion in the RAM 203, and in the subsequent step 1005, a checksum value is calculated and the calculation result is substituted into a variable byCheckSum. When that is finished, the routine proceeds to step 1012.
[0103]
  At the time of shifting to step 1006, the transfer of the straight part is completed before the data of the number of data stored in the first and second bytes of the header part is received. That is, data loss has occurred. For this reason, in steps 1006 to 1008, processing corresponding to that is performed. Specifically, in step 1006, DATA HEADER is substituted for variable byDataReceivingStatus, 6 is substituted for variable wLoopNum, and 0 is substituted for variable wDataCounter. In step 1007, an audio data transfer request command is stored in which DATA HEADER is stored as the data transfer format. In step 1008, the recreated command is stored in the transmission data buffer of the interface 204. After they are finishedFinish a series of processingTo do.
[0104]
If DATA LOOP is assigned to the variable byDataReceivingStatus, the process proceeds from step 1001 to step 1009. In step 1009, it is determined whether the received data is indicator data. When the value of the most significant bit of the received data is 1, since it is indicator data, the determination is YES and the series of processes is terminated. Otherwise, the determination is no and the process moves to step 1010.
[0105]
As described above, when data loss occurs before the transfer of the loop portion starts, the entire audio data is retransmitted. For this reason, at the start of reception of the loop part, the marker data added to the head is received. The indicator data is data that is not used for playing a musical sound. For this reason, it is discarded on the electronic musical instrument 101 side.
[0106]
In the other step 1010, the received data is stored in the data storage area for the PCM data portion in the RAM 203, and in the subsequent step 1011, the checksum value is calculated and the calculation result is substituted into the variable byCheckSum. When that is finished, the routine proceeds to step 1012.
[0107]
As described above, in steps 1001 to 1011, the received data is stored in the RAM 203 depending on which part of the audio data belongs, and the audio data is retransmitted depending on whether or not data loss has occurred. .
[0108]
In step 1012, since 1 byte (1 word) is received as audio data, the value of the variable wDataCounter is incremented. Thereafter, the process proceeds to step 1013.
[0109]
In step 1013, it is determined whether the value of the variable wDataCounter is equal to the value of the variable wLoopNum. The variable wLoopNum is a variable to which the total number of words constituting each part of the header part, the straight part, or the loop part is substituted, and when the header part data is received, 6 is the straight part data. Is received, the data of the first and second bytes of the header portion is substituted, and the data of the fourth and fifth bytes of the header portion is substituted when the data of the loop portion is received. . For this reason, when all the data of the part currently being received is received, the determination is YES and the process proceeds to step 1014. Otherwise, the determination is no and the series of processing ends.
[0110]
In step 1014 and subsequent steps, it is determined that reception of a portion of data constituting the audio data has been completed, and processing associated therewith is performed. It is determined whether or not the data of the portion has been normally received, that is, whether or not an error has occurred, and a countermeasure according to the determination result is performed.
[0111]
First, in step 1014, the value of the variable wDataCounter is cleared, that is, 0 is substituted for it. In the subsequent step 1015, the value assigned to the variable byDataReceivingStatus is determined. If DATA HEADER is assigned to the variable byDataReceivingStatus, the process proceeds to step 1016, and the variables byDataReceivingStatus and wLoopNum are updated. Specifically, since the reception of the header part is completed, DATA STRAIGHT is substituted for the variable byDataReceivingStatus, and the other variable wLoopNum is composed of the first and second byte data of the header part that has been received. 16-bit value (the first byte is the upper 8 bits and the second byte is the lower 8 bits) is substituted. After it is finished, a series of processing is finished.
[0112]
If DATA STRAIGHT is assigned to the variable byDataReceivingStatus, the process proceeds to step 1017. In step 1017, it is determined whether or not the checksum value assigned to the variable byCheckSum matches the checksum value of the third byte of the received header part. If the straight part is received normally, the checksum values match, so the determination is yes, and the process proceeds to step 1018. If not, that is, if an error has occurred, the determination is no and the process moves to step 1019.
[0113]
In step 1018, the variables byDataReceivingStatus, wLoopNum, and byCheckSum are updated. Specifically, since the reception of the straight part has been normally completed, DATA LOOP is substituted for the variable byDataReceivingStatus, and the variable wLoopNum is composed of the fourth and fifth byte data of the header part that has been received. A 16-bit value (the fourth byte is the upper 8 bits and the fifth byte is the lower 8 bits) is substituted, and 0 is substituted for the variable byCheckSum. After these are finished, a series of processing is finished.
[0114]
In the other step 1019, it is determined whether TRUE is assigned to the variable bReTransferFlag. If the user operates the retransmission switch 206a to designate retransmission of data when an error occurs, that is, the retransmission mode is set, the determination is YES and the process proceeds to step 1020. If this is not the case, that is, if the user has designated the continuation of data transfer even when an error occurs, the determination is no and the process proceeds to step 1018 described above.
[0115]
In step 1020, the voice data transfer request command storing DATA STRAIGHT as the data transfer format is recreated. In the subsequent step 1021, the re-created command is stored in the transmission data buffer of the interface 204. Thereafter, the series of processing is terminated.
[0116]
In this way, data is retransmitted when an error occurs according to the value assigned to the variable bReTransferFlag. The value assigned to the variable bReTransferFlag can be changed by operating the retransmission switch 206a. For this reason, the user can control the tone generation state of the musical sound, and can use the electronic musical instrument 101 more comfortably. In other words, if the re-transmission mode is not set, the delay in sound generation timing can be avoided or minimized, and if it is set, it is possible to avoid the deterioration of the sound quality of the tone to be sounded. it can.
[0117]
On the other hand, if DATA LOOP is assigned to the variable byDataReceivingStatus, the process proceeds from step 1015 to step 1022. In step 1022, it is determined whether or not the checksum value assigned to the variable byCheckSum matches the checksum value of the sixth byte of the received header part. If the loop part is normally received, the checksum values match, so the determination is yes, and the process moves to step 1023. If not, that is, if an error has occurred, the determination is no and the process moves to step 1024.
[0118]
In step 1023, the variables byDataReceivingStatus, wLoopNum, and byCheckSum are updated. Specifically, since the reception of the loop part has been completed normally, that is, the reception of all audio data has been completed normally, DATA HEADER is substituted for the variable byDataReceivingStatus, and the total number of data (words) in the header part is assigned to the variable wLoopNum. 6 is substituted, and 0 is substituted for the variable byCheckSum. After these processes are completed, the series of processes is terminated.
[0119]
In the other step 1024, since an error has occurred in the reception of the loop part, an audio data transfer request command (a command in which the data transfer format of the third byte is DATA LOOP) requesting transfer of this loop part is issued. In step 1025, the command is written into the transmission data buffer of the interface 204. Thereafter, the series of processing is terminated.
[0120]
As described above, in the second embodiment, when an error occurs in reception of the straight part, a retransmission of data is requested depending on whether or not the retransmission mode is set, but an error occurs in reception of the loop part. Then, it is requesting retransmission of data unconditionally. This is because the straight portion is a portion that is processed only once in sound generation, and thus the influence of errors is relatively smaller than the loop portion that is repeatedly processed.
[0121]
As can be seen from this, the dividing method for dividing the audio data into the header portion, the straight portion, and the loop portion is also a dividing method that focuses on the importance of each portion. By dividing the data according to the processing content of the data of each part, it is possible to perform the division focusing on the importance. For this reason, as described above, it is possible to retransmit data according to the importance. In other words, when an error occurs, it can be dealt with hierarchically, and it is possible to flexibly deal with various user requests.
[0122]
In the second embodiment, only one marker data for detecting missing data is inserted into the audio data. However, for example, a plurality of data such as the head of the straight portion and the end of the loop portion are inserted. It may be inserted so that data loss can be detected for each part. In such a case, it is only necessary to request retransmission of data for each unit when detecting data loss. The retransmission request may be performed immediately after an error is detected, or may be performed after the transfer of the entire audio data is completed.
[0123]
In the second embodiment, the user selects whether to retransmit data when an error occurs. However, the selection may be performed automatically. For example, it may be determined whether or not to retransmit data based on a setting state such as whether or not a song is being played in the automatic performance mode.
<Third Embodiment>
In the second embodiment, as described above, when the data loss is detected, the audio data is requested to be retransmitted immediately. On the other hand, in the third embodiment, when data loss is detected, it is possible to further select whether to retransmit data.
[0124]
The configuration of the electronic musical instrument according to the third embodiment is basically the same as that of the second embodiment, and the processing operation is also basically the same. As for the personal computer, the configuration and the processing operation have not changed from the first embodiment. For this reason, the reference numerals used in the first embodiment are used as they are, and only the portions where the electronic musical instrument 101 according to the third embodiment differs from that according to the second embodiment will be described.
[0125]
  In the second embodiment, errors are classified into two types, data loss and inaccurate reception (transfer) of data. When the former error occurs, data is retransmitted, and when the latter occurs, user error occurs. Data is retransmitted in accordance with the designation, that is, whether or not the retransmission mode is set. In the third embodiment,resendDepending on whether or not the mode is set, data is retransmitted when an error with missing data occurs.
[0126]
Musical sound generation using audio data is basically performed based on information stored in the header portion. If data is missing, the information in the header part does not match the actual data configuration. For this reason, in the third embodiment, when data is not retransmitted due to occurrence (detection) of data loss, information in the header part is changed according to the data reception state to ensure consistency. .
[0127]
The above is the outline of the third embodiment. Next, the operation of the CPU 201 in the third embodiment for realizing the retransmission of data when the error occurs will be described in detail.
[0128]
The flow of processing operations in the third embodiment is the same as that in the first and second embodiments. As the processing contents, the data reception interrupt processing is the most different from the second embodiment. In other processing, there is no difference, or even if there is a difference. Therefore, only the data reception interrupt process will be described with reference to the operation flowchart shown in FIG.
[0129]
First, in step 1101, the value assigned to the variable byDataReceivingStatus is determined. As mentioned above, the variable byDataReceivingStatus is a variable for determining which part of the audio data is currently being received, and one of the three values of DATA HEADER, DATA STRAIGHT, and DATA LOOP is assigned. Is done.
[0130]
If DATA HEADER is assigned to the variable byDataReceivingStatus, the process proceeds to step 1102. In step 1102, the received data is stored in the data storage area for the header portion in the RAM 203. When the storage ends, the process proceeds to step 1115.
[0131]
If DATA STRAIGHT is assigned to the variable byDataReceivingStatus, the process proceeds to step 1103. In step 1103, it is determined whether the received data is sign data. If the value of the most significant bit of the received data is 1, the determination is YES because the marker data has been received, and the process proceeds to step 1106. Otherwise, the determination is no and the process moves to step 1104.
[0132]
In step 1104, the received data is stored in the data storage area for the PCM data portion in the RAM 203. In the subsequent step 1105, a checksum value is calculated and the calculation result is substituted into a variable byCheckSum. When that is finished, the routine proceeds to step 1115.
[0133]
At the time of shifting to step 1106, the transfer of the straight portion is completed before the data of the number of data stored in the first and second bytes of the header portion is received. That is, data loss has occurred. For this reason, in steps 1106-1111, processing at the time of data loss is performed.
[0134]
First, in step 1106, it is determined whether TRUE is assigned to the variable bReTransferFlag. If the user has set the retransmission mode by operating the retransmission switch 206a, the determination is YES and the process proceeds to step 1107. Otherwise, the determination is no and the process moves to step 1110.
[0135]
  In steps 1107 to 1109, processing for requesting retransmission of data is performed in response to occurrence of a data loss error. Specifically, in step 1107, 0 is substituted into the variable wDataCounter, and in step 1108, a voice data transfer request command in which DATA STRAIGHT is stored as the data transfer format is recreated.Step 1109Then, the recreated command is written in the transmission data buffer in the interface 204. After these are finished, a series of processing is finished.
[0136]
In the other steps 1110 and 1111, data is not retransmitted in response to data loss, and therefore processing for dealing with the data loss is performed.
In step 1110, the data in the header part already received is rewritten. Specifically, the data of the straight part actually received that is assigned to the variable wDataCounter is the data of the first and second bytes of the header part stored in the data storage area of the header part allocated in the RAM 203. Rewrite as a number. After that, the process proceeds to step 1111 where DATA LOOP is substituted for the variable byDataReceivingStatus, the fourth and fifth byte data of the header part is substituted for the variable wLoopNum, and 0 is substituted for the variable wDataCounter. The marker data is inserted at the head of the loop part. For this reason, by substituting DATA LOOP for the variable byDataReceivingStatus, it is possible to receive the data of the loop portion transferred following the indicator data. After the end of step 1111, the series of processing ends.
[0137]
In this way, if data loss occurs in the straight part when the retransmission mode is not set, the header part data is rewritten according to the actual reception state of the straight part, and the consistency between the header part and the straight part Have taken. As a result, it is possible to minimize auditory problems caused by missing data.
[0138]
On the other hand, if DATA LOOP is assigned to the variable byDataReceivingStatus, the process proceeds from step 1101 to step 1112. In step 1112, it is determined whether or not the received data is beacon data. When the value of the most significant bit of the received data is 1, since it is indicator data, the determination is YES and the series of processes is terminated. Otherwise, the determination is no and the process moves to step 1113.
[0139]
  As described above, when data loss occurs before the transfer of the loop portion starts, the audio data is retransmitted or the header portion data is rewritten. Therefore, at the start of reception of the loop part, the indicator data added to the headIs receivingIt will be. The indicator data is data that is not used for playing a musical sound. For this reason, when the sign data is received, it is discarded.
[0140]
In step 1113, the received data is stored in the data storage area for the PCM data portion in the RAM 203. In the subsequent step 1114, a checksum value is calculated and the calculation result is substituted into a variable byCheckSum. When that is finished, the routine proceeds to step 1115.
[0141]
As described above, in steps 1101 to 1114, the received data is stored in the RAM 203 according to which part of the audio data belongs, whether or not data loss has occurred, and whether or not the retransmission mode is set. Accordingly, the audio data is retransmitted or the header data is rewritten.
[0142]
In step 1115, since 1 byte (1 word) is received as audio data, the value of the variable wDataCounter is incremented. Thereafter, the process proceeds to step 1116.
[0143]
In step 1116, it is determined whether the value of the variable wDataCounter is equal to the value of the variable wLoopNum. The variable wLoopNum is a variable to which the total number of words constituting each part of the header part, the straight part, or the loop part is substituted, and when the header part data is received, 6 is the straight part data. Is received, the data of the first and second bytes of the header portion is substituted, and the data of the fourth and fifth bytes of the header portion is substituted when the data of the loop portion is received. . For this reason, when all the data of the part currently being received is received, the determination is YES, and the process proceeds to step 1117. Otherwise, the determination is no and the series of processing ends.
[0144]
In step 1117 and subsequent steps, it is determined that the reception of a part of the data constituting the audio data is completed, and processing associated therewith is performed. It is determined whether or not the data of the portion has been normally received, that is, whether or not an error has occurred, and a countermeasure according to the determination result is performed.
[0145]
First, in step 1117, the value of the variable wDataCounter is cleared, that is, 0 is substituted for it. In the following step 1118, the value assigned to the variable byDataReceivingStatus is determined. If DATA HEADER is assigned to the variable byDataReceivingStatus, the process proceeds to step 1119, and the variables byDataReceivingStatus and wLoopNum are updated. Specifically, since the reception of the header part is completed, DATA STRAIGHT is substituted for the variable byDataReceivingStatus, and the other variable wLoopNum is composed of the first and second byte data of the header part that has been received. 16-bit value (the first byte is the upper 8 bits and the second byte is the lower 8 bits) is substituted. After it is finished, a series of processing is finished.
[0146]
If DATA STRAIGHT is assigned to the variable byDataReceivingStatus, the process proceeds to step 1120. In step 1120, it is determined whether the checksum value assigned to the variable byCheckSum matches the checksum value of the third byte of the received header part. If the straight part is received normally, the checksum values match, so the determination is yes, and the process proceeds to step 1121. If not, that is, if an error has occurred, the determination is no and the process moves to step 1122.
[0147]
In step 1121, the variables byDataReceivingStatus, wLoopNum, and byCheckSum are updated. Specifically, since the reception of the straight part has been normally completed, DATA LOOP is substituted for the variable byDataReceivingStatus, and the variable wLoopNum is composed of the fourth and fifth byte data of the header part that has been received. A 16-bit value (the fourth byte is the upper 8 bits and the fifth byte is the lower 8 bits) is substituted, and 0 is substituted for the variable byCheckSum. After it is finished, a series of processing is finished.
[0148]
In the other step 1122, it is determined whether TRUE is assigned to the variable bReTransferFlag. If the user has set the retransmission mode by operating the retransmission switch 206a, the determination is YES and the process proceeds to step 1123. If this is not the case, that is, if the user has designated the continuation of data transfer even when an error occurs, the determination is no and the process proceeds to step 1121.
[0149]
In step 1123, a voice data transfer request command in which DATA STRAIGHT is stored in the data transfer format is recreated. In the subsequent step 1124, the re-created command is stored in the transmission data buffer of the interface 204. Thereafter, the series of processing is terminated.
[0150]
In this way, data is retransmitted when an error occurs according to the value assigned to the variable bReTransferFlag. The value assigned to the variable bReTransferFlag can be changed by operating the retransmission switch 206a. For this reason, when the user does not set the retransmission mode, it is possible to avoid a delay in the sound generation timing, and when it is set, it is possible to avoid a decrease in sound quality of the sound to be generated.
[0151]
On the other hand, if DATA LOOP is assigned to the variable byDataReceivingStatus, the process proceeds from step 1118 to step 1125. In step 1125, it is determined whether the checksum value assigned to the variable byCheckSum matches the checksum value of the sixth byte of the received header part. If the reception of the loop part is performed normally, the checksum values match, so the determination is yes, and the process proceeds to step 1126. If not, that is, if an error has occurred, the determination is no and the process moves to step 1127.
[0152]
In step 1126, the variables byDataReceivingStatus, wLoopNum, and byCheckSum are updated. Specifically, since the reception of the loop part has been completed normally, that is, the reception of all audio data has been completed normally, DATA HEADER is substituted for the variable byDataReceivingStatus, and the total number of data (words) in the header part is assigned to the variable wLoopNum. 6 is substituted, and 0 is substituted for the variable byCheckSum. After it is finished, a series of processing is finished.
[0153]
In the other step 1127, since an error has occurred in reception of the loop part, an audio data transfer request command (a command in which the data transfer format of the third byte is DATA LOOP) requesting transfer of this loop part is issued. In step 1128, the command is written into the transmission data buffer of the interface 204. Thereafter, the series of processing is terminated.
[0154]
In the third embodiment, data is retransmitted at the time of data loss according to the setting of the retransmission mode. However, depending on the size of the error, for example, an error in which data is lost and transfer is performed. It may be possible to set whether to retransmit data when an error occurs separately for an error that has not been correctly performed. In addition, as described above, whether to retransmit data may be automatically selected. Further, it may be possible to individually select a portion for data retransmission.
[0155]
Further, in the third embodiment, when data loss occurs, the data in the header part is rewritten according to the missing state, but the data missing part is matched with the data in the header part. You may be allowed to rewrite the method. For example, when the number of missing data is relatively small, predetermined data in a portion where the data is missing may be copied to compensate for the missing data.
[0156]
In addition, the present embodiment (first to third embodiments) is a case where the present invention is applied to the electronic musical instrument 101 and the personal computer 103, but the present invention is applied to these apparatuses. It is not limited. For example, the data receiving device and the data transmitting device according to the present invention can be applied to two personal computers, respectively, so that data can be transmitted and received according to the present invention in both directions. That is, if the apparatus is capable of executing the program for realizing the operation of the electronic musical instrument 101 and / or the personal computer 103, the present invention can be installed by loading the program even in an existing apparatus. Can do. As is clear from this, the present invention can be flexibly applied (mounted).
[0157]
In addition, the data transmitted and received between them is naturally not limited to audio data. Further, in the data division, as in the present embodiment, in addition to the division focusing on the processing contents of the data (word data), the division focusing on the type of data (word data) such as items is performed. May be. Moreover, you may perform the division | segmentation which combined them. Various methods can be used for dividing data according to the data.
[0158]
【The invention's effect】
As described above, the data receiving apparatus according to the first aspect of the present invention isThe data sent by requesting transfer is monitored for the occurrence of errors in units of word data groups, and if an error has occurred, the consistency between word data groups, for example, depending on the reception status The word data group is changed to take For this reason, the malfunction which arises by an error can be reduced very rapidly.
[0161]
Of the present inventionThe data transmitting apparatus transmits the entire data or the word data group in response to a data transfer request or a retransfer request from the data receiving apparatus. For this reason,Data receiverCan obtain only necessary data or a group of word data as required.
[Brief description of the drawings]
FIG. 1 is an external view of a system to which a first embodiment is applied.
FIG. 2 is an overall circuit diagram of the electronic musical instrument.
FIG. 3 is a configuration diagram of audio data.
FIG. 4 is a configuration diagram of an audio data transfer request command.
FIG. 5 is an operation flowchart of overall processing.
FIG. 6 is an operation flowchart of voice data request processing.
FIG. 7 is an operation flowchart of data reception interrupt processing;
FIG. 8 is an operation flowchart of overall processing of a personal computer.
FIG. 9 is a configuration diagram of audio data (second embodiment);
FIG. 10 is an operation flowchart of data reception interrupt processing (second embodiment);
FIG. 11 is an operation flowchart of data reception interrupt processing (third embodiment);
[Explanation of symbols]
101 Electronic musical instrument
103 PC
201 CPU
202 ROM
203 RAM
204 interface
206 switches

Claims (3)

所定の通信手段を介して接続された外部装置から転送される処理単位のデータを受信する装置であって、
前記外部装置に対し、前記データの転送を要求する要求手段と、
前記外部装置から転送されたデータを受信する受信手段と、
前記データを構成するワードデータを処理内容に基づいて複数のワードデータ群に分類して、前記受信手段がデータを正常に受信したか否かを前記ワードデータ群単位で判定する判定手段と、
前記判定手段が正常でないと判定したワードデータ群が存在していた場合に、前記受信手段の受信状態に応じて、該ワードデータ群、及び他のワードデータ群の少なくとも一方を変更する変更手段と、
を具備したことを特徴とするデータ受信装置。
An apparatus for receiving processing unit data transferred from an external apparatus connected via a predetermined communication means,
Request means for requesting the external device to transfer the data;
Receiving means for receiving data transferred from the external device;
Classifying the word data constituting the data into a plurality of word data groups based on processing contents, and determining means for determining whether the receiving means has received data normally in units of the word data groups;
A changing unit that changes at least one of the word data group and another word data group according to a reception state of the receiving unit when there is a word data group that is determined to be abnormal by the determining unit; ,
A data receiving apparatus comprising:
前記判定手段が正常でないと判定したワードデータ群の再転送を要求するか否か決定する決定手段と、
前記ワードデータ群の再転送を要求すると前記決定手段が決定した場合に、該ワードデータ群の再転送を前記外部装置に要求する再転送要求手段と、を更に具備し、
前記変更手段は、前記ワードデータ群の再転送を要求しないと前記決定手段が決定した場合に、該ワードデータ群、及び他のワードデータ群の少なくとも一方を変更する、
ことを特徴とする請求項1記載のデータ受信装置。
Determining means for determining whether or not to request retransfer of the word data group determined that the determining means is not normal;
Re-transmission requesting means for requesting the external device to re-transfer the word data group when the determining means determines to request re-transfer of the word data group;
The changing unit changes at least one of the word data group and another word data group when the determining unit determines that the re-transfer of the word data group is not requested.
The data receiving apparatus according to claim 1.
請求項1または2記載のデータ受信装置にデータを送信する装置であって、
前記データ受信装置からのデータの転送要求、及び前記ワードデータ群の再転送要求を受信する受信手段と、
前記受信手段が受信した要求の内容に応じて、前記データ、及び前記ワードデータ群の少なくとも一方を前記データ受信装置に送信する送信手段と、
を具備したことを特徴とするデータ送信装置。
An apparatus for transmitting data to the data receiving apparatus according to claim 1 or 2,
Receiving means for receiving a data transfer request from the data receiving device and a retransfer request for the word data group;
Transmitting means for transmitting at least one of the data and the word data group to the data receiving device according to the content of the request received by the receiving means;
A data transmission device comprising:
JP35912196A 1996-12-28 1996-12-28 Data receiving apparatus and data transmitting apparatus Expired - Fee Related JP3658661B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP35912196A JP3658661B2 (en) 1996-12-28 1996-12-28 Data receiving apparatus and data transmitting apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP35912196A JP3658661B2 (en) 1996-12-28 1996-12-28 Data receiving apparatus and data transmitting apparatus

Publications (3)

Publication Number Publication Date
JPH10190636A JPH10190636A (en) 1998-07-21
JP3658661B2 true JP3658661B2 (en) 2005-06-08
JPH10190636A5 JPH10190636A5 (en) 2005-08-18

Family

ID=18462850

Family Applications (1)

Application Number Title Priority Date Filing Date
JP35912196A Expired - Fee Related JP3658661B2 (en) 1996-12-28 1996-12-28 Data receiving apparatus and data transmitting apparatus

Country Status (1)

Country Link
JP (1) JP3658661B2 (en)

Also Published As

Publication number Publication date
JPH10190636A (en) 1998-07-21

Similar Documents

Publication Publication Date Title
JP3372124B2 (en) Electronic musical instrument
JP3671274B2 (en) Music information transmitting / receiving device, receiving device, and storage medium
US6762358B2 (en) Waveform reproduction apparatus
JP2001013961A (en) Data transmitter, data receiver, and computer readable recording medium stored with program applied to each device
US20020014147A1 (en) Communications apparatus for tone generator setting information
JP3484719B2 (en) Performance guide device with voice input function and performance guide method
JPH06259065A (en) Electronic musical instrument
JP3658661B2 (en) Data receiving apparatus and data transmitting apparatus
US8373055B2 (en) Apparatus, method and computer program for switching musical tone output
US5691495A (en) Electronic musical instrument with synchronized control on generation of musical tones
JP3509601B2 (en) Tone generator
JP3780695B2 (en) Effect adding device and sound effect setting method
JP4259533B2 (en) Performance system, controller used in this system, and program
JP3278857B2 (en) Musical tone generator
JPH0434753B2 (en)
US7631094B1 (en) Temporary storage of communications data
JP3410134B2 (en) Electronic musical instrument
JP2709965B2 (en) Music transmission / reproduction system used for BGM reproduction
JP3687317B2 (en) Music generator
JP2576764B2 (en) Channel assignment device
JP2002287748A (en) Electronic musical instrument
JP4306138B2 (en) Musical sound generator and musical sound generation processing program
JPH10143156A (en) Electronic musical instrument operating device
JPH1195746A (en) Midi data processor
JPH07199940A (en) Electronic musical instrument demo performance controller

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20040805

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050201

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20050215

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050228

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090325

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees