cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A320277 A digitized pure tuning tone, sampled at standard settings for consumer audio: a(n) = floor(sin(2*Pi*(440/44100)*n)*32767).

Original entry on oeis.org

0, 2052, 4097, 6126, 8130, 10103, 12036, 13921, 15752, 17521, 19222, 20846, 22389, 23844, 25205, 26467, 27625, 28675, 29612, 30433, 31134, 31713, 32167, 32494, 32695, 32766, 32709, 32524, 32210, 31770, 31206, 30518, 29711, 28787, 27750, 26604, 25354, 24004, 22559, 21026, 19410
Offset: 0

Views

Author

Jim Singh, Oct 08 2018

Keywords

Comments

This sequence represents sample values for the simplest sound: a pure tone with no harmonics (i.e., a sine wave) with 0 phase shift, of digital peak amplitude, pitched at the standard tuning frequency (A440), and sampled at the standard sampling rate and bit depth resolution for consumer audio: 44100 Hz and 16 bits, respectively.
Since the maximum signed integer value that can be stored in 16 bits is (2^15)-1=32767, the method used to convert the floats to integers is to multiply the floats by 32767 then cast to integer.
The numerator and the denominator of the g.f. have degrees respectively equal to 2204 and 2205. - Stefano Spezia, Nov 02 2018

References

  • A. Davison, Killer Game Programming in Java, O'Reilly Media, 2005, page 254.

Programs

  • Mathematica
    a[n_]:= Floor[Sin[2*Pi*(440/44100)*n]*32767]; Array[a, 50, 0] (* Stefano Spezia, Nov 02 2018 *)
  • Python
    import math
    for x in range(100):
        floatval = math.sin(2*math.pi*(440/44100)*x)*32767
        intval = int(floatval)
        print(intval, end=', ')