Difference between revisions of "Testing audio output"

From CCRMA Wiki
Jump to: navigation, search
(Reference Signals)
 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
== Recording/Analyzing Signals ==
 
== Recording/Analyzing Signals ==
  
* Easiest: just write a binary output file.  The [http://audacity.sourceforge.net/ Audacity] audio editor can "Import Raw" audio. Select the correct format and import. Audacity is installed on all CCRMA machines or can be downloaded for free [http://audacity.sourceforge.net/ here]. You will automatically view the time domain signal. To see the frequency response, you can select a portion of audio and click Analyze->Plot Spectrum.
+
* Easiest: just write a binary output file using standard file I/O. For simplicity, you can directly write out the audio output within the audio callback or copy the buffer and write the file on a separate thread so the file writing doesn't hold up the audio callback.
  
 +
The [http://audacity.sourceforge.net/ Audacity] audio editor can "Import Raw" audio. Select the correct format and import. Audacity is installed on all CCRMA machines or can be downloaded for free [http://audacity.sourceforge.net/ here]. You will automatically view the time domain signal. To see the frequency response, you can select a portion of audio and click Analyze->Plot Spectrum.
  
 +
* Bit Harder: Use  [https://ccrma.stanford.edu/software/stk/classstk_1_1FileWrite.html STK]-a wavefile writer found withint the [https://ccrma.stanford.edu/software/stk/ Synthesis ToolKit ]
 +
 +
* Bit Harder: Use [http://www.mega-nerd.com/libsndfile/ libsndfile](C library for reading and writing files containing sampled sound) to write an output file. Use Audacity or other audio editor/analyzer.
 +
 +
* Bit Harder: Write your own wavefile reader/writer. Use Audacity or other audio editor/analyzer.
  
 
==Reference Signals==
 
==Reference Signals==
Line 17: Line 23:
 
* Bit Harder: use [http://www.mega-nerd.com/libsndfile/ libsndfile](C library for reading and writing files containing sampled sound) to write an output file
 
* Bit Harder: use [http://www.mega-nerd.com/libsndfile/ libsndfile](C library for reading and writing files containing sampled sound) to write an output file
  
== SAMPLE CHUCK CODE==
+
* If you want to do some serious digital signal analysis/processing: use [http://www.mathworks.com/products/matlab/ matlab] or its open source counterpart [http://www.gnu.org/software/octave/ octave]
 +
 
 +
== Sample Chuck Code==
  
  

Latest revision as of 12:27, 27 September 2011

Recording/Analyzing Signals

  • Easiest: just write a binary output file using standard file I/O. For simplicity, you can directly write out the audio output within the audio callback or copy the buffer and write the file on a separate thread so the file writing doesn't hold up the audio callback.

The Audacity audio editor can "Import Raw" audio. Select the correct format and import. Audacity is installed on all CCRMA machines or can be downloaded for free here. You will automatically view the time domain signal. To see the frequency response, you can select a portion of audio and click Analyze->Plot Spectrum.

  • Bit Harder: Use libsndfile(C library for reading and writing files containing sampled sound) to write an output file. Use Audacity or other audio editor/analyzer.
  • Bit Harder: Write your own wavefile reader/writer. Use Audacity or other audio editor/analyzer.

Reference Signals

When creating signal generators yourself, you will want to compare your audio output to reference signals. Here are a few audio programing languages/environments that might be useful.

  • Chuck-audio programming language (suggested for ease-of-use)
  • Pure Data- a graphical audio programming language
  • Bit Harder: use libsndfile(C library for reading and writing files containing sampled sound) to write an output file
  • If you want to do some serious digital signal analysis/processing: use matlab or its open source counterpart octave

Sample Chuck Code

   // Comment/uncomment the different oscillators to hear each 
   SinOsc s => dac;
   //TriOsc s => dac;
   //SqrOsc s => dac;
   //PulseOsc s => dac;
  .2 => s.gain;
   while( true )
   {
       440.0 => s.freq;
       100::ms => now;
   }
   // Use this for impulse
   //Impulse i => dac;
   //while( true ) {
   //    1.0 => i.next;
   //    100::ms => now;
   //}
   // Use this for noise 
   //Noise n => dac;
   //.2 => n.gain;
   //while( true )
   //{
   //    100::ms => now;
   //}


Download and install. From there you'll need to create a small bit of code to make the same output signals.