File:Sinc.wav

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Sinc.wav(WAV audio file, length 3.0 s, 1.41 Mbps overall, file size: 517 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

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[edit]

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.

File history

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

Date/TimeThumbnailDimensionsUserComment
current14:53, 12 September 20203.0 s (517 KB)SopaXorzTaker (talk | contribs)Cross-wiki upload from en.wikipedia.org

There are no pages that use this file.

Transcode status

Update transcode status
Format Bitrate Download Status Encode time
MP3 40 kbps Completed 14:53, 12 September 2020 1.0 s
Ogg Vorbis 33 kbps Completed 14:53, 12 September 2020 1.0 s

File usage on other wikis

The following other wikis use this file: