How do I find help?
How do I make a sound?
How do I connect an instrument?
What is a callback?
How do I play a scale
How do I play a chord
How do I loop a sequence of notes
How do I work with beats instead of samples?
How does metro work?
How do I draw a picture?
How do I draw an image?
How do I use OpenGL?
How do I playback an audio file?
How do I load an audio file?
How do I use the impromptu sampler?
What is pb:cb and how does it work?
How does the play macro work
How do I make microtonal music
Why don't the impromtpu key bindings work?
What is a "process" in impromptu?
What are the AudioUnits that ship with impromptu?
How do I get an FFT of the signal?
How do I do sound synthesis in impromptu?
How do I use the ObjC Bridge?
How do I play back a movie with audio?
How do I build a UI in Impromptu?
How do I make Kontakt3 work in Impromptu?
How do I make a sound?
Read the "Getting Started" Tutorials
How do I connect an instrument?
Read the "Getting Started" Tutorials
What is a callback?
Read the "Getting Started" Tutorials
How do I play a scale?
Read the "Making Music" Tutorial
How do I play a chord?
Read the "Making Music" Tutorial
How do I loop a sequence of notes?
Read the "Making Music" Tutorial
How do I work with beats instead of samples?
How does metro work?
How do I draw a picture?
How do I draw an image?
How do I use OpenGL?
Watch the "3D with OpenGL" Tutorial
How do I playback an audio file?
How do I load an audio file?
How do I use the impromptu sampler?
What is pb:cb and how does it work?
How does the play macro work?
How do I make microtonal music?
This is a two part answer.
Part the first: You can use the function play-sound which is equivalent to play-note with the exception that pitch and volume are real number values. In other words you can type 60.25 to play one quarter of a tone above 60 (middle C). The catch is that play-sound will not work with all audio units - give it a go see if it works. The DLS and all of the Impromptu AU's (including the sampler) support play-sound
Part the second: If you can't use play-sound (because the AU you are using does not support it) you might find that the AU itself allows you to set a tuning's file. You can then use the tunings file to map midi pitches to frequencies. Many of NI AU's support tuning's files as does the Zebra synth.
Why don't the impromptu key bindings work?
Make sure you have installed the DefaultKeyBinding.dict file in your ~/Library/Keybindings/ directory. If the directory does not exist go ahead and create it. The DefaultKeyBinding.dict file is bundled in the download DMG file.
What is a "process" in impromptu?
The main thing to remember is that each "Process" is actually a completely new scheme interpreter with it's own scheme memory allocation. So creating new processes is useful if you have scheme functions that take a long time to process (analysis functions for example). Remember that recursive callbacks multi-task using asynchronous messaging (i.e. they are not preemptive) and as a result any slow functions you have will stop other recursions from performing at the scheduled time - of course this is a disaster for music. For preemptive multi-tasking you can create new processes to hold slow running scheme functions and have them "post" results (using sys:ipc-define for example) back to your primary process where those results can be used in your "musically time sensitive" functions. One other nice thing about using processes is that you can make use of multiple CPU cores/processors. However, keep in mind that audio, video, UI and networking as well as the primary scheme process all already run in their own individual threads so Impromptu already keeps a 4 CPU machine relatively busy.
It's fine to load library functions in one particular process as long as the library is only used from inside that process. All default libraries (i.e. anything installed in Application Support) will be automatically loaded by any new process.
Remember that sys:ipc-call will not return a result to you. So you will need to use sys:ipc-define to pass values between scheme processes. I should point out that sys:ipc-define is limited to scheme primitives only - so, strings, numbers, vectors and lists are OK but canvas's, images etc.. are not. However, there is a cheat for passing objc/c structures using sys:ipc-define. If you are using two processes on the same machine you can access the shared objc/c structures by using (objc:get-address) and (objc:from-address). Here's a little example:
;; evaluated in process number one
(define *canvas* (gfx:make-canvas 640 480))
(define str-ptr-ref (objc:get-address *canvas*))
(print str-ptr-ref)
(print *canvas*)
(sys:ipc-define "process_two" 'str-ptr-rep-2 str-ptr-rep)
;; evaluated in process number two
(define *canvas-ref* (objc:from-address str-ptr-ref-2))
(print *canvas-ref*)
Now *canvas* and *canvas-ref* point to the same canvas and you can start drawing to the canvas from both processes. Sharing audiounits is of course trivial because they are already referenced using scheme numbers which are scheme primitives.
Also remember that the scheduler (and therefore time) is shared between the processes, so everything should stay nicely sync'd. And as an added bonus remember that the ipc calls also work transparently across the network to a remote impromptu host - although you can't share objc/c structures with a remote host. Having said this, keep in mind that Impromptu also has io:send-port-message that allows you to send arbitrary objc objects between remote instances.
What are the AudioUnits that ship with impromptu?
As of v1.3 impromptu ships with a set of basic audiounits. There are two primary motivations for adding these. First they provide a set of audiounits designed specifically for programatic use and secondly they provide some very low level functionality that is unlikely to be needed by other AU hosts (such as oscillators, gates etc..). The complete set is
- Analysis "aufx" "asys" "MOSO": An FFT AU
- Channel Splitter "aufx" "chan" "MOSO": Strips particular channels from an incoming audio signal
- Constant "augn" "cnst" "MOSO": Outputs a constant value
- MIDI Gate "aumu" "gate" "MOSO": A simple MIDI Gate
- Multiplier "aumf" "mult" "MOSO": Multiplies two signals
- Noise "aumf" "nois" "MOSO": Noise generator
- Oscillator "aumf" "osc_" "MOSO": Oscillator
- Recorder "aufx" "recd" "MOSO:" Records audio signal
- Sampler "aumu" "play" "MOSO:" Sample playback engine
- Splitter "aufx" "splt" "MOSO:" Splits signal in two and allows for feedback
- Summer "aufx" "sum_" "MOSO": Sums two signals
- Timer "aumf" "time" "MOSO": A counter which can be used to sync machines
Analysis you can put one or more analysis audio units anywhere in the audio chain. The Analysis audiounit is currently set to an FFT size of 2048. You can retrieve the Analysis magnitudes at any time by calling au:asys:get-fft-data. This function fills an NSMutableArray, which must be supplied by you, with FFT magnitudes. Have a look at the Sonogram example to see how this works. Be aware that the manufacturer name is now 'MOSO' not 'moso'
Constant the constant AU does just that it outputs a constant value. You can set the value by setting the audiounits *cnst:constant* param id. Watch this movie for an example of the constant in use. Be aware that manufacturer is now 'MOSO' not 'moso'
Channel Splitter isolates channels that you are interested in and blocks the rest. This is particularly useful when working with multi-channel audio devices. An example would be 10channels in and you are only interested in processing 4 channels (1,3,4 and 9 for example) - any others (2,5,6,7,8,10) will be ignored. When combined with the splitter au "splt" you have very explicit control over your audio data flow.
MIDI Gate is useful for gating other audiounits. In common usage you would place this as the volume or frequency input to an Oscillator. You can then call the MIDI Gate as a normal instrument using play-note or play-sound. The MIDI Gate will often be used with the Oscillator and is necessarily monophonic. Watch this or this movie for examples of the MIDI gate. Be aware that the manufacturer name is now 'MOSO' not 'moso'
Multiplier the product of two signals. Has two input busses and one output bus. The gain of each input can be set by calling *mult:bus0:gain* or *mult:bus1:gain*. Watch this movie for an example of the multiplier. Be aware that the manufacturer name is now 'MOSO' not 'moso'
Noise a constant white noise generator. Optionally takes a bus0 input for amplitude modulation (or gating for example). Watch this movie for an example of the noise generator in action. Be aware that the manufacturer name is now 'MOSO' not 'moso' and the type is now 'aumf' not 'aufc'
Oscillator an oscillator generating a constant signal. can be set to different waveforms (sine, triangle, square and pulse) by setting the *osc_:wave* parameter. Allows the frequency and amplitude to be adjusted either parametrically using *osc_:frequency* or *osc_:amplitude* or by connecting a signal (i.e. AU) to either input bus 0 (amplitude) or input bus 1 (frequency). You can offset the phase of the oscillator by using the *osc_:phase-offset* param. Watch this, this, this or this movie for examples using oscillator. Be aware that the manufacturer name is now 'MOSO' not 'moso' and the type is now "aumf" not "aufc"
Recorder captures audio (and passes through) audio at the point in the AudioUnit graph that it is installed. You can begin capturing audio by setting the param *recd:recording?* to true (i.e. 1) to stop recording set the *recd:recording?* param to false (i.e. 0). Once you have recorded data you can pull it from the Recorder by calling the function au:recd:get-sample-data. This will return the recorded audio data in the same format as au:load-audio-data which will allow it to be used by the Sampler AU. Watch this movie for an example of the recorder audiounit. Be aware that the manufacturer name is now 'MOSO' not 'moso'
Sampler the Sampler can be used for audio sample playback. It includes the ability to dynamically load audio sample data at runtime which can be loaded from an audio file (au:load-audio-data) a quicktime movie (au:get-audio-data-from-movie) or from the Recorder AU. The sampler supports loop points (*play:loop:start* *play:loop:end* *play:loop:on*), sample start time (*play:starttime*) and simple enveloping (*au:envelope:attack* *au:envelope:release*) for each individual sample - you must set the element to the samples root pitch to change these parameters. Up to 127 individual sounds can be loaded, one for each MIDI pitch. Sample data is loaded against a root pitch by calling au:play:set-sample-data. Simple resampling is implemented to provide basic pitch shifting. The range of each sample is determined by how many other samples are loaded and which root pitches they are loaded against. Watch this or this movie for an example of using the Sampler AU. Be aware that the manufacturer name is now 'MOSO' not 'moso'
Splitter Splits a signal into outputs (i.e. one input bus and two output busses). This is paricularly useful for implementing feedback (be warned that the splitter does not limit your signal so make sure you control the amount of feedback by setting splt:bus0:gain or splt:bus1:gain !!!). I suggest you put a limiter "aufx" "lmtr" "appl" on your output just in case ! :). Watch this movie for an example of the splitter used to create an audio feedback loop. Be aware that the manufacturer name is now 'MOSO' not 'moso' and the type is not 'aumf' not 'aufc'
Summer Sums to audio signals (i.e. two input busses and one output bus). The gain of each input can be set by calling *sum_:bus0:gain* or *sum_:bus1:gain*. Watch this movie for an example of the summer audiounit. Be aware that the manufacturer name is now 'MOSO' not 'moso' and the type is 'aumf' not 'aufc'.
Timer The timer is both a generator and a receiver of integer indexed numbers counted from 0 in sample increments (i.e. 1 per sample processed). The signal 32bit unsigned int and can be sent across a network using netsend and netreceive.
How do I get an FFT of the signal?
How do I get help
In the impromptu editor you can evaluate (help functionname #t) to print a functions documentation into the log view. If you don't know what the name of a function is you can do a text match search for possible functions by typing (help matchstring). For example (help image) will find and print a list of all documented functions that contain image in their title or in their help text. You can also find help on this FAQ page as well as the tutorials page. Of course the gallery examples also provide useful examples as do the example files provided in the impromptu download dmg.
How do I do sound synthesis?
Their are two primary mechanisms for making sound in Impromptu. The simplest way is to use an audiounit to do sound synthesis, either your own custom audiounit or a 3rd party free or commercial audiounit. The second, more complex and more fun way, is to build your own sound synthesis code on the fly. This example file will give you an introduction to such things.this example.
This video provides an introduction to the same material.
Livecoding Audio DSP from Andrew Sorensen on Vimeo
How do I use the ObjC Bridge
Read this tutorial
and then look at example 53 Silly Synth
How do I play back a movie with audio?
How do I build a UI in Impromptu?
Have a look at the ObjC bridge tutorial
Then check out the Silly Synth example
How do I make Kontakt3 work in Impromptu?
When you first launch Kontakt 3 there are some popup dialogues that cause problems for Impromptu. Luckily once these have been OK'd once you don't need to worry about them again and everything should be fine. The secret is to open Kontakt 3 in AULab (it is not enough to open Kontakt standalone - it must be opened as a plugin) and OK any dialogues that popup. This should be a one off process - you can check by closing AULab and repeating the process. Once no more popup dialogues appear you should be AOK to open Kontakt 3 in Impromptu.