Mathematica:WAVファイルの編集と保存
Wolfram Mathematicaを使用すると、WAVファイルをインポート、分析、編集、エクスポートできます。 方法を説明します。
WAVファイルをMathematicaにインポートする
単純なコマンド「audio = Import [path、command]」を使用すると、WAVファイルからMathematicaにデータをインポートできます。 パスとコマンドは引用符で囲む必要があります。 簡単なパス入力のヘルプは、画像ギャラリーで提供されます。 次のコマンドを使用して、WAVファイルのさまざまな要素をロードできます。
- 「要素」は、MathematicaにインポートできるWAVファイルの情報を示します
- 「AudioChannels」は、WAVファイルに埋め込まれたチャンネルの数を通知します。
- 「SampleRate」はサンプルレートを出力します
- 「AudioEncoding」は、サンプルのエンコード方法を示します。 原則として、値は「Integer16」と「Integer32」、つまり16〜32ビットの整数の間にあります。 4〜64ビットのエンコードが可能です。
- 「データ」は、各行のチャネルのRAWデータを含む行列です。 警告:このマトリックスにはすべてのオーディオ素材が含まれているため、非常に大きくなる場合があります。 最大4 GBのファイルをロードできます。 ここでは、必ず「;」を使用する必要があります データの出力を抑制します。 マトリックスに「オーディオ」という名前を付けたため、引き続き作業できます。
- 「サウンド」を使用すると、Mathematicaは波形とスペクトルの表示とサウンドを再生する小さなプレーヤーを含むファイルをロードします。
- 「ルール」を使用すると、すべての情報がマトリックスにインポートされます。 6行には、「AudioChannels」、「AudioEncoding」、「Data」、「SampledSoundList」、「SampleRate」、および「Sound」がこの順序で含まれています。 注意:このマトリックスはオーディオファイル自体よりも大幅に大きいため、必ず「;」でデータを出力する必要があります。 抑制。
MathematicaでWAVファイルを分析および編集する
「データ」を使用してインポートされたRAWデータは、他のテーブルと同様にMathematicaで使用および編集できます。 次のコマンドは、オーディオ素材にとって特に興味深いものです。
- 「オーディオ」マトリックスに任意の値を表示し、必要に応じて変更できるようになりました。
- 「Dimensions [audio]」は、行と列の数、つまりチャネルごとのサンプル数を示します。
- 「area = Take [audio [[X、All]]、{start value、end value}];」を使用する チャンネルXの一部を削除できます。
- "スペクトル=フーリエ[領域];" この部分のフーリエ解析を行います。
- 自由にスペクトル成分を変更することもできます。
- 「Re [スペクトル]」、「Im [スペクトル]」、「Abs [スペクトル]」、および「Arg [スペクトル]」は、スペクトル成分の実部、虚部、振幅、位相を出力します。
MathematicaからWAVファイルをエクスポートする
操作したオーディオデータを再びWAVファイルにするには、「[path、command]をエクスポート」と入力します。 次のコマンドを使用して、WAVファイルを正しく設定します。
- エクスポートする前に、「audio / = Max [Abs [audio];]」を| 1 |で使用する必要があります。 ノーマライズ。 1より大きい値と-1より小さい値は上書きされます。
- "" SampleRate "-> 44100"は、1秒あたり44100サンプルでオーディオ素材をエクスポートします。
- "" AudioEncoding "->" Integer16 ""は、サンプルごとに16ビットでオーディオファイルをエンコードします。
- "" AudioChannels "-> 2"を使用すると、オーディオ素材にさらに多くのチャンネルが含まれている場合でも、最初の2つのチャンネルのみをエクスポートできます。
Wolfram Alphaのヒントはこちらで見つけることができます。 Audacityプログラムの使用方法。 ここで説明します。
最新の動画
Mathematicaでパスを入力するのは少し面倒です。パスは引用符で囲まれ、フォルダはスラッシュ記号「/」ではなく2つのバックスラッシュ「\\」で区切られます。 Explorerからパスを単にコピーするだけでは機能しません。
最も簡単な方法は、「挿入」->「ファイルパス」を使用することです
「選択... 「ファイルパス
「選択...」>
「ファイルパス
「選択...」/>
「選択...」/>
エクスプローラーウィンドウで目的のファイルに移動します。 Mathematicaはそれから正しいスペルでファイルパスを書き留めます。