Git Product home page Git Product logo

Comments (6)

mgeier avatar mgeier commented on July 28, 2024

Thanks for the report!

I can reproduce this with macOS and Linux.
I hope I can find a way to make this work but to still ignore the annoying PortAudio outputs.
I guess I'll have to undo the redirection after _initialize() ... or move the whole redirection thing into _initialize() ...

In the meantime, you can just remove the line _ignore_stderr() (very close to the end of sounddevice.py) as a work-around.

from python-sounddevice.

mgeier avatar mgeier commented on July 28, 2024

This is quite strange, since the input() prompt is supposed to be shown on "standard output" instead of "standard error". I've asked about this at http://stackoverflow.com/q/41394554/.

from python-sounddevice.

mgeier avatar mgeier commented on July 28, 2024

Wow, this is surprisingly complicated!

It turns out that my stackoverflow question is a duplicate of http://stackoverflow.com/q/14009714/.

And the whole thing seems to be somewhat of a bug in Python, at least it's not quite clear what the desired behavior should be. This might or might not be changed in a future Python version, there's an open issue: http://bugs.python.org/issue1927.

Since the current situation is so complicated, I don't really know what the proper solution for the sounddevice module should be.

Any suggestions?

For now, there is another work-around: just import the built-in readline module!

This should work as expected:

import readline
import sounddevice as sd
name = input("Enter your name: ")
print ("your name is " + name)

The order of imports doesn't seem to matter.

from python-sounddevice.

sararob avatar sararob commented on July 28, 2024

Thanks for investigating! That is indeed more complicated than I expected. The readline workaround fixes the issue for me, but if I have any thoughts on how to solve this for sounddevice I'll let you know.

from python-sounddevice.

pdeboer1987 avatar pdeboer1987 commented on July 28, 2024

I may have a clue to this old issue. Seems that an sd.InputStream will stop calling callback if you hit the enter key. I will raise with code as another issue.

from python-sounddevice.

mgeier avatar mgeier commented on July 28, 2024

This is fixed in the newest release.

from python-sounddevice.

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.