Pcm audio, crossfading

maybe here someone can add, a command to reduce the volume and increase the sound volume (crossading), when the audio moves from case1 to case2.

switch (engineState) {
  
     // case 1:
    //  if (curStartSample >= start_length) { // Loop the sample
    //    curStartSample = 0;
    //    engineState = 2;
   //   }
   //   OCR1A = fixedSmpleRate; // fixed sample rate (speed)!
   //   OCR2B = pgm_read_byte(&start_data[curStartSample]);
   //   curStartSample++;
   //   break;      

      // running ----
      case 2:
        if (curIdleSample >= idle_length) {
        curIdleSample = 0;
      }
      OCR1A = currentIdleRate; // variable sample rate (RPM)!
      OCR2B = pgm_read_byte(&idle_data[curIdleSample]);
      curIdleSample++;
      break;
    
      case 3:
       if (curOnidleSample >= onidle_length) { // Loop the sample
        curOnidleSample = 0;
      }
      OCR1A = currentONidleRate; // variable sample rate (RPM)!
      OCR2B = pgm_read_byte(&onidle_data[curOnidleSample]);
      curOnidleSample++;
      break;

I moved your topic to an appropriate forum category @yuzeng_39 .

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

You are establishing a pattern of irresponsible use of our forum. If you won't respond to polite requests to change your behavior, we will be forced to resort to other corrective action, by which I mean an account suspension. I don't want to do that, and I'm sure you don't want it either, so please start making the effort to properly categorize your topics.

Thanks in advance for your cooperation.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.