> Audio > Synthesis > Rendering a note as an audio file | ||||
Rendering a note as an audio fileThis tutorial shows how a simple score can be rendered as an audio file. It produces a single note as a sine wave. View / Download
source
The import statements at the head of the class feature the jm.audio.*
package which provides access to the Instrument class. The declaration of a jMusic instrument or array of instruments is required
to render the score as audio. Instrument sineWave = new SimpleSineInst(44100); This line declares an instance of the SimpleSineInst class, which we've
called "sineWave" (for obvious reasons). In jMusic the rendering of a score as an audio file requires very similar code to writing MIDI files. Write.au(score, "WaveformExample.au", sineWave); This final line of code class the au method of the Write class for audio rendering of the score. The method takes three arguments, the score object, the name for the resulting file, and the instrument (or instrument array) to be used. The score is created in the normal way (see other jMusic tutorials
for details),
|
||||