This application is a platform for some basic audio experiments and tests. It features:
- A Lua REPL which permits the generation and modification of a waveform
- Mouse modifiable waveform
- Regeneration of waveform from Lua expression during the sliding of the sliders
- The effects of modifications to the waveform are heard instantly, because it is being streamed as it is modified
It is my first foray into audio programming. It is a precursor for a "Reactable" simulator, similar to PsychoSynth.
Things to try
When the program starts, a sample expression appears, along with the resulting waveform, and the audio of the waveform should be heard.
Slide the first slider to alter the pitch of the waveform.
Slide the second slider, and notice the waveform and audio change according to the expression in the expression text box.
In the expression text box, enter a Lua expression that sets the variable "result". Variables you can refer to in the expression are:
- x which is the time variable in the waveform, allowing you make "result" a function of time
- p2, which is the setting of the second slider (The first slider controls the pitch). To see the value of p2, run print(p2) in the provided Lua REPL.
For example, the expression:
result = 0.2 * math.sin(x * ((2.0 * math.pi) / p2))
produces a sine wave whose frequency is modifiable with the second slider.
There are some more example expressions in audiooutput.cpp.
May i know where to get the code?
ReplyDeleteSource code (requires Qt to compile):
Deletehttp://createuniverses.googlecode.com/files/AudioTest_src_v002.zip
Win32 binaries:
http://createuniverses.googlecode.com/files/AudioTest_v002.zip