Sounderzeugung
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										21
									
								
								sound/gensound_test.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								sound/gensound_test.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
from gensound import Sine, Triangle, Square, Pan
 | 
			
		||||
 | 
			
		||||
sig = Triangle # Sine? Square?
 | 
			
		||||
 | 
			
		||||
beat = 0.5e3 # 120 bpm
 | 
			
		||||
fermata = 0.1 # make fermatas in the melody slightly longer
 | 
			
		||||
pause = 0.6 # and breathe for a moment before starting the next phrase
 | 
			
		||||
 | 
			
		||||
S = sig(f"r D5 D=2 C#=1 B-13=2 A=1 D E=2 F#-13={2+fermata} r={pause} F#=1 F#=2 F#=1 E=2 F#-13=1 G F#-13=2 E={2+fermata} r={pause} "
 | 
			
		||||
        f"D+16=1 E=2 F#-13=1 E=2 D+16=1 B-13 C#=2 D+9={2+fermata} r={pause} A'=1 F#-13=2 D+16=1 E=2 G=1 F#-13 E=2 D=3", beat)
 | 
			
		||||
A = sig(f"r A4 B=2 A+16=1 G=2 F#-13=1 F# B-13 A A={2+fermata} r={pause} C#=1 B=2 B=1 B A A A D A A={2+fermata} r={pause} "
 | 
			
		||||
        f"B=1 A=2 A=1 B-13 A=0.5 G F#=1 B-13 B A#-13 B={2+fermata} r={pause} A=1 A=2 B=1 A=2 A=1 A B-13 A F#-13=3", beat)
 | 
			
		||||
T = sig(f"r F#4-13 F#=2 F#=1 D=2 D=1 D D C#-13 D={2+fermata} r={pause} C#=1 D+16=2 D+16=1 D C#-13 D E A, D C#-13={2+fermata} r={pause} "
 | 
			
		||||
        f"F#=1 E=2 D=1 D C#-13 D+16 D G+5 F# F#={2+fermata} r={pause} E=1 F#-13=2 F#=1 E=2 C#-13=1 A B C#-13 D=3", beat)
 | 
			
		||||
B = sig(f"r D3 B-16 D F# G B-13 D B-16 G A D,={2+fermata} r={pause} A#'-13=1 B=2 A=1 G#-13 A F#-13 C#-13 D F#-13 A={2+fermata} r={pause} "
 | 
			
		||||
        f"B=1 C#-13=2 D=1 G, A B G E F# B,={2+fermata} r={pause} C#'-13=1 D C# B C#-13 B A D G, A D,=3", beat)
 | 
			
		||||
 | 
			
		||||
chorale = S*Pan(25) + B*Pan(-25) + T*Pan(80) + A*Pan(-80) # position the voices in the stereo field
 | 
			
		||||
chorale.play() # can you spot the parallel octaves?
 | 
			
		||||
		Reference in New Issue
	
	Block a user