Audio In
Impromptu can only connect to a single audio device per session - the default output device as specified in your system preferences. Impromptu automatically creates an output unit for you *au:output-node* that connects to the output of the device. Impromptu also attempts to create an input unit for you *au:input-node* if the device supports input. The *au:output-node* has a single input bus 0. The *au:input-node* has a single output bus 1. So, in short, if your output device supports input as well as output Impromptu will create an *au:input-node* for you on startup. NOTE: Setting the default input device in system preferences will have NO effect on Impromptu (which completely ignores the request).
Now, if you happen to have input and output on separate audio devices there is a way to trick Impromptu into working. We can use the Audio MIDI Setup utility to construct a single virtual device made up from multiple physical devices. CoreAudio will treat this virtual device as a single device, allowing us to select the virtual device as the default output and thereby trick Impromptu into running with the input and output we would like to use. Intel laptops, for example, have separate physical audio devices for line output and mic input, so we will use that as our example.
First, open up the Audio MIDI Setup application in your Application/Utilities folder. Then select Open Aggregate Device Editor from the Audio menu.
 
 
 
Add a new aggregate device (i.e. virtual device) and select the input and output devices you wish to use.
Name your virtual device, then select done and your done. Make sure you select the MyVirtualDevice as your default output device from the system preferences.
 
 
Now when you restart Impromptu the MyVirtualDevice provides both input and output.
You can use the *au:input-node* just as you would use any other aumu or augn AudioUnit. Here's the simplest example, sending the input single straight to the output.
 
(au:connect-node *au:input-node* 1 *au:output-node* 0)
(au:update-graph)
 
Let's disconnect the input from the output and add a filter between the two.
 
(au:disconnect-node *au:output-node* 0)
(define filter (au:make-node "aufx" "filt" "appl"))
(au:connect-node *au:input-node* 1 filter 0)
(au:connect-node filter 0 *au:output-node* 0)
(au:update-graph)
(au:open-view filter)
 
You should now be able to mess with the input signal by adjusting the filters parameters.
 
 
Recording
You can record directly to aiff or m4a file. It's a simple as starting the recording and then stopping the recording when you're finished. you can start recording to disk by calling start-audio-capture. The files extension defines whether an aif or m4a file is created.
 
(start-audio-capture "/tmp/test.aif" 2)
 
This will record two channels to the file /tmp/test.aif. You can specify more than 2 channels if your device supports more than 2 channels (and you have selected to save as aif. m4a does not support more than 2 channels). To stop the recording call the function stop-audio-capture.
 
(stop-audio-capture)
 
If your find you are getting audio dropouts during the recording try increasing the audio frames per cycle in Impromptu's preferences (yes you will need to restart for the change to take effect). This will increase your latency but will give Impromptu more time to complete the required disk-IO.
 
 
Making Even More Noise
Audio Input, 3D Sound and Recording to disk