bastibe / SoundCard

A Pure-Python Real-Time Audio Library
https://soundcard.readthedocs.io
BSD 3-Clause "New" or "Revised" License
680 stars 71 forks source link

The signal collected fron SoundCard lib #180

Open cyber211 opened 4 days ago

cyber211 commented 4 days ago

The original signal is not continous that cause the fft curve is not right, How do i configure to make the collected data continously? image

bastibe commented 4 days ago

What OS are you running, and do you get any warnings or errors?

cyber211 commented 3 days ago

Thanks for your response, OS version:

OS: Windows 10 Enterprise Ver 22H2 OS internal version 19045.4780 Windows Feature Experience Pack 1000.19060.1000.0

Warnings:

C:\Users\xxx\AppData\Local\Programs\Python\Python39\lib\site-packages\soundcard\mediafoundation.py:772: SoundcardRuntimeWarning: data discontinuity in recording warnings.warn("data discontinuity in recording", SoundcardRuntimeWarning)

bastibe commented 1 day ago

There can be various reasons for this. Perhaps your computer is doing too much at the same time, or you're doing too much processing with the recorded data, or your block size is too low. In either case, SoundCard is not invoked quickly enough, and misses frames. Try lengthening your block size, reducing your sampling rate, and stripping all extraneous processing out of the audio thread. Real time does not wait for anybody, especially not in a single-threaded program like Python, and especially not on Windows.