Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : [minim?] Generate Audio Wave

$
0
0
Can I use an extended class of Oscillator like this :

  1. Class MyWave extends Oscillator
  2. {
  3. /* list of amplitudes point : every point is automatically  insert in this array when user create dot(x,y) */
  4. public float[] s = {0, 0.12f, 0.21f, 0.26f, 0.4f, 0.51f,0.68f, 0.89f, 1f, 0.88f, 0.66f , 0.39f , 0.14f , -0.09f , -0.36f , -0.52f , -0.68f ,
  5. -0.77f , -0.79f , -0.7f , -0.44f , -0.11f , 0.19f  , 0.39f  , 0.54f  , 0.62f  , 0.69f  , 0.74f  , 0.56f  , 0.15f  , 0   };
  6.  
  7.     public  MyWave (float frequency, float amplitude, float sampleRate)
  8.     {
  9.         super (frequency, amplitude, simpleRate);
  10.     }
  11.    
  12.     public void generate(float[] signal)
  13.     {
  14.         for (int i = 0; i < s.size() ; i++)
  15.         {
  16.             signal [ i ] = s [i];
  17.         }
  18.     }
  19.     //MONO
  20.     public void generate(float[] sigLeft, float [] sigRight)
  21.     {
  22.         generate(sigLeft);        generate(sigRight);
  23.     }
  24. }

Viewing all articles
Browse latest Browse all 1768

Trending Articles