We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
My code
import jack import numpy as np import noisereduce as nr client = jack.Client("NoiseReducer") input_port = client.inports.register("input") output_port = client.outports.register("output") buffer_size = 4096 audio_buffer = np.zeros(buffer_size, dtype=np.float64) sample_rate = None reduction_factor = 1 @client.set_process_callback def process(frames): try: in_data = input_port.get_array()[:frames] print(f"Received {len(in_data)} frames from input") if frames <= buffer_size: audio_buffer[:frames] = in_data print(f"Audio buffer before noise reduction: {audio_buffer[:frames]}") try: reduced_noise = nr.reduce_noise(y=audio_buffer[:frames], sr=sample_rate, prop_decrease=reduction_factor) print(f"Reduced noise successfully: {len(reduced_noise)} frames") print(f"Reduced noise data: {reduced_noise}") except Exception as e: print(f"Error during noise reduction: {e}") out_data = output_port.get_array()[:frames] out_data[:frames] = in_data return out_data = output_port.get_array()[:frames] out_data[:frames] = reduced_noise[:frames] else: print("Frame size exceeds buffer capacity for noise reduction") except Exception as e: print(f"Error in process callback: {e}") @client.set_samplerate_callback def samplerate_callback(new_samplerate): global sample_rate sample_rate = new_samplerate print(f"Samplerate changed to {sample_rate}") @client.set_blocksize_callback def blocksize_callback(new_blocksize): print(f"Blocksize changed to {new_blocksize}") def test_noisereduce(): test_buffer = np.random.random(1024).astype(np.float32) * 2 - 1 test_sr = 48000 print("Testing noisereduce outside of JACK client") try: reduced_test = nr.reduce_noise(y=test_buffer, sr=test_sr, prop_decrease=1) print(f"ReduceNoise output {len(reduced_test)} samples") except Exception as e: print(f"Error in noisereduce test: {e}") try: sample_rate = 48000 # Temporary fix for testing test_noisereduce() with client: print(f"Initial sample rate: {client.samplerate}") print("Client is active. Press Ctrl+C to stop.") import time while True: time.sleep(1) except KeyboardInterrupt: print("Interrupted by user") except jack.JackError as e: print(f"JACK error: {e}") except Exception as e: print(f"An error occurred: {e}")
And:
Segmentation fault (memory image flushed to disk)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
My code
And:
Segmentation fault (memory image flushed to disk)
The text was updated successfully, but these errors were encountered: