computer music



Chord to MIDI

There are many types of software for inputting chords to generate MIDI note combinations. Some popular tools include:
  • Captain Chords (Mixed In Key): This is a professional chord progression generator that helps you create chord progressions and convert them into MIDI notes. It is usually integrated into a digital audio workstation (DAW) as a plug-in, such as Ableton Live, FL Studio, etc.
  • Scaler 2: This is a powerful chord progression generation tool that can be used to explore different variations and combinations of chords. Scaler 2 also supports converting generated chords to MIDI.
  • Orb Composer: This is a chord generation software with artificial intelligence elements. It can generate new chord progressions and melodies based on user selections and export them as MIDI files.
  • RapidComposer: This is a music creation tool that can be used to generate chords, melodies and accompaniments. It has an intuitive user interface and supports MIDI export.
  • Cthulhu (by Xfer Records): This is a MIDI chord generator designed as a VST plug-in that can be integrated into various digital audio workstations. It has powerful chord progression generation and editing capabilities.
  • MIDIculous: Although it is mainly a software for learning to play musical instruments, it also has some chord generation functions that can be used to quickly create chord progressions.

    Voice to MIDI

    Speech-to-MIDI technology converts the audio signals in your voice into MIDI notes and data. This allows you to sing or hum a melody and convert it into musical notes in real time, which can then be edited or used to play an instrument digitally.
  • Why use speech to MIDI? Creative Input: Expressing ideas is faster than playing it on an instrument, especially if you are not a trained instrumentalist. Improvise: Quickly capture ideas through singing or ventriloquism and convert them into usable MIDI data. Control virtual instruments: Use your voice to control synthesizers, drums, or any instrument that can receive MIDI data.
  • How does it work? Audio input: You provide audio signals (your voice) to the system. Pitch detection: The software or plug-in detects the pitch of your voice. MIDI conversion: Convert detected pitches and rhythms into corresponding MIDI notes. Output: MIDI data can trigger any MIDI-compatible instrument, such as a virtual synthesizer or sampler.
  • Tools and software for speech-to-MIDI Here are some popular tools that can help you with this process: Ableton Live (Max for Live Devices): Ableton provides some pitch-to-MIDI plug-ins. Max for Live devices such as Audio to MIDI can convert vocals or audio to MIDI. Melodyne: A powerful pitch correction tool that can also export MIDI data from audio files. Antares Auto-Tune: This famous pitch correction tool has some MIDI export capabilities. WIDI Audio to MIDI VST: Instantly convert any audio input to MIDI. Reaper (with plug-ins): The Reaper DAW enables instant pitch tracking and conversion using plug-ins like ReaTune.
  • Basic settings Microphone: Set the microphone to capture your voice. Audio Interface: Use an interface to introduce audio signals into a DAW (Digital Audio Workstation). Speech-to-MIDI software: Choose a tool that can convert audio input to MIDI. Configure plug-ins or software to analyze incoming messages. Virtual Instruments: Route MIDI output to control virtual instruments.
  • Steps to use speech to MIDI in your DAW Record or type your voice: sing or hum into the microphone. Analyze the audio: Use a speech-to-MIDI plug-in or software to analyze the audio. This will convert it into a MIDI signal. Edit MIDI data: After conversion, MIDI data can be edited like any other MIDI in your DAW. You can correct the timing, change the notes, or add modulation. Trigger Instruments: Use MIDI to play any virtual instrument in your DAW.
  • challenge Accuracy: Speech to MIDI conversion is not always 100% accurate. Misunderstandings of pitch or rhythm may occur, especially with complex sound input. Delay: Depending on your settings, there may be a slight delay (delay) between when you sing and when the MIDI note is produced. Pitch range: Some software may have difficulty detecting very high or very low tones. Tips for better results Use a clear, unique pitch when singing or humming. If you are converting a single-note melody, work in monophonic mode to avoid confusion between notes. Beatboxers or percussionists can use their voices to trigger drum sounds by setting up MIDI transitions that map vocals to specific drum sounds. Lijiang - 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