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.
Building AudioTest from source
To build AudioTest from source, you will need:
The Visual Studio .vcproj file is generated from the Qt .pro file, and it uses relative paths in the "Additional Include Directories" and "Additional Dependencies" settings to find Qt headers and libs. Because of this, you will most likely need to regenerate the .vcproj before you load the .sln and start compiling. To do this, open a console, run vsvars32.bat (to set up Visual Studio environment variables), add the Qt bin directory to your path, then issue the command qmake -tp vc. This will generate a new .vcproj for your setup, and you will then be ready to load the .sln and start compiling.
I have included a default .user file only for your convenience, because it contains an "Environment" setting so that Qt is added to the PATH environment variable when you run or debug. It assumes Qt is in C:\Qt\4.6.3\bin, so change this if it isn't.
The source code includes the complete Lua distribution, so you don't need to download it separately.
0 comments:
Post a Comment
If you are commenting to request download links, please include an email address in your comment to receive the download links via email. Comments with email addresses in them will not appear in the comments section.