Comments (6)
What sample rate are your devices using? On some operating systems, some audio devices do not honor the configured sample rate. (What OS are you using?)
Also, have you looked at the data? is it all-zeros? Some sound cards behave strangely when there's no audio data available. And this might be a bug in SoundCard, too, as it's not a behavior my sound cards seem to exhibit, so I can't test it.
from soundcard.
@bastibe UPDATE: There is something peculiar that I have observed. When some audio is playing at the background the system audio recorder works fine in the sense that it returns with samples after expected time period but if nothing is playing i.e. system audio is silent, the above issue reported is noticed, the data comes at a much higher frequency than theoretically possible. If I resume audio playback on system (play some youtube video etc.), the data rate again reverts back to normal till it paused again.
The OS is windows 11. I am still testing and will let you know. BTW, I am still unsure about block size and where it is used and is there a need to explicitly provide its value. Also, I have installed latest version from git master branch. Can I stop warning messages about data discontinuity?
from soundcard.
Can I stop warning messages about data discontinuity?
You can, using warnings.simplefilter. However, data discontinuity errors usually indicate that you didn't read the audio data fast enough, and that some audio data could not be recorded. They usually require you to fix the problem, not ignore the message.
Block sizes in this case refer to the number of frames you request per call to record
. Request more frames per call to make things run more smoothly. This should fix your data discontinuity errors as well. A data discontinuity happens if you don't read data fast enough, i.e. don't call record
often enough, or don't record enough frames per call.
(But please let me know if you think that's wrong. These warnings are a very new feature and I don't have much experience with Windows' behavior in these cases, yet.)
So the frame spam only happens during silence. In that case, Windows does not actually return any audio data, but instead sets a flag that says there's only silence. But according to the documentation and example code, the returned number of frames should still be valid. Yet in your case, this does not seem to be the case. How very annoying.
Honestly, I'm not sure what to do in this case.
from soundcard.
Can I stop warning messages about data discontinuity?
You can, using warnings.simplefilter. However, data discontinuity errors usually indicate that you didn't read the audio data fast enough, and that some audio data could not be recorded. They usually require you to fix the problem, not ignore the message.
Block sizes in this case refer to the number of frames you request per call to
record
. Request more frames per call to make things run more smoothly. This should fix your data discontinuity errors as well. A data discontinuity happens if you don't read data fast enough, i.e. don't callrecord
often enough, or don't record enough frames per call.(But please let me know if you think that's wrong. These warnings are a very new feature and I don't have much experience with Windows' behavior in these cases, yet.)
So the frame spam only happens during silence. In that case, Windows does not actually return any audio data, but instead sets a flag that says there's only silence. But according to the documentation and example code, the returned number of frames should still be valid. Yet in your case, this does not seem to be the case. How very annoying.
Honestly, I'm not sure what to do in this case.
Is this flag visible to us through your library? I can think of some logic to handle or skip data processing at my end with such silence frame data.
from soundcard.
from soundcard.
Is this flag visible to us through your library? I can think of some logic to handle or skip data processing at my end with such silence frame data.
No, because according to the documentation, it merely means that the recorded data ought to be all-zeros. Thus it means either SoundCard is handling the condition incorrectly somehow, or there's a bug in how Windows presents (or documents) the flag.
from soundcard.
Related Issues (20)
- Support acoustic echo cancellation (AEC) for windows HOT 1
- Problems with the "fuzzy matcher" in get_microphone() HOT 1
- Watch for moved streams? HOT 1
- Decode error in _CoreAudio.CFString_to_str HOT 2
- feature request - ability to add virtual audio channels. HOT 1
- Why won't it save my audio when I use this with SoundFile? HOT 4
- OSError: ctypes.util.find_library() did not manage to locate a library called 'harfbuzz' please help in windows HOT 2
- Does anyone know how to make this work? HOT 1
- Wav file is empty after recording is saved to file HOT 5
- how to end playback in advance? HOT 2
- MacOS: Empty result for all_speakers/all_microphones HOT 28
- Record audio unlimited HOT 6
- get mac audio output level HOT 1
- Queation: Is that possible to record based on a button click? HOT 1
- Data loss while recording HOT 4
- Cannot record sound with loopback if silence at start HOT 10
- loopback record audio from speaker return zero array HOT 5
- Problem with the player HOT 1
- how to get non numpy "raw" mono data from the record() method HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from soundcard.