Code Monkey home page Code Monkey logo

Comments (6)

bastibe avatar bastibe commented on August 30, 2024

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.

kafan1986 avatar kafan1986 commented on August 30, 2024

@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.

bastibe avatar bastibe commented on August 30, 2024

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.

kafan1986 avatar kafan1986 commented on August 30, 2024

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.

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.

Chum4k3r avatar Chum4k3r commented on August 30, 2024

from soundcard.

bastibe avatar bastibe commented on August 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.