File:Sinc.wav

From LaTeX CAS translator demo
Jump to navigation Jump to search

Sinc.wav(file size: 517 KB, MIME type: audio/wav)

This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

Summary

Description
English: A three-second fragment of the sinc function as audio (three seconds at 44100 Hz; Blackman window applied; frequency 2000 Hz).

Generated by the following Python code.

import math
import wave
import struct

# The sinc function.
def sinc(x):
    return math.sin(x) / x if not x == 0.0 else 1.0

# The Blackman window.
def blackman(length, i):
    t = i / (length - 1)
    return 0.42 - 0.5 * math.cos(t * math.pi * 2.0) + 0.08 * math.cos(t * math.pi * 4.0)

# Windowed-sinc function.
def windowed_sinc(length, frequency):
    output = []
    for i in range(length):
        sinc_phase = i - (length - 1) / 2
        output.append(sinc(sinc_phase * frequency * math.pi * 2.0) * blackman(length, i))

    return output


SAMPLE_RATE = 44100
DURATION = 3
FREQUENCY = 2000.0
with wave.open("sinc.wav", "w") as wavfile:
    wavfile.setnchannels(2)
    wavfile.setsampwidth(2)
    wavfile.setframerate(SAMPLE_RATE)

    for sample in windowed_sinc(SAMPLE_RATE * DURATION, FREQUENCY / SAMPLE_RATE):
        wavfile.writeframes(struct.pack("<h", int(sample * 32767)) * 2)
Date
Source Own work
Author SopaXorzTaker

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

12 September 2020

audio/wav

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeDimensionsUserComment
current16:53, 12 September 2020 (517 KB)wikimediacommons>SopaXorzTakerCross-wiki upload from en.wikipedia.org

The following page uses this file: