Pass threshold as arg
This commit is contained in:
		
							parent
							
								
									db4d23a6d9
								
							
						
					
					
						commit
						a93bfa3d4d
					
				
							
								
								
									
										3
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								main.py
									
									
									
									
									
								
							@ -161,6 +161,7 @@ class AudioAnalyzer:
 | 
			
		||||
def monitor_pitch(pyaudio_device: int,
 | 
			
		||||
                  min_freq: float = 10,
 | 
			
		||||
                  max_freq: float = 6000,
 | 
			
		||||
                  threshold: float = 1e6,
 | 
			
		||||
                  ):
 | 
			
		||||
 | 
			
		||||
    analyzer = AudioAnalyzer(pyaudio_device=pyaudio_device,
 | 
			
		||||
@ -173,7 +174,7 @@ def monitor_pitch(pyaudio_device: int,
 | 
			
		||||
    while True:
 | 
			
		||||
        frame_data = analyzer.frame_queue.get()
 | 
			
		||||
 | 
			
		||||
        if frame_data['magnitude'] <= 10**6:
 | 
			
		||||
        if frame_data['magnitude'] <= threshold:
 | 
			
		||||
            continue
 | 
			
		||||
 | 
			
		||||
        prev_magnitude = frame_data['magnitude']
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user