File:Inharmonic additive synthesis.ogg

Inharmonic_additive_synthesis.ogg (Ogg Vorbis sound file, length 10 s, 173 kbps, file size: 211 KB)

Summary

Description
English: A sound created by inharmonic additive synthesis. Generated by the following C++ source code (compiled with GNU g++ version 4.5.2 with libsndfile 1.0.23.)
#include <sndfile.h>
#include <cmath>
#include <algorithm>
using namespace std;
double Amplitude(int k, double t)
{
return 0.01*((10-t)*(1.0/double(k)) + 0.2*t*(k%2));
}
double Frequency(int k, double t)
{
return 0.1*(220*(k+0.1*t*t*sin(k*t))*(10-t) + t*587.0);
}
int main()
{
double sr=44100;
int nFrames=int(sr)*10;
double *buf = new double[nFrames];
double t=0, dt=1.0/sr;
int K=44;
double *phase=new double[K];
for (int k=0; k<K; k++) phase[k]=0;
for (int n=0; n<nFrames; n++)
{
buf[n]=0;
for (int k=1; k<K; k++)
{
buf[n]+=Amplitude(k,t)*sin(phase[k]);
phase[k]+=twopi*Frequency(k,t)*dt;
}
t+=dt;
}
SF_INFO sfinfo;
sfinfo.samplerate=sr;
sfinfo.channels=1;
sfinfo.format=SF_FORMAT_WAV|SF_FORMAT_PCM_16;
SNDFILE *out = sf_open("inharmonic.wav", SFM_WRITE, &sfinfo);
sf_writef_double(out, buf, nFrames);
sf_close(out);
delete [] buf;
delete [] phase;
return 0;
}
Date
Source Own work (Original text: Self-made)
Author Chrisjohnson (talk)
Permission
(Reusing this file)
Creative Commons Attribution-ShareAlike

Licensing

Chrisjohnson at English Wikipedia, the copyright holder of this work, hereby publishes it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported 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.

Original upload log

Transferred from en.wikipedia to Commons by FSII using CommonsHelper.

The original description page was here. All following user names refer to en.wikipedia.
  • 2012-01-16 00:03 Chrisjohnson 0×0× (216245 bytes) {{Information |Description = A sound created by inharmonic additive synthesis |Source = Self-made |Date = 2012-01-14 |Author = [[User:Chrisjohnson|Chrisjohnson]] ([[User talk:Chrisjohnson|talk]]) |Permission = Creative Commons Attribution-Sh

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

14 January 2012

File history

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

Date/TimeThumbnailDimensionsUserComment
current11:47, 9 February 201210 s (211 KB)Upload Bot (Rich Smith) {{BotMoveToCommons|en.wikipedia|year={{subst:CURRENTYEAR}}|month={{subst:CURRENTMONTHNAME}}|day={{subst:CURRENTDAY}}}} {{Information |Description={{en|A sound created by inharmonic additive synthesis. Generated by the following C++ source code (compiled

The following 2 pages use this file:

Global file usage

The following other wikis use this file:

Metadata