Mingchuan Story Music Library #40
qianshanrui
started this conversation in
General
Replies: 1 comment
-
请帮我做一首Cartoon birds come to the metropolis of steel and concrete to find food bugs的五线谱 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
import matplotlib.pyplot as plt
import numpy as np
Define the key points in the melody
notes = ['C', 'D', 'E', 'F', 'G', 'A', 'B', 'C5'] # C5 represents the C note in the next octave
note_to_frequency = {
'C': 261.63, 'D': 293.66, 'E': 329.63, 'F': 349.23, 'G': 392.00, 'A': 440.00, 'B': 493.88, 'C5': 523.25
}
1. Cartoon birds: light and cheerful melody
bird_melody = ['E', 'D', 'E', 'F', 'G']
2. Steel and concrete metropolis: deep and heavy melody
city_melody = ['C', 'E', 'C', 'B', 'A', 'G']
3. Searching: somewhat anxious and fast melody
search_melody = ['E', 'F', 'E', 'D', 'E', 'F', 'G', 'A']
4. Food bugs: suddenly cheerful, indicating the target has been found
food_melody = ['A', 'G', 'A', 'B', 'C5']
Combine the melodies
full_melody = bird_melody + city_melody + search_melody + food_melody
frequencies = [note_to_frequency[note] for note in full_melody]
Plot the melody
plt.figure(figsize=(15, 6))
plt.plot(frequencies, marker='o', linestyle='-')
plt.title("Melody for 'Cartoon birds come to the metropolis of steel and concrete to find food bugs'")
plt.ylabel("Frequency (Hz)")
plt.xticks(ticks=np.arange(len(full_melody)), labels=full_melody)
plt.grid(True)
plt.show()
Beta Was this translation helpful? Give feedback.
All reactions