コンピューターミュージック



コードをMIDIに変換

コードを入力して MIDI ノートの組み合わせを生成するソフトウェアには、さまざまな種類があります。よく使用されるツールには次のようなものがあります。
  • キャプテン コード (ミックス イン キー): これは、コード進行を作成して MIDI ノートに変換するのに役立つ、プロフェッショナルなコード進行ジェネレーターです。通常、Ableton Live、FL Studio などのデジタル オーディオ ワークステーション (DAW) にプラグインとして統合されます。
  • Scaler 2: これは、コードのさまざまなバリエーションや組み合わせを探索するために使用できる強力なコード進行生成ツールです。 Scaler 2 は、生成されたコードの MIDI への変換もサポートしています。
  • Orb Composer: これは、人工知能要素を備えたコード生成ソフトウェアです。ユーザーの選択に基づいて新しいコード進行とメロディーを生成し、MIDI ファイルとしてエクスポートできます。
  • RapidComposer: これは、コード、メロディー、伴奏を生成するために使用できる音楽作成ツールです。直感的なユーザーインターフェイスを備え、MIDI エクスポートをサポートしています。
  • Cthulhu (Xfer Records による): これは、さまざまなデジタル オーディオ ワークステーションに統合できる VST プラグインとして設計された MIDI コード ジェネレーターです。強力なコード進行の生成および編集機能を備えています。
  • MIDIculous: 主に楽器の演奏を学習するためのソフトウェアですが、コード進行を素早く作成するために使用できるコード生成機能もいくつか備えています。

    音声からMIDIへ

    Speech-to-MIDI テクノロジーは、あなたの声のオーディオ信号を MIDI ノートとデータに変換します。これにより、メロディーを歌ったりハミングしたりして、リアルタイムで音符に変換し、編集したりデジタルで楽器を演奏するために使用したりすることができます。
  • Speech to MIDI を使用する理由は何ですか? クリエイティブな入力: 特に訓練を受けた楽器奏者でない場合は、アイデアを楽器で演奏するよりも早く表現できます。 即興: 歌や腹話術を通じてアイデアをすばやくキャプチャし、使用可能な MIDI データに変換します。 仮想楽器のコントロール: 声を使ってシンセサイザー、ドラム、または MIDI データを受信できるあらゆる楽器をコントロールします。
  • どのように機能するのでしょうか? オーディオ入力: オーディオ信号 (音声) をシステムに提供します。 ピッチ検出: ソフトウェアまたはプラグインは声のピッチを検出します。 MIDI 変換: 検出されたピッチとリズムを対応する MIDI ノートに変換します。 出力: MIDI データは、仮想シンセサイザーやサンプラーなどの MIDI 互換楽器をトリガーできます。
  • speech-to-MIDI 用のツールとソフトウェア このプロセスに役立つ一般的なツールをいくつか紹介します。 Ableton Live (Max for Live Devices): Ableton はピッチを MIDI に変換するプラグインをいくつか提供しています。 Audio to MIDI などの Max for Live デバイスは、ボーカルまたはオーディオを MIDI に変換できます。 Melodyne: 強力なピッチ補正ツールで、オーディオ ファイルから MIDI データをエクスポートすることもできます。 Antares Auto-Tune: この有名なピッチ補正ツールには、いくつかの MIDI エクスポート機能があります。 WIDI オーディオから MIDI VST へ: あらゆるオーディオ入力を即座に MIDI に変換します。 Reaper (プラグイン付き): Reaper DAW では、ReaTune などのプラグインを使用して瞬時にピッチのトラッキングと変換を行うことができます。
  • 基本設定 マイク: 音声をキャプチャするようにマイクを設定します。 オーディオ インターフェイス: DAW (デジタル オーディオ ワークステーション) にオーディオ信号を導入するインターフェイスを使用します。 Speech-to-MIDI ソフトウェア: オーディオ入力を MIDI に変換できるツールを選択します。受信メッセージを分析するためにプラグインまたはソフトウェアを構成します。 バーチャル・インストゥルメント: MIDI 出力をルーティングしてバーチャル・インストゥルメントを制御します。
  • DAW で Speech to MIDI を使用する手順 自分の声を録音または入力します。マイクに向かって歌うかハミングします。 オーディオを分析する: speech-to-MIDI プラグインまたはソフトウェアを使用してオーディオを分析します。これでMIDI信号に変換されます。 MIDI データの編集: 変換後、MIDI データは DAW 内の他の MIDI と同様に編集できます。タイミングを修正したり、ノートを変更したり、モジュレーションを追加したりできます。 インストゥルメントのトリガー: MIDI を使用して DAW 内の仮想インストゥルメントを演奏します。
  • 挑戦 精度: 音声から MIDI への変換は、必ずしも 100% 正確であるとは限りません。特に複雑な音声入力の場合、ピッチやリズムの誤解が発生する可能性があります。 Delay: 設定によっては、歌ってから MIDI ノートが生成されるまでにわずかな遅れ(遅延)が生じる場合があります。 ピッチ範囲: 一部のソフトウェアでは、非常に高い音または非常に低い音を検出するのが難しい場合があります。 より良い結果のためのヒント 歌ったりハミングしたりするときは、明確で独特な音程を使用してください。 単音のメロディーを変換する場合は、音間の混乱を避けるためにモノフォニック モードで作業してください。 ビートボクサーやパーカッショニストは、ボーカルを特定のドラム サウンドにマッピングする MIDI トランジションを設定することで、自分の声を使用してドラム サウンドをトリガーできます。 麗江 - 2024/10/14

    voice-to-MIDI converter using Python

    1. **Capture Audio Input**: We'll use a microphone to record the voice input.
    2. **Analyze Audio**: The audio needs to be analyzed for its frequency (pitch detection).
    3. **Convert Frequency to MIDI Notes**: The detected frequency can be mapped to MIDI notes.
    4. **Create MIDI File**: After converting the frequencies to MIDI notes, we can save them in a `.mid` file.
    
    We'll need some Python libraries to accomplish this:
    
    - `sounddevice`: For recording the audio.
    - `numpy` and `scipy`: For working with and analyzing audio signals.
    - `mido`: To create MIDI files.
    - `aubio`: For pitch detection (aubio specializes in audio-to-note detection).
    
    ### Step-by-Step Process
    
    #### Step 1: Install the Required Libraries
    First, we need to install the necessary Python libraries:
    
    ```bash
    pip install sounddevice numpy scipy mido python-rtmidi aubio
    ```
    
    #### Step 2: Capture Audio Input
    
    Here’s how you can capture audio input using `sounddevice`:
    
    ```python
    import sounddevice as sd
    import numpy as np
    
    def record_audio(duration, sample_rate=44100):
        print("Recording...")
        audio = sd.rec(int(duration * sample_rate), samplerate=sample_rate, channels=1, dtype='float32')
        sd.wait()  # Wait until recording is finished
        print("Recording finished.")
        return audio.flatten()
    ```
    
    This function records audio from the microphone for a specified duration.
    
    #### Step 3: Analyze Audio for Pitch (Using `aubio`)
    
    Now, let's detect the pitch of the recorded audio using the `aubio` library:
    
    ```python
    import aubio
    
    def detect_pitch(audio, sample_rate=44100):
        pitch_detector = aubio.pitch("default", 2048, 512, sample_rate)
        pitch_detector.set_unit("Hz")
        pitch_detector.set_silence(-40)  # Adjust silence threshold if needed
        
        pitches = []
        for i in range(0, len(audio), 512):
            sample = audio[i:i + 512]
            pitch = pitch_detector(sample)[0]
            if pitch > 0:  # Only consider non-zero pitch values
                pitches.append(pitch)
        return pitches
    ```
    
    This function processes the audio and detects the pitch at regular intervals.
    
    #### Step 4: Convert Pitch to MIDI Notes
    
    MIDI notes correspond to specific frequencies. We can map detected frequencies to their nearest MIDI note numbers:
    
    ```python
    def frequency_to_midi(frequency):
        if frequency <= 0:
            return None
        midi_note = 69 + 12 * np.log2(frequency / 440.0)  # A4 = 440Hz corresponds to MIDI note 69
        return round(midi_note)
    ```
    
    #### Step 5: Create a MIDI File
    
    We can now convert the detected MIDI notes into a MIDI file using the `mido` library:
    
    ```python
    from mido import MidiFile, MidiTrack, Message
    
    def create_midi_from_pitches(pitches):
        midi_file = MidiFile()
        track = MidiTrack()
        midi_file.tracks.append(track)
        
        # Add some basic track information
        track.append(Message('program_change', program=12, time=0))
        
        # Convert each pitch to a MIDI note and add to the track
        for pitch in pitches:
            midi_note = frequency_to_midi(pitch)
            if midi_note is not None:
                track.append(Message('note_on', note=midi_note, velocity=64, time=100))
                track.append(Message('note_off', note=midi_note, velocity=64, time=200))
        
        return midi_file
    ```
    
    This function takes the detected pitches, converts them to MIDI notes, and creates a MIDI file. The `note_on` and `note_off` events are added to simulate playing and releasing the note.
    
    #### Step 6: Putting It All Together
    
    Now, we can record audio, detect the pitch, convert it to MIDI notes, and save it as a `.mid` file:
    
    ```python
    def voice_to_midi(duration):
        # Step 1: Record audio
        audio = record_audio(duration)
        
        # Step 2: Detect pitch from the recorded audio
        pitches = detect_pitch(audio)
        
        # Step 3: Create a MIDI file from the detected pitches
        midi_file = create_midi_from_pitches(pitches)
        
        # Step 4: Save the MIDI file
        midi_file.save('output.mid')
        print("MIDI file saved as 'output.mid'")
    
    # Record and convert voice to MIDI for 5 seconds
    voice_to_midi(5)
    ```
    
    ### Explanation:
    - **Step 1**: Records audio from your microphone for the given duration.
    - **Step 2**: The recorded audio is split into frames, and each frame is analyzed for its pitch.
    - **Step 3**: The detected pitch is converted to a MIDI note.
    - **Step 4**: A MIDI file is created with `note_on` and `note_off` events for each detected note.
    
    ### Notes:
    - The code is designed for monophonic melodies (i.e., one note at a time). For polyphonic melodies (multiple notes at once), more advanced techniques are required.
    - **Noise sensitivity**: Ensure that the environment is relatively quiet, as background noise can interfere with pitch detection.
    
    This script should give you a basic starting point for voice-to-MIDI conversion in Python.
    

    離蒄-柔音美景@Youtube
    . email: [email protected]
    
    T:0000
    資訊與搜尋 | 回music首頁
    email: Yan Sa [email protected] Line: 阿央
    電話: 02-27566655 ,03-5924828