I was hoping I could recreate a noise cancelling set-up by recording sound from the microphone in my headset or from the computer and play it back in my speakers or headphones with the appropriate phase shifts (I understand it may not be a simple as that but it would be a start).

That is what I want to achieve, let's start with some small goals. Is it possible to record sounds automatically in Mathematica (or even in Mathematica for Rpi) ? I am familiar with SystemDialogInput


It pops a dialog which allows you to press a button to record a sound. However I can't seem to find an option, or maybe another way, to have the sound record automatically. So that this can automatically processed

  • 3
    $\begingroup$ Mathematica is not the right tool for real time applications. It doesn't give you guarantees for timings. I'm pretty sure this is not possible to do in real time with Mathematica. You can do it after the recording has been made, but not in real time. Even with other programs, latency is going to be a significant problem and might not be avoidable at all depending on your OS and audio driver. I have some experience with this trying to play on an external keyboard and generate sound with a computer. On our computer it was impossible even with an ASIO driver. $\endgroup$
    – Szabolcs
    Commented Mar 21, 2014 at 17:55
  • 1
    $\begingroup$ That said, here's something I got from dissecting that dialog: mathematica.stackexchange.com/a/20844/12 $\endgroup$
    – Szabolcs
    Commented Mar 21, 2014 at 17:55
  • $\begingroup$ Of course when using professional sound cards it's possible to have very low latency with a supported ASIO driver, I was using asio4all on a laptop with integrated sound. $\endgroup$
    – Szabolcs
    Commented Mar 21, 2014 at 18:00
  • $\begingroup$ @Szabolcs Thanks for the info. I tried a bit using your spelunking finds and got it to work at a rudimentary level, auto recording then playing with the sound. What kinda worse-case scenario problem could I expect from using these undocumented functions ? $\endgroup$
    – lalmei
    Commented Apr 7, 2014 at 16:56
  • $\begingroup$ I really don't know. I guess you can crash the front end and lose work, crash the kernel, or cause a memory leak (probably in the front end). $\endgroup$
    – Szabolcs
    Commented Apr 7, 2014 at 18:19


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.