+ Reply to Thread
Results 1 to 2 of 2

Thread: Audio Frequency manipulation

  1. #1

    Audio Frequency manipulation

    I would like to be able to play different frequencies like (800hz, 100hz) through android phone .
    I know that Android's AudioTrack plays a 16-bit PCM so if I can calculate an array of bits or shorts. I would like to calculate only a single period so that later I can loop it without any issues.

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    45
    That can be achieved using that math equation :
    Code:
    float s_rate = 44100;
    float sample_cycle = s_rate / frequency;
    int samples_produce = ....
    
    for (int i = 0; i < sample_produce; ++i) {
       sample[i] = Math.floor(32767.0 * Math.sin(2 * Math.PI * i / sample_cycle));
    }

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts