JP3725247B2 - Music generation processing method - Google Patents

Music generation processing method Download PDF

Info

Publication number
JP3725247B2
JP3725247B2 JP14782096A JP14782096A JP3725247B2 JP 3725247 B2 JP3725247 B2 JP 3725247B2 JP 14782096 A JP14782096 A JP 14782096A JP 14782096 A JP14782096 A JP 14782096A JP 3725247 B2 JP3725247 B2 JP 3725247B2
Authority
JP
Japan
Prior art keywords
musical
generation
processing
sound
musical sound
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
JP14782096A
Other languages
Japanese (ja)
Other versions
JPH09311681A (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.)
Roland Corp
Original Assignee
Roland Corp
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 Roland Corp filed Critical Roland Corp
Priority to JP14782096A priority Critical patent/JP3725247B2/en
Publication of JPH09311681A publication Critical patent/JPH09311681A/en
Application granted granted Critical
Publication of JP3725247B2 publication Critical patent/JP3725247B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Electrophonic Musical Instruments (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、楽音生成処理方法に関し、さらに詳細には、パーソナルコンピュータやワークステーションなどの汎用のコンピュータ上でソフトウェアによりシンセサイザを構築するための楽音生成処理方法に関する。
【0002】
【発明の背景および発明が解決しようとする課題】
従来、楽音を生成するためには、楽音生成用の専用のハードウェア、所謂、電子楽器を用いることが必要であった。
【0003】
しかしながら、近年、汎用のコンピュータに高性能のCPUおよびCPUが処理したデータをアナログ信号として外部へ出力するためのD/A変換器(デジタル−アナログ変換器)が搭載されるようになってきたことに伴い、専用のハードウェアを用いることなしに、汎用のコンピュータ上で楽音をリアルタイムに生成することができる可能性が検討されてきている。
【0004】
具体的には、楽音のデータは正確にサンプリング周期毎にD/A変換器に出力しなければならないため、タイマに応じてサンプリング周期毎に楽音のデータを生成する処理を行うことが検討されている。
【0005】
この処理を実現するためには、サンプリング周期毎に発生するタイマインタラプトに応じて、インタラプトルーチンの中で楽音のデータを生成する処理を行うことが考えられるが、楽音のデータを生成する処理は複雑であり、こうした複雑な処理をインタラプトルーチンの中で行うのは困難であるという問題点が指摘されていた。
【0006】
あるいはまた、上記した処理を実現するためには、サンプリング周期毎に起動されるタスクで楽音のデータを生成する処理を行うことも考えられるが、これによると、サンプリング周期毎という複雑なタイミングでタスクを切り換える処理を行う必要があり、タスク切り換えのためのオーバーヘッドが増大することになり、CPUが実際に処理することができる時間が短くなってしまうという問題点が指摘されていた。
【0007】
ところで、一般に、一つのソフトウェアを様々な汎用のコンピュータで使用することが可能であるが、これら様々な汎用のコンピュータにそれぞれ搭載されているCPUの能力は区々であり、低い能力のCPUに合わせてソフトウェアを作成すると、能力の高いCPUが搭載されたコンピュータではCPUの能力を使いきることができないという問題点があった。
【0008】
また、汎用のコンピュータにおいては、複数のソフトウェアを同時に実行させるという使用方法が一般的に行われているが、楽音を生成する処理とともに、楽音を生成する処理以外の他の処理も同時に行う場合には、他の処理の処理状況に応じてCPUの負荷は刻々と変化することとなる。このため、CPUの負荷が最も重い状態に合わせてソフトウェアを作成すると、負荷が軽い場合にCPUの能力を使いきることができないという問題点があった。
【0009】
さらに、一般に、CPUによる楽音を生成する処理の少なくとも一部は、一定の時間間隔で繰り返し行われることになるが、ノートオン(発音開始)/ノートオフ(発音終了)を示す指示は、使用者(ユーザー)の所望のタイミングに応じてこの繰り返し間隔とは非同期で発生する。即ち、ノートオン/ノートオフを示す指示に応じて楽音を生成する処理にデータを受け渡し、データを受け渡された楽音を生成する処理においては、受け渡されたデータに基づいて楽音を生成する処理を行うこととなるが、ノートオン/ノートオフを示す指示は上記繰り返し間隔とは非同期であるため、楽音を生成する処理をしている最中に、ノートオン/ノートオフを示す指示に応じてデータを書き換えてしまったり、あるいはノートオン/ノートオフを示す指示に応じてデータを書き換えている最中に楽音を生成する処理を行うと、生成中の楽音にノイズが生じるという問題点があり、データの受け渡し方法を改良する必要性が指摘されていた。
【0010】
本発明は、上記したような種々の問題点に鑑みてなされたものであり、その目的とするところは、汎用のコンピュータに適した処理を行うことにより上記した種々の問題点の解決を図り、汎用のコンピュータ上で楽音をリアルタイムで効率的に生成することのできる楽音生成処理方法を提供しようとするものである。
【0011】
【課題を解決するための手段】
上記目的を達成するために、本発明による楽音生成処理方法は、複数の楽音の生成態様のうちで予め設定された所定の態様で楽音を生成するようにするとともに、サンプリング周期よりも長い所定時間毎に、上記所定時間に含まれる複数のサンプリング時点の楽音のデータを一度にまとめて生成し、時間的な順序付けをして記憶する処理を行う楽音データ生成処理と、上記楽音データ生成処理により記憶した各サンプリング時点の楽音のデータを、サンプリング周期毎に上記時間的な順序付けに従って順次読み出して出力する処理を行う楽音データ出力処理と、上記楽音データ生成処理にかかる負荷量を計測によって検出する処理と、上記検出する処理により検出された負荷量に応じて、上記楽音データ生成処理における楽音の生成態様の設定を変更する処理とを行うようにしたものである。
【0015】
ここで、上記楽音の生成態様の設定を変更する処理は、上記楽音データ生成処理の許容負荷量と上記検出する処理により検出された負荷量とに基づいて、楽音の生成態様の設定を変更するものとすることができる。
【0016】
さらに、本発明による楽音生成処理方法は、複数の楽音の生成態様のうちの所定の態様で楽音を生成するようにするとともに、サンプリング周期よりも長い所定時間毎に、上記所定時間に含まれる複数のサンプリング時点の楽音のデータを一度にまとめて生成し、時間的な順序付けをして記憶する処理を行う楽音データ生成処理と、上記楽音データ生成処理により記憶した各サンプリング時点の楽音のデータを、サンプリング周期毎に上記時間的な順序付けに従って順次読み出して出力する処理を行う楽音データ出力処理と、上記楽音データ生成処理にかかる負荷量を自動的に刻々と計測によって検出する処理と、上記検出する処理により検出された負荷量に応じて、上記楽音データ生成処理における楽音の生成態様の設定を自動的に刻々と変化させる処理とを行うようにしたものである。
【0017】
ここで、上記検出する処理は、上記楽音データ生成処理に費やされる時間を計測し、上記計測した時間と上記楽音データ生成処理の実行時間間隔とに基づいて、上記負荷量を検出するものとすることができる。
【0018】
また、上記楽音の生成態様を決定する処理により決定される上記楽音の生成態様は、楽音の同時発音数、効果付与手段の効果付与態様あるいはサンプリング周波数の少なくともいずれか1つであるとすることができる。
【0019】
また、上記楽音の生成態様を決定する処理により決定される上記楽音の生成態様は、楽音の同時発音数、効果付与手段の効果付与態様あるいはサンプリング周波数の少なくともいずれか2つであり、使用者の指示により上記楽音の生成態様のいずれかを優先させ、上記楽音の生成態様を決定する処理は、優先されない上記楽音の生成態様を上記検出する処理により検出された上記負荷量に基づいて決定するものとすることができる。
【0023】
【発明の実施の形態】
以下、添付の図面を参照しながら、本発明の楽音生成処理方法の実施の形態を詳細に説明する。
【0024】
図1は、本発明の楽音生成処理方法によるプログラムを搭載可能な、典型的な汎用のコンピュータのハードウェア構成を示すブロック図である。
【0025】
この図1に示す汎用のコンピュータは、極めて一般的な構成を備えており、バス10を介して、CPU12と、メモリ14と、ディスクコントローラ16と、ビデオカード18と、I/Oカード20と、サウンドカード22とが接続されており、さらに、ディスクコントローラ16にはハードディスク24が接続され、ビデオカード18にはディスプレイ装置26が接続され、I/Oカード20にはキーボード28およびマウス30が接続されている。そして、このコンピュータにおいては、サウンドカード22から楽音信号が出力される。
【0026】
また、この汎用のコンピュータにおいては、本発明の楽音生成処理方法によるプログラムの他に、シーケンサ(自動演奏)のプログラムも同時に起動され、シーケンサのプログラムから本発明の楽音生成処理方法によるプログラムへMIDI情報が引き渡され、本発明の楽音生成処理方法によるプログラムにおいては、引き渡されたMIDI情報に応じて楽音信号を生成して出力する。
【0027】
図2は、本発明の楽音生成処理方法によるプログラムの全体構成を示し、制御タスク、音源タスクおよび出力タスクより構成されている。
【0028】
即ち、制御タスクは制御プログラムを実行し、シーケンサのプログラムとの間でMIDI情報のやりとりを行うとともに、音源タスク側へイベントフラグ、発音パラメータ、定常処理パラメータ、エフェクトパラメータを引き渡し、音源タスク側からボイス解放情報を受け取る。
【0029】
音源タスクは、複数のボイス(楽音生成チャンネル)ならびにエフェクトに関する処理を行い、ウェーブバッファへ生成した楽音信号を記憶させて出力タスクへ引き渡す。即ち、複数のボイスのそれぞれの処理を行い、後述する発音パラメータのエフェクト送り量に応じて各ボイスの出力をエフェクトへ引き渡し、エフェクトを付加されていない各ボイスの出力とエフェクトを付加された各ボイスの出力とを最終的にミキシングしてウェーブバッファへ記憶し、出力タスクへ引き渡すことになる。
【0030】
出力タスクにおいては、ウェーブバッファを用いてウェーブ出力処理を行い、外部へ楽音信号を出力する。そして、出力タスクにおいて使用されたウェーブバッファは、音源タスク側へ戻される。
【0031】
上記したように、制御タスクと音源タスクとがやりとりする情報には、イベントフラグ、発音パラメータ、定常処理パラメータ、エフェクトパラメータおよびボイス解放情報がある。以下、これらの情報に関して説明する。
【0032】
(1)イベントフラグ
イベントフラグはボイス数分用意されていて、音源タスクは制御タスクからイベントフラグにより各ボイスの発音開始および発音終了の情報(フラグ)を受ける。イベントフラグは、制御タスクと音源タスクとの両方からアクセス可能な共有メモリに記憶される。
【0033】
(2)発音パラメータ
後述するように、音源タスクは起動される度にイベントフラグの内容をサーチし、発音開始フラグを見つけると、発音パラメータに従って発音を開始するが、発音パラメータには、ボイス毎に以下の(a)乃至(i)に示す情報が含まれている。
(a)波形読み出し関係パラメータ
(波形開始アドレス、ループ関係アドレス、ピッチ)
(b)ピッチLFO関係パラメータ
(波形、周期、遅延など)
(c)フィルタLFO関係パラメータ
(波形、周期、遅延など)
(d)アンプLFO関係パラメータ
(波形、周期、遅延など)
(e)ピッチエンベロープ関係パラメータ
(アタック、ディケイ、サスティン、リリースなどの各時間やレベル)
(f)TVF(Time Variable Filter:時変フィルタ) エンベロープ関係パラメータ
(アタック、ディケイ、サスティン、リリースなどの各時間やレベル)
(g)TVA(Time Variable Amplifier:時変アンプ)エンベロープ関係パラメータ
(アタック、ディケイ、サスティン、リリースなどの各時間やレベル)
(h)パン
(i)エフェクト送り量
これらの情報を含む発音パラメータは、制御タスクと音源タスクとの両方からアクセス可能な共用メモリに記憶される。そして、発音パラメータを記憶するメモリ空間は、ボイス毎に2面づつ設けられている。即ち、音源タスクがイベントフラグに発音開始のフラグを見つけると、音源タスクはこれ以後に音源タスクが参照するメモリ空間を今まで参照していた面からもう一つの面に切り換えるとともに、今まで参照していた面を制御タスクに渡す。従って、制御タスクは、同じボイス番号の発音パラメータを設定する場合でも、音源タスクから渡された現在処理中の面とは異なるもう一面の新しいメモリ空間を用いることによって、音源タスク側で発音時に参照される現在処理中の面のパラメータエリアを壊すことなしに、音源タスクへ発音パラメータの引き渡し行うことができる。逆に、制御タスク側で書き換えている途中のパラメータエリアを音源タスクが参照するという事態の発生を防ぐこともできる。
【0034】
(3)定常処理パラメータ
定常処理パラメータは、ボイス毎に以下の(a)乃至(c)に示す情報が含まれている。
(a)ピッチオフセット
(b)フィルタオフセット
(c)アンプオフセット
これらの定常処理パラメータは、制御タスクと音源タスクとの両方からアクセス可能な共用メモリに記憶され、ピッチベンダやホイルなどの操作子などから得られた情報をサービスするためのものである。
【0035】
これらの定常処理パラメータは、音源タスクが起動される度に読み込まれ、発音中に音源タスク内部で生成されるエンベロープやLFOなどと合成されることになり、こうして合成されたデータを発音サービスパラメータと称する。
【0036】
発音サービスパラメータは、波形読み出しのピッチや、TVFのカットオフ周波数、TVAのアンプリチュード(増幅度)を制御する。
【0037】
(4)エフェクトパラメータ
エフェクトパラメータは、制御タスクと音源タスクとの両方からアクセス可能な共用メモリに記憶されたエフェクト制御用の情報であり、エフェクトに渡される。このエフェクトパラメータは、音源タスクが起動される度に読み込まれ、前回読み込んだ内容と異なるパラメータがあれば、それをエフェクトに反映することになる。
【0038】
なお、エフェクトパラメータは、エフェクトの具体的内容によってパラメータが異なるものであり、エフェクトの具体的内容は本発明の要旨から外れるものであるので、その詳細な説明は省略する。
【0039】
(5)ボイス開放情報
ボイス開放情報は、音源タスクから制御タスクへ返されるものであり、発音が終了したボイスの番号を示す。なお、各ボイスの発音終了は、TVAのエンベロープにより判断する。このボイス開放情報はメモリ空間を用いるのではなく、イベントによって制御タスクへ渡される。
【0040】
ここで、イベントフラグ、発音パラメータ、定常処理パラメータおよびエフェクトパラメータが共有メモリを用いて受け渡しが行われるのに対して、ボイス開放情報がイベントで渡されるというタスク間の通信方法の違いは、音源タスクはタイマにより起動されるため、制御タスク側から非同期なイベント情報を受け取ることができないためである。
ところで、上記した制御タスク、音源タスクおよび出力タスクには優先度(プライオリティ:priority)が設けられていて、他のタスクなどにより処理を中断されることが好ましくないタスクは、優先度を高くするようになされている。なお、この実施の形態においては、出力タスクの優先度が最も高く、次に音源タスクの優先度が高く、制御タスクの優先度が最も低くなされている。
【0041】
以下、図2および図3を参照しながら、制御タスク、音源タスクおよび出力タスクを詳細に説明する。
【0042】
(1)制御タスク
制御タスクはMIDI情報を得て音源タスクを制御するものであり、シーケンサのプログラムからのMIDI情報や音源タスクからのボイス解放情報を受け取ることにより起動される。
【0043】
ここで、制御タスクは、各ボイスに関して、当該ボイスが発音中か空いているかを示すボイス情報を常に管理しているものであり、MIDI情報としてノートオンを受け取ると、ボイス情報を参照して適当な空いているボイスを指定し、当該ボイスを用いて当該ノートオンを発音するように、当該ボイスに対して当該ノートオンに必要な発音パラメータを設定するとともにその後にイベントフラグに発音開始を設定し、指定したボイスのボイス情報を更新する処理を行う。そして、音源タスクにおいては、上記した制御タスクの処理に応じて、指定されたボイスで新たな発音を開始する。
【0044】
また、制御タスクは、MIDI情報としてノートオンを受け取ったときに、ボイス情報を参照して空きボイスが無い場合には、発音中のレベルが小さいボイスを選択したり、あるいは最も過去に発音開始されたボイスを選択したりするなど所定の選択基準により不必要と思われるボイスを選択し、当該ボイスを用いて当該ノートオンを発音するように、当該ボイスに対して当該ノートオンに必要な発音パラメータを設定するとともにその後にイベントフラグに発音開始を設定する処理を行う。そして、音源タスクにおいては、上記した制御タスクの処理に応じて、すばやく選択されたボイスの現在の発音をミュートしてから、選択されたボイスにより新たな発音を開始する。
【0045】
上記したように、制御タスクにおいては、MIDI情報としてノートオンを受け取ると、ボイスの割り当て、所謂、アサイン処理を行うことになる。
【0046】
一方、制御タスクは、MIDI情報としてノートオフを受け取ると、当該ノートオフに対応する発音中のボイスに対して発音を終了するように、イベントフラグに発音終了を設定する処理を行う。そして、音源タスクにおいては、上記した制御タスクの処理に応じて、当該ノートオフに対応する発音中のボイスを消音する。
【0047】
なお、後述するように、音源タスク中のボイスの処理に関しては、発音していないボイスに対しては行われない。従って、発音ボイス数に応じて、音源タスクの演算量が増減することになる。このため、本発明においては、最大発音可能な発音数は、コンピュータの能力に応じて予め設定できるとともに、適宜変更することができるようになされている。
【0048】
また、制御タスクは、MIDI情報として定常処理パラメータ、エフェクトパラメータの値を変更するメッセージを受け取ると、対応する定常処理パラメータ、エフェクトパラメータを音源タスクに引き渡す処理を行う。
【0049】
さらに、制御タスクは、音源タスクから制御タスクへボイス解放情報が渡された場合には、渡されたボイス解放情報に応じて指定したボイスのボイス情報を更新する。
【0050】
(2)音源タスク
音源タスクは10ms(ミリ秒)毎にタイマによって起動され、10ms分の波形読み出し、TVF、TVA、パン、エンベロープ、LFO、エフェクト処理をまとめてなるべく短時間で行う。上記したように、音源タスクは10ms分の処理を行うものであるので、サンプリング周波数を32KHzとすると、320サンプル分の処理を行うことになる。
【0051】
そして、音源タスクは起動される度にイベントフラグの内容をサーチし、発音開始フラグを見つけると、発音パラメータに従って発音を開始する。この際に、発音パラメータを記憶するメモリ空間は、ボイス毎に2面づつ設けられており、音源タスクがイベントフラグに発音開始のフラグを見つけると、音源タスクはこれ以後に音源タスクが参照するメモリ空間を今まで参照していた面からもう一つの面に切り換えるとともに、今まで参照していた面を制御タスクに渡す。従って、制御タスクは、同じボイス番号の発音パラメータを設定する場合でも、音源タスクから渡された現在処理中の面とは異なるもう一面の新しいメモリ空間を用いることによって、音源タスク側で発音時に参照される現在処理中の面のパラメータエリアを壊すことなしに、音源タスクへ発音パラメータの引き渡し行うことができる。
【0052】
ここで、各ボイスにおける処理を説明すると、音源タスクにおいては、共有のメモリに記憶される発音パラメータおよび定常処理パラメータは、音源タスクが起動される度に取り込まれ、エンベロープやLFOの演算およびそれに定常処理パラメータを反映し、発音サービスパラメータを生成する演算を行う。こうして生成された発音サービスパラメータにより、波形読み出しのピッチや、TVFのカットオフ周波数、TVAのアンプリチュード(増幅度)が制御され、発音パラメータのエフェクト送り量に応じてボイスの出力をエフェクトへ引き渡し、エフェクトを付加されていないボイスの出力は発音パラメータのパンによりパンポットを制御されてステレオ出力される(図3(a))。
【0053】
そして、エフェクトパラメータによって制御されたエフェクトを付加された各ボイスの出力とエフェクトを付加されていない各ボイスの出力とが、ミキシングされてステレオ出力され(図3(b))、最終的にウェーブバッファへ記憶されて出力タスクへ引き渡される。
【0054】
図4には、発音サービスパラメータの生成の処理を示すフローチャートが示されており、最初のボイスからボイス毎に順次処理が行われる。
【0055】
まず、イベントフラグが発音開始を示しているかチェックし(ステップS402)、イベントフラグが発音開始を示していない場合には、イベントフラグが発音終了を示しているかチェックする(ステップS404)。
【0056】
ステップS404でイベントフラグが発音終了を示していない場合には、発音中を示すフラグであるvoiceActiveに「1」がセットされていて、発音中であることを示しているかをチェックする(ステップS406)。
【0057】
一方、ステップS404でイベントフラグが発音終了を示している場合には、それを受けてエンベロープをリリース処理へ進め(ステップS408)、前回処理の際の発音サービスパラメータの計算値n1をn0にセット(ステップS410)した後に、エンベロープ、LFOおよび定常処理パラメータを反映させた演算を行い発音サービスパラメータを生成して計算値n1にセットする(ステップS412)。即ち、前回処理からの10msの時間経過に応じてエンベロープ、LFOの値を変化させ新たなエンベロープ、LFOおよび定常処理パラメータを合成(加算あるいは乗算)して発音サービスパラメータを生成する。なお、発音サービスパラメータは、波形読み出しのピッチ、TVF、TVAそれぞれについて独立に演算する。
【0058】
また、ステップS406でvoiceActiveに「1」がセットされていて、発音中である場合にも、前回処理の際の発音サービスパラメータの計算値n1をn0にセット(ステップS410)した後に、エンベロープ、LFOおよび定常処理パラメータを反映させた演算を行い発音サービスパラメータを生成して計算値n1にセットする(ステップS412)。なお、発音サービスパラメータは、波形読み出しのピッチ、TVF、TVAそれぞれについて独立に演算する。
ところで、ステップS402でイベントフラグが発音開始である場合には、制御タスク、音源タスクの使用する発音パラメータエリアを示すポインタを、もう一面の発音パラメータエリアを示すものに更新し(ステップS414)、voiceActiveに「1」がセットされていて、発音中であることを示しているかをチェックする(ステップS416)。
【0059】
ステップS416でvoiceActiveに「1」がセットされていて、発音中である場合には、現在発音中のボイスを急速にミュートしてから(ステップS418)、エンベロープ、LFOおよび定常処理パラメータを反映させた演算を行い発音開始時の発音サービスパラメータを生成して計算値n0にセットする(ステップS420)。なお、発音サービスパラメータは、波形読み出しのピッチ、TVF、TVAそれぞれについて独立に演算する。
【0060】
一方、ステップS416でvoiceActiveに「1」がセットされておらず、発音中でない場合には、そのままステップS420へ進み、エンベロープ、LFOおよび定常処理パラメータを反映させた演算を行い発音開始時の発音サービスパラメータを生成して計算値n0にセットする。
【0061】
上記のようにして、ステップS420でエンベロープ、LFOおよび定常処理パラメータを反映させた演算を行い発音開始時の発音サービスパラメータを生成して計算値n0にセットし、それからvoiceActiveに「1」をセットして発音中であることを示し(ステップS422)た後に、発音開始からの10msの時間経過に応じてエンベロープ、LFOおよび定常処理パラメータを反映させた演算を行い発音サービスパラメータを生成して計算値n1にセットする(ステップS412)。なお、発音サービスパラメータは、波形読み出しのピッチ、TVF、TVAそれぞれについて独立に演算する。
【0062】
そして、ステップS412でエンベロープ、LFOおよび定常処理パラメータを反映させた演算を行い発音サービスパラメータを生成して計算値n1にセットすると、必要に応じて補間処理を行う際に用いるために、今回の発音サービスパラメータの計算値n1と前回の発音サービスパラメータの計算値n0との差分dを求め(ステップS424)、TVAのエンベロープが最後まで来ているかをチェックする(ステップS426)。
【0063】
ステップS426でTVAのエンベロープが最後まで来ていない場合には、そのままイベントフラグをクリアし(ステップS428)、ステップS426でTVAのエンベロープが最後まで来ている場合には、制御タスクにボイス解放情報を返し(ステップS430)、voiceActiveに「0」をセットして発音中でないことを示してから(ステップS432)、イベントフラグをクリアする(ステップS428)。
【0064】
また、ステップS406でvoiceActiveに「1」がセットされておらず発音中でない場合には、そのままイベントフラグをクリアする(ステップS428)。
【0065】
そして、イベントフラグをクリアすると(ステップS428)、それから全ボイスの処理が終わったかチェックする(ステップS434)。ステップS434でのチェックにより全ボイスの処理が終わったならば、このフローチャートの処理を終了するが、ステップS434でのチェックにより全ボイスの処理が終わっていないならば、ステップS402へ戻り以降の処理を繰り返して次のボイスの処理を行う。即ち、全ボイスの処理が終わるまで、このフローチャートの処理を繰り返すことになる。
【0066】
なお、発音サービスパラメータを受けて行われる波形読み出し、TVF、TVA、パンおよびエフェクトへの送り量の処理は、音源タスクが起動される度にこれらの処理をまとめて10ms分行い、その後に、エフェクト処理を10ms分まとめて行うものであり、図5にはこの処理のフローチャートが示されている。
即ち、図5のフローチャートにおいては、最初のボイスからボイス毎に順次処理が行われる。
【0067】
まず、voiceActiveに「1」がセットされていて、発音中であることを示しているかをチェックし(ステップS502)、ステップS502でvoiceActiveに「0」がセットされていて、発音中でない場合には、全ボイスの処理が終わったかをチェックするステップS514へジャンプして進み、次のボイスの処理へ移る。つまり、このフローチャートにおいては、発音されていないボイスの処理は行わないことになる。
【0068】
一方、ステップS502でvoiceActiveに「1」がセットされていて、発音中である場合には、発音サービスパラメータの示すピッチで発音するように波形読み出しを行う(ステップS504)。ここで、発音サービスパラメータは、図4に示すフローチャートのステップS424で求めた差分dを用いて、必要な精度まで直線補間される。即ち、サンプリング周波数32KHzとすると、図4に示すフローチャートのステップS410あるいはステップS420で求めた計算値n0にセットされた発音サービスパラメータとステップS424で求めた差分dを用いて、
n0+d×k/320
なる演算を行い補間値とする。なお、320はサンプリング周波数32KHz時の10ms分のサンプル数であり、kは320サンプルのうちの何番目のサンプルであるかを示しており、最初の処理では‘0’、以後処理の度に‘1’、‘2’、・・・とされる値である。
【0069】
次に、ステップS504の波形読み出しの出力をTVFによりフィルタリングする(ステップS506)。ここで、TVFのカットオフ周波数は発音サービスパラメータによって制御され、発音サービスパラメータは、図4に示すフローチャートのステップS424で求めた差分dを用いて、必要な精度に直線補間して用いる。
【0070】
さらに、ステップS506のフィルタリングされた出力のアンプリチュードを、TVAにより発音サービスパラメータに従って制御する(ステップS508)。ここで、発音サービスパラメータは、図4に示すフローチャートのステップS424で求めた差分dを用いて、必要な精度に直線補間して用いる。
【0071】
さらに次に、発音パラメータによって、パンおよびエフェクトへの送り量を制御するとともに図3(b)に示される他のボイスの楽音信号との加算混合処理を行い(ステップS510)、その後に、10ms分の処理を終えたかチェックされ(ステップS512)、10ms分の処理を終わっていなければ、ステップS504へ戻って次のサンプルに関してステップS504以降の処理を行う。即ち、ステップS504乃至ステップS510の処理は、サンプル毎の処理であり、10ms分のサンプル個数の処理が行われる。
【0072】
一方、10ms分の処理を終わったならば、全ボイスの処理が終わったかチェックする(ステップS514)。このチェックにより、全ボイスの処理が終わったならば、エフェクトの処理を10ms分まとめて行い(ステップS516)、上記した処理の行われた10ms分の楽音信号を記憶したウェーブバッファを出力タスクに渡し(ステップS518)、このフローチャートの処理を終了する。ここで、上記した処理の行われた楽音信号を記憶したウェーブバッファを出力タスクに渡すと同時に、新しいウェーブバッファを受け取り、新しいウェーブバッファは、次回のステップS502乃至ステップS516の処理に用いる。
【0073】
一方、ボイスの処理が終わっていないならば、ステップS502へ戻り以降の処理を繰り返して次のボイスの処理を行う。即ち、全ボイスの処理が終わるまで、このフローチャートの処理を繰り返すことになる。
【0074】
(3)出力タスク
出力タスクは、音源タスクより受け取ったウェーブバッファの記憶内容を、オーディオデータ出力デバイス(図1に示すコンピュータにおいては、サウンドカード22である。)にDMA転送する。このDMA転送は、オーディオデータ出力デバイスからの割り込みによって開始される。
【0075】
ここで、サウンドカード22などのオーディオデータ出力デバイス(以下、「出力デバイス」と称す。)は、出力するオーディオデータを一時記憶するためのバッファを内蔵しており、サンプリング周期毎に一時記憶しているオーディオデータを1サンプリング分づつ出力する。そして、内蔵バッファに残っているオーディオデータが所定量より少なくなると出力タスクに割り込みをかけ、この割り込みに応じて、出力タスクは出力デバイスが必要とする所定サンプル分のオーディオデータを出力デバイスにDMA転送するものである。
【0076】
なお、上記した出力タスクへの割り込みは、通常、約10ms程度の周期でかかる。
【0077】
即ち、図1に示すコンピュータにおいては、出力タスクは、サウンドカード22からの割り込みと音源タスクからのウェーブバッファを受け取るときに起動される。
【0078】
そして、出力タスクは、音源タスクから10ms分のウェーブバッファを受け取ると、空いているウェーブバッファを音源タスクに返す。ウェーブバッファは4本以上あり、常に1つは出力タスクが出力デバイスに出力を行い、1つは音源タスクが処理に用い、残りは空いているというローテーションを繰り返すようになされている。
【0079】
以上において説明したように、本発明による楽音処理方法においては、エンベロープやLFOの演算はサンプリング周波数よりも長い時間単位で定期的に行い、その演算結果を用いる際には、所望の精度となるように当該演算結果を補間するようにしている。
【0080】
これによって、演算に複雑な条件判断を要し、比較的演算ステップ数の多いエンベロープやLFOの演算を軽減することが可能となる。
【0081】
具体的には、上記した処理においては、エンベロープ、LFOおよび操作子などによって与えられるような情報を反映する演算は、音源タスクの処理中に一度だけしか行われていない。つまり、音源タスクが10msに一度起動されるものとすれば、これらの演算は10msに一度しか行われない。そして、こうした演算結果を用いる箇所(波形読み出しピッチ、TVF、TVAなど)では、必要に応じて当該演算結果を補間して用いている。
【0082】
また、補間は、エンベロープ、LFO、操作子などによって与えられる情報を合成した後に、その合成値に対して行っているので、エンベロープ、LFO、操作子などの各情報毎に補間を行う場合に比べて処理量が低減されている。
【0083】
また、本発明による楽音処理方法においては、波形読み出し、補間、エンベロープ、エフェクトなどそれぞれの演算を、サンプリング周波数間隔で処理するのではなくて、処理毎にまとめて長い時間スパンで処理を行うようにしている。
【0084】
具体的には、10ms毎に波形を読み出して、10ms分まとめて処理するようにしている。このときに、他の処理に影響しないように、なるべく短時間で処理を完了させるようにしている。
【0085】
このように、ある一つの処理をまとめた時間で行わせることによって、処理から処理へ移るためのオーバーヘッドを軽減させることができるようになる。
【0086】
また、処理自体を細かく分けることにより、処理ルーチンを小さく作り、それをループ処理することによって、当該処理ルーチンがCPU上のキャッシュメモリにのりやすくなり、高速に処理される可能性が高くなるものである。
【0087】
さらに、処理毎に優先度をつけて、重要な処理は他の処理に妨げられることなく、途切れることの無く処理を行うようにしている。具体的には、出力タスクの優先度が最も高く、次に音源タスクの優先度が高く、制御タスクの優先度が最も低くなされており、出力タスクが他の処理に妨げられることが無いようにしている。このため、出力タスクにより発音中の楽音が、他の処理により途切れることはない。
【0088】
さらに、本発明による楽音処理方法においては、発音しないボイスの処理を行わないようにした。
【0089】
これによって、発音数が少ない場合はCPU12の処理を軽減できる。即ち、プロセッサ資源を他のプログラムに解放することができるようになる。
【0090】
さらに、本発明による楽音処理方法においては、音源タスクとそれを制御する制御タスクとの通信をメモリ空間を共有することで実現するようにしている。
【0091】
即ち、図6に示すように、音源タスクと制御タスクとが共有するメモリ空間は2面(図6におけるメモリ空間Aおよびメモリ空間B)設けられていて、それらを交互に用いるようになされている。
【0092】
具体的には、制御タスク側は発音に必要なパラメータをメモリ空間Aの発音パラメータエリアに用意し、発音パラメータが用意できた旨をフラグを立てることによって音源タスク側に知らせる。そして、音源タスク側においては、メモリ空間Aの発音パラメータエリアを取り込むと、もう一面(メモリ空間B)の発音パラメータエリアを制御タスク側に渡す。制御タスク側は、新たに同じボイスで発音する場合には、新しく渡されたメモリ空間Bの発音パラメータエリアに対してパラメータを用意する。
【0093】
これによって、音源タスク側が発音中で発音パラメータを使用していても、制御タスク側はそれを気にすることなく新しい発音パラメータを設定することができる。
【0094】
なお、2面のメモリ空間の管理方法として1つのポインタのみを設けるようにした場合には、制御タスクはこのポインタの指し示す片方のメモリ空間に新たなパラメータを記憶するとともに、音源タスクは他方のメモリ空間に記憶されたパラメータを参照する。あるいは、制御タスクがパラメータを書き込むメモリ空間を指し示すポインタと、音源タスクがパラメータを参照するメモリ空間を指し示すポインタとを別々に設けるようにした場合には、これらのポインタの指し示すメモリ空間を互いに逆とすればよい。
【0095】
また、本発明による楽音処理方法においては、CPU12の負荷の具合をみて、発音可能ボイス数およびエフェクトの有無またはサンプリング周波数を決定するようにしてもよい。これにより、CPU12の能力に応じた楽音生成処理のための構成を構築できる。
【0096】
即ち、本発明の楽音生成処理方法によるプログラムの起動時や、あるいは本発明の楽音生成処理方法によるプログラムを実行している間の使用者により指定される任意のタイミングで、適当な波形を所定のボイス数発音してみて、音源タスクのCPU消費率を計測することによって、発音可能ボイス数およびエフェクトの有無またはサンプリング周波数を決定する。
【0097】
なお、音源タスクのCPU消費率の計測には、内部タイマを用いればよい。この内部タイマは、ハードウェアタイマからの割り込みによって、定期的(例えば、1ms毎)にインクリメントされるだけのカウンタである。
【0098】
音源タスクでは、タスクの開始時と終了時に、即ち、発音処理の前と発音処理の終了時に内部タイマの値を読み出してその差を求めることによって、音源タスクによる発音処理に消費された時間を算出できる。ここで、音源タスクは10ms毎に呼ばれるので、そのうちどれくらいの時間を音源タスクの処理が消費しているかが、音源タスクのCPU消費率となる。
【0099】
音源タスクのCPU消費率をどのくらい許すか予め決めておいたり、あるいはユーザーが任意に設定できるようにしておく。実際に計測されたCPU消費率と許容されるCPU消費率との比較結果に応じて、発音可能ボイス数およびエフェクトの有無またはサンプリング周波数を決定することになる。
【0100】
即ち、実際のCPU消費率が許容されるCPU消費率よりも大きかったら、例えば、発音可能ボイス数を計測時の所定数よりも減らし、実際のCPU消費率が許容されるCPU消費率と同じになるようにボイス数を調整する。実際のCPU消費率が許容されるCPU消費率よりも小さい場合は、例えば、発音可能ボイス数を計測時の所定数よりも増やし、実際のCPU消費率が許容されるCPU消費率と同じになるようにボイス数を調整する。
【0101】
ここで、発音可能ボイス数、エフェクトの有無、サンプリング周波数を変更することにより、CPU消費率がどの程度変化するかは予め求めることができるので、実際のCPU消費率と許容されるCPU消費率とから、これらの発音態様を一度に決めることも可能であるが、発音態様を変化させながら発音を繰り返し、実際のCPU消費率と許容されるCPU消費率とが一致するようにすることも可能である。
【0102】
また、このとき、サウンドの質(サンプリング周波数やエフェクトの有無)に重点をおくのか、ボイス数に重点をおくのかを、使用者が選択可能とすることができる。この場合には、重点をおいた項目に関しては固定とし、重点がおかれない項目に関してCPU消費率に応じて変更したり、あるいは、重点をおいた項目に関してはとりあえず固定とし、重点がおかれない項目をCPU消費率に応じて許容できる範囲内で変更してみて、それでも実際のCPU消費率が許容できるCPU消費率を越える場合には、重点をおいた項目に関しても変更するようにすることができる。
【0103】
また、実際に計測されたCPU消費率をディスプレイに表示し、使用者に知らせるようにしてもよい。
【0104】
なお、可能ボイス数の変更の処理は、以下のようにして行えばよい。即ち、制御タスクにおいて、各ボイス毎にそのボイスの使用を許可するか許可しないかを示す許可情報を管理するようにする。そして、制御タスクは、MIDI情報としてノートオンを受け取り、そのノートオンをアサインするボイスを選択するときに、許可情報を参照して使用が許可されているボイスのなかから選択するようにする。
【0105】
このため、全てのボイスの使用が許可されていれば、最大の発音数となる。発音可能なボイス数を減らす場合には、許可情報を書き換え、使用するボイス数を減らすようにする。
【0106】
従って、使用が許可されていないボイスは発音せず、音源タスクでは発音していないボイスに関しては処理が行われないので、発音可能なボイス数を減らすことにより、CPU消費率を下げることができる。
【0107】
このように、アサイン処理を行う制御タスクにおいて、ボイスの使用を許可するか許可しないかを示す許可情報を管理するようにし、この許可情報を書き換えるだけという簡単な処理で、発音可能ボイス数を調整することができる。
【0108】
また、サンプリング周波数は、出力デバイス(図1のコンピュータにおけるサウンドカード)のオーディオデータの出力周期と、音源タスクの1回の処理時の処理サンプル数を調整することによって変化することができる。
【0109】
さらに、エフェクト付加の有無は、音源処理の図5のステップS516の処理を行うかあるいは行わないかを、切り換えにより選択できるようにすることにより実現できる。
【0110】
また、上記したように、本発明の楽音生成処理方法によるプログラムの起動時や、あるいは本発明の楽音生成処理方法によるプログラムを実行している間の使用者により指定される任意のタイミングで、適当な波形を所定のボイス数発音してみて、音源タスクのCPU消費率を計測することによって、発音可能ボイス数およびエフェクトの有無またはサンプリング周波数を決定するようにした場合には、本発明の楽音生成処理方法によるプログラムの動作時にはそれに見合った処理負荷量(ボイス数、サンプリング周波数、エフェクトの有無)で動き続ける。即ち、処理負荷量は、再度設定されるまで変更されずに一定である。
【0111】
ところが、実際にコンピュータを使用する場合には、本発明の楽音生成処理方法によるプログラム以外の他のプログラムが同時に並行して動かされることがある。この場合には、各プログラムは各タイムスロットに割り当てられ、タイムシェアリングで処理されることになるので、本発明の楽音生成処理方法によるプログラムの各タスクの実行中に、他のプログラムが割り込んで実行されることがある。
【0112】
例えば、音源タスクの1回にかかる処理時間が、他のプログラムの動作状態によって変動することとなる。従って、上記したように、本発明の楽音生成処理方法によるプログラムの処理負荷量を一定とすると、他のプログラムによるCPUの処理負荷量の変動には追従できなくなってしまう。このため、場合によっては音源タスクの処理が間に合わずに音声が途切れたり、CPU12の処理能力に余裕ができてもそれをうまく活かすことができなくなってしまう。
【0113】
こうした欠点を解消するためには、常に音源タスクのCPU消費率を監視して、使用者の設定した音源タスクのCPU消費率に追従するようにダイナミックに発音可能ボイス数の増減を行うようにすればよい。
【0114】
具体的には、音源タスクが起動される度に、音源タスクの開始時と終了時との内部タイマの値の差からCPU消費率を計測し、これに応じてその都度発音可能ボイス数およびエフェクトの有無またはサンプリング周波数を決定する。
【0115】
なお、このようにダイナミックに発音可能ボイス数の増減を行う場合には、発音中に発音可能なボイス数が変動することになるが、この場合には次に示すような処理を行う。
【0116】
即ち、ボイス数を減らす場合には、現在使用が許可されているボイスの中で発音していないボイスがあれば、減らす分のボイスの許可情報を使用不許可にする。もし、現在使用が許可されているボイスの中で発音していないボイスがなかったり、あるいは発音していないボイスを全て使用不許可としても、まだボイス数を減らす必要がある場合には、発音しているボイスの中から減らす分だけのボイスを選択し、このボイスを急速にミュートし、以後の使用を不許可とする。なお、ボイスを選択するには、発音中のレベルが小さいボイス、最も過去に発音開始されたボイスなど、アサイン処理と同様の選択基準で選択することができる。
【0117】
あるいは、上記とは別の方法とし、発音しているボイスを急速にミュートする代わりに、そのボイスがノートオフによって自動的に消音されるのを待って、使用不許可とするようにしてもよい。
【0118】
一方、ボイス数を増やす場合には、使用が許可されていないボイスの中から増やす分だけのボイスを使用許可するようにすればよい。
【0119】
【発明の効果】
以上において説明したように、本発明による楽音生成処理方法は、汎用のコンピュータ上で楽音をリアルタイムで生成する際に、汎用のコンピュータに適した処理を行うように構成したので、従来より指摘されていた種々の問題点の解決を図ることができるとともに、汎用のコンピュータ上で楽音をリアルタイムで効率的に生成することができるという優れた効果を奏する。
【図面の簡単な説明】
【図1】本発明の楽音生成処理方法によるプログラムを搭載可能な、典型的な汎用のコンピュータのハードウェア構成を示すブロック図である。
【図2】本発明の楽音生成処理方法によるプログラムの全体構成を示す概念図である。
【図3】音源タスクにおける処理を示す概念図であり、(a)は1ボイス分の処理を示し、(b)はボイスおよびエフェクトのミキシングを示す。
【図4】音源タスクにおける発音サービスパラメータの生成の処理を示すフローチャートである。
【図5】音源タスクにおける発音サービスパラメータを受けて行われる波形読み出し、TVF、TVA、パンおよびエフェクトへの送り量の処理を示すフローチャートである。
【図6】音源タスクと制御タスクとが共有するメモリ空間が2面設けられていて、それを交互に使用する状態を示した説明図である。
【符号の説明】
10 バス
12 CPU
14 メモリ
16 ディスクコントローラ
18 ビデオカード
20 I/Oカード
22 サウンドカード
24 ハードディスク
26 ディスプレイ装置
28 キーボード
30 マウス
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a musical tone generation processing method, and more particularly to a musical tone generation processing method for constructing a synthesizer by software on a general-purpose computer such as a personal computer or a workstation.
[0002]
BACKGROUND OF THE INVENTION AND PROBLEMS TO BE SOLVED
Conventionally, in order to generate a musical sound, it has been necessary to use dedicated hardware for generating a musical sound, a so-called electronic musical instrument.
[0003]
However, in recent years, general-purpose computers have been equipped with high-performance CPUs and D / A converters (digital-analog converters) for outputting data processed by the CPU as analog signals to the outside. Accordingly, the possibility that musical sounds can be generated in real time on a general-purpose computer without using dedicated hardware has been studied.
[0004]
Specifically, since the musical sound data must be output to the D / A converter accurately at every sampling period, it is considered to perform processing for generating musical sound data at every sampling period according to a timer. Yes.
[0005]
In order to realize this processing, it is conceivable to perform processing for generating musical tone data in the interrupt routine according to the timer interrupt generated at each sampling period, but the processing for generating musical tone data is complicated. It has been pointed out that it is difficult to perform such complicated processing in the interrupt routine.
[0006]
Alternatively, in order to realize the above-described processing, it is conceivable to perform processing for generating musical tone data by a task activated at each sampling cycle, but according to this, the task is performed at a complicated timing at every sampling cycle. It is necessary to perform the process of switching the task, and the overhead for task switching increases, and the time that the CPU can actually process is shortened.
[0007]
By the way, in general, it is possible to use one software on various general-purpose computers. However, the capabilities of the CPUs mounted on these various general-purpose computers vary widely, and are adjusted to match those of low-performance CPUs. When software is created, there is a problem that a computer equipped with a high-capacity CPU cannot fully use the CPU power.
[0008]
In general-purpose computers, a method of using a plurality of software programs at the same time is generally performed. However, when processing other than the processing for generating a musical tone is performed simultaneously with the processing for generating a musical tone, The load on the CPU changes every moment according to the processing status of other processes. For this reason, when software is created in accordance with the heaviest CPU load, there is a problem in that the CPU capacity cannot be fully used when the load is light.
[0009]
Furthermore, generally, at least a part of the process of generating a musical tone by the CPU is repeatedly performed at regular time intervals. However, an instruction indicating note-on (sounding start) / note-off (sounding end) is given by the user. This repeat interval occurs asynchronously according to the (user) desired timing. That is, data is transferred to a process for generating a musical tone in accordance with an instruction indicating note-on / note-off, and a process for generating a musical tone based on the transferred data in the process of generating a musical sound that has received the data. However, since the instruction indicating note-on / note-off is asynchronous with the repetition interval, the instruction indicating note-on / note-off is performed during the process of generating a musical tone. There is a problem that noise is generated in the musical tone being generated if the processing is performed to rewrite the data or generate the musical tone while rewriting the data according to the instruction indicating note on / note off. The need to improve the data transfer method was pointed out.
[0010]
The present invention has been made in view of the various problems as described above, and the object of the present invention is to solve the various problems described above by performing processing suitable for a general-purpose computer. An object of the present invention is to provide a musical sound generation processing method capable of efficiently generating musical sounds in real time on a general-purpose computer.
[0011]
[Means for Solving the Problems]
In order to achieve the above object, a musical sound generation processing method according to the present invention generates a musical sound in a predetermined manner set in advance among a plurality of musical sound generation modes, and has a predetermined time longer than the sampling period. Each time, the musical sound data generation process for generating the musical sound data at a plurality of sampling points included in the predetermined time at a time, and performing the processing of ordering and storing the data is stored. Musical tone data output processing for performing processing for sequentially reading out and outputting the musical tone data at each sampling time according to the temporal ordering for each sampling period, and processing for detecting the load amount for the musical tone data generation processing by measurement In accordance with the load amount detected by the detection process, the tone generation mode in the tone data generation process is set. It is obtained to perform a process of changing the.
[0015]
Here, the process of changing the setting of the tone generation mode changes the setting of the tone generation mode based on the allowable load amount of the tone data generation process and the load amount detected by the detection process. Can be.
[0016]
Furthermore, the musical sound generation processing method according to the present invention generates a musical sound in a predetermined manner among a plurality of musical sound generation modes, and includes a plurality of musical sounds included in the predetermined time every predetermined time longer than a sampling period. The musical tone data at the sampling time are collectively generated at once, the musical data generation processing for performing the processing of ordering and storing the musical data at the same time, and the musical tone data at each sampling time stored by the musical tone data generation processing, A musical sound data output process for performing a process of sequentially reading and outputting in accordance with the temporal ordering for each sampling period, a process for automatically detecting the load amount applied to the musical sound data generation process by measurement, and a process for detecting the above In accordance with the load detected by the above, the setting of the tone generation mode in the tone data generation process is automatically performed every moment. It is obtained to perform the processing for reduction.
[0017]
Here, the detecting process measures the time spent in the musical sound data generation process, and detects the load amount based on the measured time and the execution time interval of the musical sound data generation process. be able to.
[0018]
The musical sound generation mode determined by the process of determining the musical sound generation mode may be at least one of the number of simultaneous musical sound generations, the effect applying mode of the effect applying unit, or the sampling frequency. it can.
[0019]
In addition, the tone generation mode determined by the process for determining the tone generation mode is at least any one of the number of simultaneous sounds of the tone, the effect applying mode of the effect applying means, or the sampling frequency. The process of determining the musical sound generation mode by prioritizing any one of the musical sound generation modes according to an instruction is determined based on the load amount detected by the detection process. It can be.
[0023]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of a musical sound generation processing method of the present invention will be described in detail with reference to the accompanying drawings.
[0024]
FIG. 1 is a block diagram showing a hardware configuration of a typical general-purpose computer on which a program according to the musical sound generation processing method of the present invention can be installed.
[0025]
The general-purpose computer shown in FIG. 1 has a very general configuration, and via a bus 10, a CPU 12, a memory 14, a disk controller 16, a video card 18, an I / O card 20, A sound card 22 is connected, a hard disk 24 is connected to the disk controller 16, a display device 26 is connected to the video card 18, and a keyboard 28 and a mouse 30 are connected to the I / O card 20. ing. In this computer, a musical sound signal is output from the sound card 22.
[0026]
In this general-purpose computer, in addition to the program according to the musical tone generation processing method of the present invention, a sequencer (automatic performance) program is simultaneously started, and the MIDI information is transferred from the sequencer program to the program according to the musical tone generation processing method of the present invention. In the program according to the musical tone generation processing method of the present invention, a musical tone signal is generated and output according to the delivered MIDI information.
[0027]
FIG. 2 shows the overall configuration of a program according to the musical sound generation processing method of the present invention, which is composed of a control task, a sound source task, and an output task.
[0028]
In other words, the control task executes the control program, exchanges MIDI information with the sequencer program, and passes the event flag, sound generation parameter, steady processing parameter, and effect parameter to the sound source task side, and the voice task from the sound source task side. Receive release information.
[0029]
The tone generator task performs processing relating to a plurality of voices (musical tone generation channels) and effects, stores the musical tone signal generated in the wave buffer, and delivers it to the output task. In other words, each of the multiple voices is processed, the output of each voice is transferred to the effect according to the effect feed amount of the sound generation parameter, which will be described later, and the output of each voice to which no effect is added and each voice to which the effect is added Are finally mixed and stored in the wave buffer and delivered to the output task.
[0030]
In the output task, wave output processing is performed using a wave buffer, and a musical sound signal is output to the outside. Then, the wave buffer used in the output task is returned to the sound source task side.
[0031]
As described above, information exchanged between the control task and the sound source task includes an event flag, a sound generation parameter, a steady process parameter, an effect parameter, and voice release information. Hereinafter, such information will be described.
[0032]
(1) Event flag
There are as many event flags as the number of voices, and the tone generator task receives information (flags) of the start and end of each voice by the event flag from the control task. The event flag is stored in a shared memory accessible from both the control task and the sound source task.
[0033]
(2) Pronunciation parameters
As will be described later, each time the sound source task is activated, the contents of the event flag are searched, and when the sound generation start flag is found, the sound generation starts according to the sound generation parameter. The sound generation parameter includes the following (a) for each voice: To (i).
(A) Parameters related to waveform readout
(Waveform start address, loop related address, pitch)
(B) Pitch LFO related parameters
(Waveform, period, delay, etc.)
(C) Filter LFO related parameters
(Waveform, period, delay, etc.)
(D) Amplifier LFO related parameters
(Waveform, period, delay, etc.)
(E) Pitch envelope parameters
(Attack, decay, sustain, release time and level)
(F) TVF (Time Variable Filter) Envelope-related parameters
(Attack, decay, sustain, release time and level)
(G) TVA (Time Variable Amplifier) envelope-related parameters
(Attack, decay, sustain, release time and level)
(H) Bread
(I) Effect feed amount
The sound generation parameters including these pieces of information are stored in a shared memory accessible from both the control task and the sound source task. Two memory spaces for storing the sound generation parameters are provided for each voice. In other words, when the tone generator task finds the sound start flag in the event flag, the tone generator task switches the memory space referenced by the tone generator task from the previously referenced plane to the other plane and refers to it until now. Pass the face that was left to the control task. Therefore, even when the sound parameters for the same voice number are set, the control task uses the new memory space on the other side that is different from the currently processed surface that is passed from the sound source task, so that the sound source task references The sound generation parameters can be transferred to the sound source task without destroying the parameter area of the currently processed surface. Conversely, it is possible to prevent the sound source task from referring to the parameter area being rewritten on the control task side.
[0034]
(3) Steady processing parameters
The steady process parameters include information shown in the following (a) to (c) for each voice.
(A) Pitch offset
(B) Filter offset
(C) Amplifier offset
These steady processing parameters are stored in a shared memory accessible from both the control task and the sound source task, and serve to service information obtained from an operator such as a pitch bender or a wheel.
[0035]
These steady process parameters are read each time the sound source task is activated, and are synthesized with an envelope or LFO generated inside the sound source task during sound generation. The synthesized data is used as a sound service parameter. Called.
[0036]
The sound generation service parameter controls the waveform readout pitch, the TVF cutoff frequency, and the TVA amplitude.
[0037]
(4) Effect parameters
The effect parameter is information for effect control stored in a shared memory accessible from both the control task and the sound source task, and is passed to the effect. This effect parameter is read every time the sound source task is activated, and if there is a parameter different from the previously read content, it is reflected in the effect.
[0038]
The effect parameters are different depending on the specific contents of the effect, and the specific contents of the effect are not included in the gist of the present invention, and thus detailed description thereof is omitted.
[0039]
(5) Voice release information
The voice release information is returned from the sound source task to the control task, and indicates the number of the voice that has been sounded. Note that the end of pronunciation of each voice is determined by the envelope of TVA. This voice release information does not use the memory space but is passed to the control task by an event.
[0040]
Here, the event flag, sound generation parameter, steady processing parameter, and effect parameter are exchanged using a shared memory, while the voice release information is delivered by event, the difference in the communication method between tasks is that the sound source task This is because asynchronous event information cannot be received from the control task side.
By the way, the above-described control task, sound source task, and output task are provided with a priority (priority: priority), and a task whose processing is not preferably interrupted by another task or the like should have a higher priority. Has been made. In this embodiment, the output task has the highest priority, the sound source task has the next highest priority, and the control task has the lowest priority.
[0041]
Hereinafter, the control task, the sound source task, and the output task will be described in detail with reference to FIGS.
[0042]
(1) Control task
The control task obtains MIDI information and controls the sound source task, and is activated by receiving MIDI information from the sequencer program and voice release information from the sound source task.
[0043]
Here, for each voice, the control task always manages voice information indicating whether the voice is sounding or vacant. When note-on is received as MIDI information, the voice information is referred to as appropriate. To specify a free voice and use that voice to sound the note-on, set the sound parameters necessary for the note-on for that voice and then set the event flag to start sounding. The voice information of the designated voice is updated. Then, in the sound source task, a new pronunciation is started with the designated voice in accordance with the processing of the control task described above.
[0044]
Also, when the control task receives note-on as MIDI information, if there is no free voice by referring to the voice information, the control task selects a voice with a low sounding level or starts the sounding most recently. Select a voice that seems unnecessary according to a predetermined selection criterion such as selecting a voice, and use the voice to sound the note-on. Is set, and thereafter, the event flag is set to start sounding. In the sound source task, the current pronunciation of the quickly selected voice is muted in accordance with the processing of the control task described above, and then a new pronunciation is started by the selected voice.
[0045]
As described above, in the control task, when note-on is received as MIDI information, voice assignment, so-called assignment processing, is performed.
[0046]
On the other hand, when the control task receives note-off as MIDI information, the control task performs a process of setting the end of sounding in the event flag so as to end sounding for the sounding sound corresponding to the note-off. In the sound source task, the sounding voice corresponding to the note-off is muted in accordance with the processing of the control task described above.
[0047]
As will be described later, the processing of voices in the sound source task is not performed for voices that are not sounded. Therefore, the calculation amount of the sound source task increases / decreases according to the number of voiced voices. Therefore, in the present invention, the maximum number of pronunciations that can be generated can be set in advance according to the ability of the computer and can be changed as appropriate.
[0048]
Further, when the control task receives a message for changing the value of the steady process parameter and the effect parameter as MIDI information, the control task performs a process of delivering the corresponding steady process parameter and the effect parameter to the sound source task.
[0049]
Further, when the voice release information is transferred from the sound source task to the control task, the control task updates the voice information of the designated voice according to the received voice release information.
[0050]
(2) Sound source task
The sound source task is started by a timer every 10 ms (milliseconds), and waveform reading for 10 ms, TVF, TVA, pan, envelope, LFO, and effect processing are performed in as short a time as possible. As described above, since the sound source task performs processing for 10 ms, if the sampling frequency is 32 KHz, processing for 320 samples is performed.
[0051]
Each time the sound source task is activated, the contents of the event flag are searched, and when the sound generation start flag is found, sound generation starts according to the sound generation parameter. At this time, two memory spaces for storing the sound generation parameters are provided for each voice, and when the sound source task finds the sound generation start flag in the event flag, the sound source task is a memory to which the sound source task refers thereafter. The space is switched from the previously referenced plane to another plane, and the previously referenced plane is passed to the control task. Therefore, even when the sound parameters for the same voice number are set, the control task uses the new memory space on the other side that is different from the currently processed surface that is passed from the sound source task, so that the sound source task references The sound generation parameters can be transferred to the sound source task without destroying the parameter area of the currently processed surface.
[0052]
Here, the processing in each voice will be described. In the sound source task, the sound generation parameter and the steady processing parameter stored in the shared memory are fetched every time the sound source task is activated, and the calculation of the envelope and LFO and the steady state parameter are performed. The processing parameter is reflected to perform a calculation for generating the pronunciation service parameter. The sound generation service parameters thus generated control the waveform readout pitch, the TVF cutoff frequency, and the TVA amplitude (amplification degree), and deliver the voice output to the effect according to the effect feed amount of the sound generation parameter. The output of the voice to which no effect is added is output in stereo with the panpot controlled by the sound parameter pan (FIG. 3 (a)).
[0053]
Then, the output of each voice to which the effect controlled by the effect parameter is added and the output of each voice to which the effect is not added are mixed and output in stereo (FIG. 3B), and finally the wave buffer. Is stored and transferred to the output task.
[0054]
FIG. 4 shows a flowchart showing the process of generating the sound generation service parameter, and the process is sequentially performed for each voice from the first voice.
[0055]
First, it is checked whether the event flag indicates the start of sound generation (step S402). If the event flag does not indicate the start of sound generation, it is checked whether the event flag indicates the end of sound generation (step S404).
[0056]
If the event flag does not indicate the end of sound generation in step S404, it is checked whether “1” is set in voiceActive, which is a flag indicating sound generation, to indicate that sound generation is in progress (step S406). .
[0057]
On the other hand, if the event flag indicates the end of sound generation in step S404, the envelope is advanced to the release process (step S408), and the calculated value n1 of the sound service parameter in the previous process is set to n0 ( After step S410), calculation reflecting the envelope, LFO and steady process parameters is performed to generate a sound generation service parameter and set it to the calculated value n1 (step S412). That is, the envelope service and LFO values are changed in accordance with the passage of time of 10 ms from the previous process, and the new envelope, LFO and steady process parameters are synthesized (added or multiplied) to generate the sound generation service parameter. Note that the sound generation service parameter is calculated independently for each of the waveform readout pitch, TVF, and TVA.
[0058]
Even if “1” is set in voiceActive in step S406 and sounding is in progress, the calculated value n1 of the sounding service parameter in the previous processing is set to n0 (step S410), and then the envelope, LFO Then, a calculation reflecting the steady process parameters is performed to generate a sound generation service parameter and set it to the calculated value n1 (step S412). Note that the sound generation service parameter is calculated independently for each of the waveform readout pitch, TVF, and TVA.
By the way, when the event flag indicates that the sound generation is started in step S402, the pointer indicating the sound generation parameter area used by the control task and the sound source task is updated to indicate the other sound generation parameter area (step S414), and voiceActive. It is checked whether or not “1” is set to indicate that sound is being generated (step S416).
[0059]
If voiceActive is set to “1” in step S416 and sound is being generated, the currently sounding voice is rapidly muted (step S418), and the envelope, LFO, and steady processing parameters are reflected. Calculation is performed to generate a sound generation service parameter at the start of sound generation and set it to the calculated value n0 (step S420). Note that the sound generation service parameter is calculated independently for each of the waveform readout pitch, TVF, and TVA.
[0060]
On the other hand, if “1” is not set in voiceActive in step S416 and sounding is not being performed, the process proceeds to step S420 as it is, and the sounding service at the start of sounding is performed by performing an operation reflecting the envelope, LFO and steady processing parameters. A parameter is generated and set to the calculated value n0.
[0061]
As described above, in step S420, calculation that reflects the envelope, LFO, and steady process parameters is performed to generate a sound generation service parameter at the start of sound generation, set it to the calculated value n0, and then set “1” to voiceActive. To indicate that the sound is being generated (step S422), and by performing calculation reflecting the envelope, LFO and steady process parameters according to the passage of time of 10 ms from the start of sound generation, a sound generation service parameter is generated and a calculated value n1 (Step S412). Note that the sound generation service parameter is calculated independently for each of the waveform readout pitch, TVF, and TVA.
[0062]
Then, in step S412, when the calculation that reflects the envelope, LFO, and steady process parameters is performed and the sound generation service parameter is generated and set to the calculated value n1, the current sound generation is used for performing interpolation processing as necessary. A difference d between the calculated value n1 of the service parameter and the calculated value n0 of the previous sound service parameter is obtained (step S424), and it is checked whether the envelope of the TVA has reached the end (step S426).
[0063]
If the TVA envelope has not reached the end in step S426, the event flag is cleared as it is (step S428). If the TVA envelope has reached the end in step S426, the voice release information is sent to the control task. Return (step S430), set "0" in voiceActive to indicate that no sound is being generated (step S432), and then clear the event flag (step S428).
[0064]
On the other hand, if “1” is not set in voiceActive in step S406 and no sound is being generated, the event flag is cleared as it is (step S428).
[0065]
When the event flag is cleared (step S428), it is checked whether all voices have been processed (step S434). If the processing of all voices is completed as a result of the check in step S434, the processing of this flowchart is terminated. If the processing of all voices is not completed as a result of the check in step S434, the processing returns to step S402 and the subsequent processing is performed. Repeat to process the next voice. That is, the processing of this flowchart is repeated until processing of all voices is completed.
[0066]
Note that the waveform readout, TVF, TVA, pan, and effect feed processing performed in response to the sound generation service parameters are performed for 10 ms each time the sound source task is activated, and then the effect The processing is performed collectively for 10 ms, and a flowchart of this processing is shown in FIG.
That is, in the flowchart of FIG. 5, processing is performed sequentially for each voice from the first voice.
[0067]
First, it is checked whether “1” is set in voiceActive to indicate that sounding is being performed (step S502). If “0” is set in voiceActive in step S502 and sounding is not being performed, Then, the process jumps to step S514 to check whether all voices have been processed, and proceeds to the next voice process. That is, in this flowchart, the processing of voices that are not pronounced is not performed.
[0068]
On the other hand, if “1” is set in voiceActive in step S502 and sound is being generated, the waveform is read so that the sound is generated at the pitch indicated by the sound generation service parameter (step S504). Here, the tone generation service parameters are linearly interpolated to the required accuracy using the difference d obtained in step S424 in the flowchart shown in FIG. That is, assuming that the sampling frequency is 32 kHz, using the tone generation service parameter set to the calculated value n0 obtained in step S410 or step S420 of the flowchart shown in FIG. 4 and the difference d obtained in step S424,
n0 + d × k / 320
To obtain an interpolated value. Note that 320 is the number of samples corresponding to 10 ms when the sampling frequency is 32 KHz, k indicates what number of the 320 samples, and is “0” in the first process, and “ These values are 1 ',' 2 ',.
[0069]
Next, the waveform readout output in step S504 is filtered by the TVF (step S506). Here, the cutoff frequency of the TVF is controlled by the sound generation service parameter, and the sound generation service parameter is linearly interpolated to the required accuracy using the difference d obtained in step S424 of the flowchart shown in FIG.
[0070]
Further, the amplitude of the filtered output in step S506 is controlled by the TVA according to the sound generation service parameter (step S508). Here, the sound generation service parameter is used by linearly interpolating to the required accuracy using the difference d obtained in step S424 of the flowchart shown in FIG.
[0071]
Next, the amount of feed to the pan and the effect is controlled by the sound generation parameter, and addition and mixing processing with the tone signal of the other voice shown in FIG. 3B is performed (step S510). Is checked (step S512), and if the process for 10 ms has not been completed, the process returns to step S504 to perform the processes after step S504 on the next sample. That is, the processing from step S504 to step S510 is processing for each sample, and processing for the number of samples for 10 ms is performed.
[0072]
On the other hand, if the processing for 10 ms has been completed, it is checked whether the processing of all voices has been completed (step S514). If the processing of all voices is completed by this check, the effect processing is performed for 10 ms (step S516), and the wave buffer storing the 10 ms musical signal for which the above processing has been performed is passed to the output task. (Step S518), the process of this flowchart is terminated. Here, the wave buffer storing the musical tone signal subjected to the above processing is transferred to the output task, and at the same time, a new wave buffer is received, and the new wave buffer is used for the next processing in steps S502 to S516.
[0073]
On the other hand, if the voice processing is not completed, the process returns to step S502 to repeat the subsequent processing to perform the next voice processing. That is, the processing of this flowchart is repeated until processing of all voices is completed.
[0074]
(3) Output task
The output task DMA-transfers the stored contents of the wave buffer received from the sound source task to an audio data output device (in the computer shown in FIG. 1, it is the sound card 22). This DMA transfer is started by an interrupt from the audio data output device.
[0075]
Here, an audio data output device such as the sound card 22 (hereinafter referred to as “output device”) has a built-in buffer for temporarily storing audio data to be output, and temporarily stores it at every sampling period. Audio data is output for each sampling. When the amount of audio data remaining in the built-in buffer falls below a predetermined amount, the output task is interrupted, and in response to this interrupt, the output task DMA-transfers audio data for a predetermined sample required by the output device to the output device. To do.
[0076]
The interruption to the output task described above usually takes a cycle of about 10 ms.
[0077]
That is, in the computer shown in FIG. 1, the output task is activated when an interrupt from the sound card 22 and a wave buffer from the sound source task are received.
[0078]
When the output task receives a wave buffer for 10 ms from the sound source task, the output task returns a free wave buffer to the sound source task. There are four or more wave buffers, and one is always rotated so that one output task outputs to the output device, one is used by the sound source task for processing, and the rest is free.
[0079]
As described above, in the musical sound processing method according to the present invention, the envelope and LFO calculations are performed periodically in units of time longer than the sampling frequency, and the desired accuracy is obtained when using the calculation results. The calculation result is interpolated.
[0080]
As a result, complicated condition determination is required for the calculation, and it becomes possible to reduce the calculation of envelopes and LFOs having a relatively large number of calculation steps.
[0081]
Specifically, in the above-described processing, the calculation reflecting the information given by the envelope, LFO, manipulator and the like is performed only once during the processing of the sound source task. That is, if the sound source task is started once every 10 ms, these calculations are performed only once every 10 ms. Then, at places where such calculation results are used (waveform readout pitch, TVF, TVA, etc.), the calculation results are interpolated and used as necessary.
[0082]
In addition, since interpolation is performed on the synthesized value after combining the information given by the envelope, LFO, operator, etc., compared to the case where interpolation is performed for each information such as envelope, LFO, operator, etc. The processing amount is reduced.
[0083]
Also, in the musical sound processing method according to the present invention, the respective operations such as waveform readout, interpolation, envelope, and effect are not processed at sampling frequency intervals, but are processed in a long time span for each processing. ing.
[0084]
Specifically, the waveform is read every 10 ms and processed for 10 ms collectively. At this time, the processing is completed in as short a time as possible so as not to affect other processing.
[0085]
In this way, by performing a certain process in a combined time, the overhead for shifting from process to process can be reduced.
[0086]
Also, by dividing the processing itself into small pieces, making the processing routine small and looping it makes it easier to load the processing routine into the cache memory on the CPU and increases the possibility of being processed at high speed. is there.
[0087]
Furthermore, priorities are assigned to each process so that important processes are not interrupted by other processes and are performed without interruption. Specifically, the output task has the highest priority, the sound source task has the highest priority, and the control task has the lowest priority so that the output task is not hindered by other processes. ing. For this reason, the musical sound that is being generated by the output task is not interrupted by other processes.
[0088]
Furthermore, in the musical tone processing method according to the present invention, processing of voices that do not sound is not performed.
[0089]
Thereby, when the number of pronunciations is small, the processing of the CPU 12 can be reduced. That is, the processor resource can be released to another program.
[0090]
Furthermore, in the musical sound processing method according to the present invention, communication between the tone generator task and the control task for controlling it is realized by sharing the memory space.
[0091]
That is, as shown in FIG. 6, two memory spaces (memory space A and memory space B in FIG. 6) shared by the sound source task and the control task are provided, and they are used alternately. .
[0092]
Specifically, the control task side prepares parameters necessary for sound generation in the sound generation parameter area of the memory space A, and notifies the sound source task side by setting a flag that the sound generation parameters have been prepared. On the sound source task side, when the sound generation parameter area in the memory space A is captured, the sound generation parameter area on the other side (memory space B) is transferred to the control task side. The control task side prepares a parameter for the newly generated sound generation parameter area in the memory space B when the sound is newly generated with the same voice.
[0093]
As a result, even if the sound source task side is sounding and using the sound generation parameter, the control task side can set a new sound generation parameter without worrying about it.
[0094]
If only one pointer is provided as a management method for the two memory spaces, the control task stores a new parameter in one memory space pointed to by this pointer, and the tone generator task is stored in the other memory space. Refers to parameters stored in space. Alternatively, if a pointer indicating the memory space in which the control task writes the parameters and a pointer indicating the memory space in which the sound source task refers to the parameters are provided separately, the memory spaces indicated by these pointers are opposite to each other. do it.
[0095]
In the musical sound processing method according to the present invention, the number of soundable voices, the presence / absence of an effect, or the sampling frequency may be determined in consideration of the load of the CPU 12. Thereby, the structure for the musical sound production | generation process according to the capability of CPU12 can be constructed | assembled.
[0096]
In other words, an appropriate waveform is set to a predetermined waveform at an arbitrary timing designated by the user when the program is started by the musical tone generation processing method of the present invention or while the program is executed by the musical tone generation processing method of the present invention. The number of voices is pronounced, and the CPU consumption rate of the sound source task is measured to determine the number of voices that can be produced, the presence or absence of effects, or the sampling frequency.
[0097]
An internal timer may be used for measuring the CPU consumption rate of the sound source task. This internal timer is a counter that is only incremented periodically (for example, every 1 ms) by an interrupt from the hardware timer.
[0098]
In the sound source task, the time spent in the sound generation process by the sound source task is calculated by reading the internal timer value at the start and end of the task, that is, before the sound generation process and at the end of the sound generation process, and obtaining the difference between them. it can. Here, since the sound source task is called every 10 ms, the CPU consumption rate of the sound source task is how much time of the sound source task processing is consumed.
[0099]
It is determined in advance how much the CPU consumption rate of the sound source task is allowed, or the user can arbitrarily set it. The number of soundable voices, the presence / absence of an effect, or the sampling frequency is determined according to the comparison result between the actually measured CPU consumption rate and the allowable CPU consumption rate.
[0100]
That is, if the actual CPU consumption rate is larger than the permissible CPU consumption rate, for example, the number of soundable voices is reduced from the predetermined number at the time of measurement, and the actual CPU consumption rate is the same as the permissible CPU consumption rate. Adjust the number of voices so that When the actual CPU consumption rate is smaller than the allowable CPU consumption rate, for example, the number of soundable voices is increased from a predetermined number at the time of measurement, and the actual CPU consumption rate becomes the same as the allowable CPU consumption rate. Adjust the number of voices as follows.
[0101]
Here, it is possible to obtain in advance how much the CPU consumption rate will change by changing the number of voices that can be generated, the presence or absence of effects, and the sampling frequency, so the actual CPU consumption rate and the allowable CPU consumption rate Therefore, it is possible to determine these sound generation modes at once, but it is also possible to repeat the sound generation while changing the sound generation mode so that the actual CPU consumption rate matches the allowable CPU consumption rate. is there.
[0102]
At this time, the user can select whether to focus on the quality of the sound (sampling frequency or presence / absence of effects) or on the number of voices. In this case, the items with priority are fixed and the items that are not emphasized are changed according to the CPU consumption rate, or the items with priority are fixed for the time being and are not emphasized. If items are changed within the allowable range according to the CPU consumption rate, and the actual CPU consumption rate still exceeds the allowable CPU consumption rate, the items with priority may be changed. it can.
[0103]
Further, the CPU consumption rate actually measured may be displayed on the display to notify the user.
[0104]
The process for changing the number of possible voices may be performed as follows. That is, in the control task, permission information indicating whether or not to permit the use of each voice is managed for each voice. Then, the control task receives note-on as MIDI information, and when selecting a voice to which the note-on is assigned, the control task refers to the permission information and selects the voice permitted to be used.
[0105]
Therefore, if the use of all voices is permitted, the maximum number of pronunciations is obtained. When reducing the number of voices that can be generated, the permission information is rewritten to reduce the number of voices to be used.
[0106]
Accordingly, voices that are not permitted to be used are not sounded, and voices that are not sounded in the sound source task are not processed, so the CPU consumption rate can be reduced by reducing the number of voices that can be sounded.
[0107]
In this way, in the control task that performs the assignment process, the permission information indicating whether the use of the voice is permitted or not is managed, and the number of soundable voices is adjusted by a simple process of simply rewriting the permission information. can do.
[0108]
Also, the sampling frequency can be changed by adjusting the output period of audio data of the output device (sound card in the computer of FIG. 1) and the number of samples processed at the time of one processing of the sound source task.
[0109]
Further, whether or not an effect is added can be realized by selecting whether or not to perform the process of step S516 in FIG. 5 of the sound source process by switching.
[0110]
Further, as described above, at the time of starting the program by the musical tone generation processing method of the present invention or at any timing designated by the user while executing the program by the musical tone generation processing method of the present invention, If the number of voices that can be generated, the presence or absence of effects, or the sampling frequency is determined by measuring the CPU consumption rate of the sound source task by sounding a predetermined number of voices, the tone generation of the present invention When the program is operated according to the processing method, the program continues to operate with a processing load (number of voices, sampling frequency, presence / absence of effects) commensurate with it. That is, the processing load amount is constant without being changed until it is set again.
[0111]
However, when a computer is actually used, programs other than the program according to the musical tone generation processing method of the present invention may be simultaneously moved in parallel. In this case, since each program is assigned to each time slot and processed by time sharing, another program interrupts during execution of each task of the program according to the musical sound generation processing method of the present invention. May be executed.
[0112]
For example, the processing time for one sound source task varies depending on the operating state of other programs. Therefore, as described above, if the processing load amount of the program according to the musical tone generation processing method of the present invention is constant, it becomes impossible to follow the fluctuation of the CPU processing load amount due to other programs. For this reason, in some cases, the sound source task is not processed in time, and the sound is interrupted, or even if the CPU 12 has sufficient processing capacity, it cannot be used effectively.
[0113]
In order to eliminate these disadvantages, the CPU consumption rate of the sound source task is constantly monitored, and the number of voices that can be sounded is dynamically increased or decreased so as to follow the CPU consumption rate of the sound source task set by the user. That's fine.
[0114]
Specifically, each time the sound source task is activated, the CPU consumption rate is measured from the difference between the internal timer values at the start and end of the sound source task, and the number of voices that can be generated and the Determine the presence or absence or sampling frequency.
[0115]
When dynamically increasing or decreasing the number of voices that can be generated in this way, the number of voices that can be generated during sound generation varies. In this case, the following processing is performed.
[0116]
That is, when the number of voices is reduced, if there is a voice that is not pronounced among the voices that are currently permitted to be used, the permission information for the reduced voice is disabled. If there are no unsounded voices that are currently allowed to be used, or if all unsounded voices are not allowed to be used, but it is still necessary to reduce the number of voices, Select the number of voices to be reduced from the number of voices that are currently being used, rapidly mute this voice, and disallow further use. In order to select a voice, it is possible to select a voice based on the same selection criteria as in the assignment process, such as a voice with a low sounding level and a voice that has been sounded most recently.
[0117]
Alternatively, instead of rapidly muting the sounding voice, the voice may be automatically muted by note-off instead of being rapidly muted, and use may be prohibited. .
[0118]
On the other hand, when the number of voices is to be increased, it is only necessary to permit use of the voices that are increased from the voices that are not permitted to be used.
[0119]
【The invention's effect】
As described above, the musical sound generation processing method according to the present invention is configured to perform processing suitable for a general-purpose computer when generating musical sounds in real time on a general-purpose computer, and thus has been pointed out heretofore. In addition to solving various problems, the present invention has an excellent effect that musical sounds can be efficiently generated in real time on a general-purpose computer.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a hardware configuration of a typical general-purpose computer on which a program according to a musical sound generation processing method of the present invention can be installed.
FIG. 2 is a conceptual diagram showing an overall configuration of a program according to a musical sound generation processing method of the present invention.
FIGS. 3A and 3B are conceptual diagrams showing processing in a sound source task, where FIG. 3A shows processing for one voice, and FIG. 3B shows mixing of voices and effects.
FIG. 4 is a flowchart showing a sound generation service parameter generation process in a sound source task.
FIG. 5 is a flowchart showing processing of waveform readout, TVF, TVA, pan and feed amount to effects performed in response to a sound generation service parameter in a sound source task.
FIG. 6 is an explanatory diagram showing a state in which two memory spaces shared by a sound source task and a control task are provided and used alternately.
[Explanation of symbols]
10 buses
12 CPU
14 memory
16 disk controller
18 Video card
20 I / O card
22 Sound card
24 hard disk
26 Display device
28 keyboard
30 mice

Claims (6)

複数の楽音の生成態様のうちで予め設定された所定の態様で楽音を生成するようにするとともに、サンプリング周期よりも長い所定時間毎に、前記所定時間に含まれる複数のサンプリング時点の楽音のデータを一度にまとめて生成し、時間的な順序付けをして記憶する処理を行う楽音データ生成処理と、
前記楽音データ生成処理により記憶した各サンプリング時点の楽音のデータを、サンプリング周期毎に前記時間的な順序付けに従って順次読み出して出力する処理を行う楽音データ出力処理と、
前記楽音データ生成処理にかかる負荷量を計測によって検出する処理と、
前記検出する処理により検出された負荷量に応じて、前記楽音データ生成処理における楽音の生成態様の設定を変更する処理と
を行うことを特徴とする楽音生成処理方法。
The musical sound is generated in a predetermined manner set in advance among a plurality of musical sound generation manners, and the musical sound data at a plurality of sampling points included in the predetermined time for each predetermined time longer than the sampling period. Musical sound data generation processing that performs a process of generating a batch of data at once, storing them in a time-ordered manner, and
Musical tone data output processing for performing processing of sequentially reading out and outputting musical tone data at each sampling time stored by the musical tone data generation processing according to the temporal ordering for each sampling period;
A process of detecting a load amount for the musical sound data generation process by measurement;
A musical sound generation processing method comprising: performing a process of changing a setting of a musical sound generation mode in the musical sound data generation process in accordance with a load amount detected by the detection process.
前記楽音の生成態様の設定を変更する処理は、前記楽音データ生成処理の許容負荷量と前記検出する処理により検出された負荷量とに基づいて、楽音の生成態様の設定を変更する
ことを特徴とする請求項1記載の楽音生成処理方法。
The process of changing the setting of the tone generation mode changes the setting of the tone generation mode based on the allowable load amount of the tone data generation process and the load amount detected by the detection process. The musical tone generation processing method according to claim 1.
複数の楽音の生成態様のうちの所定の態様で楽音を生成するようにするとともに、サンプリング周期よりも長い所定時間毎に、前記所定時間に含まれる複数のサンプリング時点の楽音のデータを一度にまとめて生成し、時間的な順序付けをして記憶する処理を行う楽音データ生成処理と、
前記楽音データ生成処理により記憶した各サンプリング時点の楽音のデータを、サンプリング周期毎に前記時間的な順序付けに従って順次読み出して出力する処理を行う楽音データ出力処理と、
前記楽音データ生成処理にかかる負荷量を自動的に刻々と計測によって検出する処理と、
前記検出する処理により検出された負荷量に応じて、前記楽音データ生成処理における楽音の生成態様の設定を自動的に刻々と変化させる処理と
を行うことを特徴とする楽音生成処理方法。
A musical tone is generated in a predetermined manner among a plurality of musical tone generation modes, and musical tone data at a plurality of sampling points included in the predetermined time are collected at a time every predetermined time longer than the sampling period. Musical tone data generation processing that performs processing that generates and stores in a time-ordered manner,
Musical tone data output processing for performing processing of sequentially reading out and outputting musical tone data at each sampling time stored by the musical tone data generation processing according to the temporal ordering for each sampling period;
A process for automatically detecting the load applied to the musical sound data generation process by measurement,
A musical tone generation processing method comprising: automatically changing the setting of the musical tone generation mode in the musical tone data generation processing according to the load detected by the detection processing.
前記検出する処理は、前記楽音データ生成処理に費やされる時間を計測し、前記計測した時間と前記楽音データ生成処理の実行時間間隔とに基づいて、前記負荷量を検出する
ことを特徴とする請求項1、2または3のいずれか1項に記載の楽音生成処理方法。
The detecting process measures a time spent in the musical sound data generation process, and detects the load amount based on the measured time and an execution time interval of the musical sound data generation process. Item 4. The musical tone generation processing method according to any one of Items 1, 2, or 3.
前記楽音の生成態様を決定する処理により決定される前記楽音の生成態様は、楽音の同時発音数、効果付与手段の効果付与態様あるいはサンプリング周波数の少なくともいずれか1つである
ことを特徴とする請求項1、2または3のいずれか1項に記載の楽音生成処理方法。
The generation mode of the musical sound determined by the process of determining the generation mode of the musical sound is at least one of the number of simultaneous musical sound generations, the effect application mode of the effect applying unit, or the sampling frequency. Item 4. The musical tone generation processing method according to any one of Items 1, 2, or 3.
前記楽音の生成態様を決定する処理により決定される前記楽音の生成態様は、楽音の同時発音数、効果付与手段の効果付与態様あるいはサンプリング周波数の少なくともいずれか2つであり、使用者の指示により前記楽音の生成態様のいずれかを優先させ、前記楽音の生成態様を決定する処理は、優先されない前記楽音の生成態様を前記検出する処理により検出された前記負荷量に基づいて決定する
ことを特徴とする請求項1、2または3のいずれか1項に記載の楽音生成処理方法。
The musical sound generation mode determined by the process of determining the musical sound generation mode is at least any one of the number of simultaneous musical sound generations, the effect applying mode of the effect applying means, or the sampling frequency. The process of determining the musical sound generation mode by giving priority to any one of the musical sound generation modes is determined based on the load amount detected by the detection process. The musical tone generation processing method according to any one of claims 1, 2, and 3.
JP14782096A 1996-05-20 1996-05-20 Music generation processing method Expired - Fee Related JP3725247B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP14782096A JP3725247B2 (en) 1996-05-20 1996-05-20 Music generation processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP14782096A JP3725247B2 (en) 1996-05-20 1996-05-20 Music generation processing method

Publications (2)

Publication Number Publication Date
JPH09311681A JPH09311681A (en) 1997-12-02
JP3725247B2 true JP3725247B2 (en) 2005-12-07

Family

ID=15438975

Family Applications (1)

Application Number Title Priority Date Filing Date
JP14782096A Expired - Fee Related JP3725247B2 (en) 1996-05-20 1996-05-20 Music generation processing method

Country Status (1)

Country Link
JP (1) JP3725247B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4645597B2 (en) * 2007-01-09 2011-03-09 ヤマハ株式会社 Musical sound synthesis method, recording medium, and musical sound synthesizer
JP4862879B2 (en) * 2008-10-31 2012-01-25 ヤマハ株式会社 Musical sound synthesis method, recording medium, and musical sound synthesizer
US9613635B2 (en) 2012-06-26 2017-04-04 Yamaha Corporation Automated performance technology using audio waveform data

Also Published As

Publication number Publication date
JPH09311681A (en) 1997-12-02

Similar Documents

Publication Publication Date Title
JP3198890B2 (en) Automatic performance data processor
US9613635B2 (en) Automated performance technology using audio waveform data
JPH09179556A (en) Method and device for musical tone generation
JPH09114462A (en) Musical sound generating method
WO2001065536A1 (en) Musical sound generator
JP3293474B2 (en) Tone generation method
JPH11126070A (en) Musical sound generating method
JP2924745B2 (en) Musical sound generating apparatus and method
JP3725247B2 (en) Music generation processing method
JPH0922287A (en) Musical sound waveform generating method
JPH06186972A (en) Musical sound processor
JP3152198B2 (en) Music sound generation method and music sound generation device
JPH07121181A (en) Sound information processor
JP3637577B2 (en) Music generation method
JP3658826B2 (en) Music generation method
JP3019755B2 (en) Music sound generation method and music sound generation device
JPH06186973A (en) Pitch detecting device
JP4096952B2 (en) Music generator
JPH11288285A (en) Method and device for generating musical sound
JP3735172B2 (en) Performance information processing method
JP3632744B2 (en) Sound generation method
JP3627557B2 (en) Musical sound generating apparatus and method
JPH096364A (en) Musical tone generating method
JP3603638B2 (en) Musical tone generation method
JP3740717B2 (en) Tone generator and musical sound generation method

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050520

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050621

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050810

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: 20050920

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050921

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313532

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20080930

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20110930

Year of fee payment: 6

LAPS Cancellation because of no payment of annual fees