Spaces:
Sleeping
Matrices to 🎶Updates
Matrices to 🎶Updates AUDIO 7
input audio 7
matrix = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]
]
matrix = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8]
]
matrix = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12]
]
matrix = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]
]
NumberSpreadSimulator Class:
Simulates the spread of numbers in a matrix, generating audio sequences based on the matrix's state.
step(): Updates the matrix and generates audio for each step, simulating a dynamic process.
MelodyMatcher Class:
Compares generated audio with a target audio file to find the best match.
compare_audio(generated_audio): Compares the chroma features of the generated and target audio, returning a similarity score.
plot_and_export_comparison(target, generated, number, similarity): Visualizes and saves the comparison results, including waveforms and chromagrams.
Main Function:
Initializes the MelodyMatcher with a target audio file and searches for the best matching matrix within a specified range.
Outputs the best match details, including similarity score and visual/audio files.
Explanation of the Process
Audio Generation: The script generates audio sequences based on a matrix of numbers. Each number influences the audio characteristics, such as pitch and duration.
Audio Comparison: The generated audio is compared to a target audio file using chroma features, which capture the harmonic content of the audio. The similarity is quantified as a percentage.
Visualization and Export: The script visualizes the comparison results using waveforms and chromagrams, saving these visualizations and the generated audio to files.