7
$\begingroup$

This is my $Version

"11.1.1 for Microsoft Windows (64-bit) (May 16, 2017)"

We have two methods to record sounds in Mathematica if we are in 11.1.

  • SystemDialogInput["RecordSound"]
  • AudioCapture[]

But this two methods both cannot exclude those sounds in surroundings if you are recording from the microphone. I just want to record the system sounds output from the computer and not from a microphone.

So can we tell Mathematica to capture the system sound output without recording the microphone input?

Currently available devices are:

 $AudioOutputDevices

enter image description here

$\endgroup$
  • 1
    $\begingroup$ This is a problem of acoustics, not the computer language Mathematica. There are all manner of baffling and microphoning tricks, but you should explore them elsewhere. $\endgroup$ – David G. Stork May 31 '17 at 16:28
  • 1
    $\begingroup$ The approach depends deeply on several factors (indoors, outdoors, one microphone, two, voice versus non-voice, etc.) and there are several solutions that are not appropriate to discuss on this site, since they have nothing to do with Mathematica. You should search elsewhere. $\endgroup$ – David G. Stork May 31 '17 at 16:37
  • $\begingroup$ @yode, can you clarify? Based on "So can we just record those sounds just from sound card?" it sounds like you're wanting to record the sounds that your computer is outputting and not the sounds picked up by a microphone. $\endgroup$ – N.J.Evans May 31 '17 at 16:44
  • $\begingroup$ @N.J.Evans Yes,yes yes.. $\endgroup$ – yode May 31 '17 at 16:45
  • $\begingroup$ @rhermans Thanks,and could you help to delete those explaining comments(mine David G. Stork's and yours) in case misunderstanding?:) $\endgroup$ – yode May 31 '17 at 16:53
3
$\begingroup$

Windows

Idea copied from here.


On the volume tray icon, right click and select "Recording Devices"

Mathematica graphics

Mathematica graphics

Be sure that disabled devices are listed. Tick "Show Disabled Devices"

Mathematica graphics

You may have a device called "Stereo Mix" , "What U Hear" or "Rec. Playback". Enable the device if it is disabled. Now check that is listed in $AudioInputDevices, and notice the position of the device in the list.

TableForm[$AudioInputDevices, TableHeadings -> Automatic]

Mathematica graphics

Now you can specify the device using AudioInputDevice

AudioCapture[
 "test.ogg"
 , AudioInputDevice -> $AudioInputDevices[[2]] 
 , Appearance -> "Detailed"
 , SampleRate -> Automatic
 ]

Mathematica graphics

$\endgroup$
1
$\begingroup$

Mac OS

  1. Install SoX (the Swiss Army knife of sound processing programs.)

    brew install sox

  2. Install Loopback (Route audio between applications on your Mac.)

    https://rogueamoeba.com/loopback/

  3. Create a virtual audio input device which routes the audio from Safari as input.(Don't forget to tick the checkbox to activate it) enter image description here

  4. Select the virtual audio input device as the default audio input device. enter image description here

  5. Record and play

In:

RunProcess[{"open", "https://www.youtube.com/watch?v=L0MK7qz13bU"}]; RunProcess[{"/usr/local/bin/rec", "-c", "2", "radio.aiff", "trim", "0", "0:10"}] RunProcess[{"/usr/local/bin/play", "radio.aiff"}]

Out:

enter image description here

$\endgroup$
  • $\begingroup$ +1. Does AudioCapture work on MacOS? Is the virtual loopback showing up in $AudioInputDevices? $\endgroup$ – rhermans May 31 '17 at 21:20
  • $\begingroup$ No.There is no such API available on macOS. It is showing up in $AudioOutputDevices at least. There is something wrong with my audio input devices/drivers, $AudioInputDevices is empty. $\endgroup$ – UnchartedWorks May 31 '17 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.