90 безплатни аудиофайлове за "Algorithm"

00:00
00:31
This noise is white noise powered by itsself. So f. E. Random value 0. 63 will result in pow(0. 63, 0. 63). The algorithm for this noise was created two years ago by myself in c++, as an imitation of noise generators in supercollider 2.
Автор: Toine
00:00
01:29
This is one of 17 recordings made with the same patch. Same tempo, same scale, different outcome. I made this recordings for disquiet junto project 0377: algorithms assemble.
Автор: Gis Sweden
00:00
01:05
Wheel music. Music composed stochastically using an algorithm which is illustrated here:. Http://www. Coverpop. Com/wheelmusic/. As the wheel enters each quadrant, notes are selected from a different chord based on the positions of the dots.
Автор: Jbum
00:00
04:24
Part of a series. Used reaper's parameter modulation magic on aalto and recorded some of the fun. Could easily be chopped up for all sorts of sfx.
Автор: Cryanrautha
00:00
00:39
Create use from druidbloke's sound 'a-recreation-of-the-clasic-80s-orchestral-stab', change pitch use audacity but audacity's algorithm no great. Have 12 note from a7 to a8 (original sound is a7). 2020. 08. 18 15:00.
Автор: Sieuamthanh
00:00
00:40
Create use from druidbloke's sound 'a-recreation-of-the-clasic-80s-orchestral-stab', change pitch use audacity but audacity's algorithm no great. Have 12 note from a7 to a6 (original sound is a7). 2020. 08. 18 15:39.
Автор: Sieuamthanh
00:00
00:31
This kind of noise consists of a certain number of random values per second. This number is the density. In this example there are 10 random values per second. The algorithm for this noise was created two years ago by myself in c++, as an imitation of noise generators in supercollider 2.
Автор: Toine
00:00
01:01
I've decided to experiment with random frequencies slowly filling canvas and blending into a single timbre. For this piece they emerge with quite an amount of time and there is no distinct frequency to form a tone. This experimentation produces quite a hauinting sound consisting of small parts.
Автор: Wkalmar
00:00
00:31
This kind of noise randomly generates the values -1 or +1 at a given rate per second. This number is the frequency. In this example the frequency is 100 hz. The algorithm for this noise was created two years ago by myself in c++, as an imitation of noise generators in supercollider 2.
Автор: Toine
00:00
01:15
This is a raw sound-design sci-fi piece i made with a modular system using 4ms ensemble oscillator, mutable instruments clouds, strymon magneto & intellijel polaris.
Автор: Siliconesound
00:00
00:02
Synth strings through home-made combfilter (32 reason peq-2 two band parametric eqs in series). Samples originally made with reason & logic softsynths. 37 samples, in minor 3rds, looped in redmatica keymap's penrose loop algorithm, and squeezed into 16 mb!.
Автор: The Sample Workshop
00:00
00:01
A kick i created somewhere between 2012-2014. It belongs to a pack "harha's hardstyle kicks" and i don't have the interest to describe every kick in this pack separately. For pitching the bass part / tail up and down, i suggest using cool edit pro or adobe audition. Cubase pitching/timestretch algorithms are quite nice as well.
Автор: Harha
00:00
08:27
Hello World! is a piece of contemporary classical music for clarinet-violin-piano trio composed by Iamus Computer in September 2011. It is arguably the first full-scale work entirely composed by a computer without any human intervention and automatically written in a fully-fledged score using conventional musical notation.
Автор: Iamus (computer system)
00:00
00:02
This is the second part of an audio filtering project (in general, signal processing). This sample shows a noisy recording of my voice, after transforming the signal using the xft (extended fourier transform), applying a filter to cut some frequencies and later applying the inverse xft. All this done with an algorithm in matlab or mathematica written by me. Check the recording before the filtering process by hearing the file "holaoriginal. Wav" and please comment.
Автор: Blazeheatnix
00:00
00:02
Robotic voice effect using a en:vocoder. This effect is often found in film and television productions. For the technically minded, the voice is modulating a 110Hz en:sawtooth wave, which is the note A two octaves below en:A440. There is also some en:reverberation and phasing added. Note on playing this audio clip This audio clip is an en:Ogg Vorbis file. For a list of compatible media players, see the article at [1].
Автор: Ianmacm at English Wikipedia
00:00
00:08
A timbre (rendered with something akin paul naşca’s padsynth algorithm) which has partials of form m + n φ where φ is the golden ratio, and m, n are integers. Though not all the partials, just such a set that this all resembles a usual harmonic timbre. This sequence starts. 1. 000001. 618032. 618033. 618034. 236075. 236075. 854106. 854107. 854108. 47214. This sequence is of several powers of φ up and down from 440 hz (φ⁻² to φ⁵). Look at the spectra for a full dose of xen.
Автор: Arseniiv
00:00
13:41
Machine composed electronic music - or experimental generative atonalelectronic music made with an analog modular synth. Some results from two machine composition recording sessions. The modular is a machine. I compose the patch. The modular/machine composes the music. I don't want to call it auto composition, algorithmic compositionor generative. This is machine composition!. Track list1) känner igen2) form3) nästan 194) symetri5) växlingar. Https://www. Youtube. Com/watch?v=xhv0rkdjzg0.
Автор: Gis Sweden
00:00
00:05
Reconstructed sound get from http://freesound. Org/people/cbeeching/sounds/116913/. Author cbeeching. The parameters used in the analysis are: window-type = hamming; window-size = 1024; fft-size = 2048; magnitude-threshold = -90; minimum-duration-of-harmonic-tracks = 0. 01; maximum-number-of-harmonics = 100; minimum-fundamental-frequency = 50; maximum-fundamental-frequency = 250; maximum-error-in-f0-detection-algorithm = 7; max-frequency-deviation-in-harmonic-tracks = 0. 01; stochastic approximation-factor = 0. 2.
Автор: Manuelrsn
00:00
00:05
Stochastic part sound get from http://freesound. Org/people/cbeeching/sounds/116913/. Author cbeeching. The parameters used in the analysis are: window-type = hamming; window-size = 1024; fft-size = 2048; magnitude-threshold = -90; minimum-duration-of-harmonic-tracks = 0. 01; maximum-number-of-harmonics = 100; minimum-fundamental-frequency = 50; maximum-fundamental-frequency = 250; maximum-error-in-f0-detection-algorithm = 7; max-frequency-deviation-in-harmonic-tracks = 0. 01; stochastic approximation-factor = 0. 2.
Автор: Manuelrsn
00:00
00:05
Harmonic part sound get from http://freesound. Org/people/cbeeching/sounds/116913/. Author cbeeching. The parameters used in the analysis are: window-type = hamming; window-size = 1024; fft-size = 2048; magnitude-threshold = -90; minimum-duration-of-harmonic-tracks = 0. 01; maximum-number-of-harmonics = 100; minimum-fundamental-frequency = 50; maximum-fundamental-frequency = 250; maximum-error-in-f0-detection-algorithm = 7; max-frequency-deviation-in-harmonic-tracks = 0. 01; stochastic approximation-factor = 0. 2.
Автор: Manuelrsn
00:00
00:02
Resynthesized output obtained from the analysis of a sound of erhu : http://freesound. Org/people/ricemutt/sounds/23933/. This was done using the harmonic plus stochastic model implemented in the sms tools: http://mtg. Upf. Edu/technologies/sms. The parameters used for the analysis were:. - window: blackman- window size: 1601- fft size: 2048- magnitude threshold: -90- minimum duration of sinusoidal tracks: 0. 1- maximum number of harmonics: 20- minimum fundamental frequency: 100- maximum fundamental frequency: 2000- maximum error in f0 detection algorithm: 5- max frequency deviation in harmonic tracks: 10stochastic approximation factor: 0. 2.
Автор: Wantingchen
00:00
00:04
Harmonic component obtained from the analysis of a female speech sound: http://www. Freesound. Org/people/xserra/sounds/254374/. This was done using the harmonic plus stochastic model implemented in the sms tools: http://mtg. Upf. Edu/technologies/sms. The parameters used for the analysis were:. - window: blackman- window size: 2001- fft size: 2048- magnitude threshold: -100- minimum duration of sinusoidal tracks: 0. 05- maximum number of harmonics: 100- minimum fundamental frequency: 150- maximum fundamental frequency: 250- maximum error in f0 detection algorithm: 5- max frequency deviation in harmonic tracks: 0. 05stochastic approximation factor: 1.
Автор: Wantingchen
00:00
00:04
Residual signal obtained after subtracting the harmonics from a female speech sound: http://www. Freesound. Org/people/xserra/sounds/254374/. This was done using the harmonic plus residual model implemented in the sms tools: http://mtg. Upf. Edu/technologies/sms. The parameters used for the analysis were:. - window: blackman- window size: 2001- fft size: 2048- magnitude threshold: -100- minimum duration of sinusoidal tracks: 0. 05- maximum number of harmonics: 100- minimum fundamental frequency: 150- maximum fundamental frequency: 250- maximum error in f0 detection algorithm: 5- max frequency deviation in harmonic tracks: 0. 02.
Автор: Wantingchen
00:00
00:04
Harmonic sinusoidal output sound obtained by analysis and synthesis of veena concert sound (https://www. Freesound. Org/people/anjds/sounds/377315/ ) with harmonic plus stochastic model implemented in the sms-tools software package (http://github. Com/mtg/sms-tools)parameters used in analysis are :- window type = blackman, window size(m) = 1575, fft size(n) = 2048, magnitude threshold in db(t) = -100, minimum duration of harmonic tracks = 0. 01, maximum number of harmonics = 100, minimum fundamental frequency = 100, maximum fundamental frequency = 800, maximum error in f0 detection algorithm = 5, max frequency deviation in harmonic tracks = 0. 01,stochastic approximation factor = 0. 2.
Автор: Anjds
00:00
00:04
Harmonic plus stochastic resynthesis of the female speech sound: http://www. Freesound. Org/people/xserra/sounds/254374/. This was done using the harmonic plus stochastic model implemented in the sms tools: http://mtg. Upf. Edu/technologies/sms. The parameters used for the analysis were:. - window: blackman- window size: 2001- fft size: 2048- magnitude threshold: -100- minimum duration of sinusoidal tracks: 0. 05- maximum number of harmonics: 100- minimum fundamental frequency: 150- maximum fundamental frequency: 250- maximum error in f0 detection algorithm: 5- max frequency deviation in harmonic tracks: 0. 05stochastic approximation factor: 1.
Автор: Wantingchen
00:00
00:04
Residual output sound obtained by analysis and synthesis of sound speech-female. Wav (http://freesound. Org/people/xserra/sounds/317745/) with harmonic plus residual model implemented in the sms-tools software package (http://github. Com/mtg/sms-tools)parameters used in analysis are :- window type = blackman, window size(m) = 2019, fft size(n) = 2048, magnitude threshold in db(t) = -100, minimum duration of harmonic tracks = 0. 1, maximum number of harmonics = 100, minimum fundamental frequency = 80, maximum fundamental frequency = 300, maximum error in f0 detection algorithm = 5, max frequency deviation in harmonic tracks = 0. 01.
Автор: Anjds
00:00
00:04
Residual output sound obtained by analysis and synthesis of veena concert sound (https://www. Freesound. Org/people/anjds/sounds/377315/ ) with harmonic plus residual model implemented in the sms-tools software package (http://github. Com/mtg/sms-tools)parameters used in analysis are :- window type = blackman, window size(m) = 1575, fft size(n) = 2048, magnitude threshold in db(t) = -100, minimum duration of harmonic tracks = 0. 01, maximum number of harmonics = 100, minimum fundamental frequency = 100, maximum fundamental frequency = 800, maximum error in f0 detection algorithm = 5, max frequency deviation in harmonic tracks = 0. 01.
Автор: Anjds
00:00
00:05
Stochastic synthesis output sound obtained by analysis and synthesis of veena concert sound (https://www. Freesound. Org/people/anjds/sounds/377315/ ) with harmonic plus stochastic model implemented in the sms-tools software package (http://github. Com/mtg/sms-tools)parameters used in analysis are :- window type = blackman, window size(m) = 1575, fft size(n) = 2048, magnitude threshold in db(t) = -100, minimum duration of harmonic tracks = 0. 01, maximum number of harmonics = 100, minimum fundamental frequency = 100, maximum fundamental frequency = 800, maximum error in f0 detection algorithm = 5, max frequency deviation in harmonic tracks = 0. 01,stochastic approximation factor = 0. 2.
Автор: Anjds
00:00
00:02
Stochastic component obtained from the analysis of a sound of erhu : http://freesound. Org/people/ricemutt/sounds/23933/. This was done using the harmonic plus stochastic model implemented in the sms tools: http://mtg. Upf. Edu/technologies/sms. The parameters used for the analysis were:. - window: blackman- window size: 1601- fft size: 2048- magnitude threshold: -90- minimum duration of sinusoidal tracks: 0. 1- maximum number of harmonics: 20- minimum fundamental frequency: 100- maximum fundamental frequency: 2000- maximum error in f0 detection algorithm: 5- max frequency deviation in harmonic tracks: 10stochastic approximation factor: 0. 2.
Автор: Wantingchen
00:00
00:02
Harmonic component obtained from the analysis of a sound of erhu : http://freesound. Org/people/ricemutt/sounds/23933/. This was done using the harmonic plus stochastic model implemented in the sms tools: http://mtg. Upf. Edu/technologies/sms. The parameters used for the analysis were:. - window: blackman- window size: 1601- fft size: 2048- magnitude threshold: -90- minimum duration of sinusoidal tracks: 0. 1- maximum number of harmonics: 20- minimum fundamental frequency: 100- maximum fundamental frequency: 2000- maximum error in f0 detection algorithm: 5- max frequency deviation in harmonic tracks: 10stochastic approximation factor: 0. 2.
Автор: Wantingchen
00:00
00:04
Synthesis output sound obtained by analysis and synthesis of sound speech-female. Wav (http://freesound. Org/people/xserra/sounds/317745/) with harmonic plus stochastic model implemented in the sms-tools software package (http://github. Com/mtg/sms-tools)parameters used in analysis are :- window type = blackman, window size(m) = 2019, fft size(n) = 2048, magnitude threshold in db(t) = -100, minimum duration of harmonic tracks = 0. 1, maximum number of harmonics = 100, minimum fundamental frequency = 80, maximum fundamental frequency = 300, maximum error in f0 detection algorithm = 5, max frequency deviation in harmonic tracks = 0. 01,stochastic approximation factor = 0. 7.
Автор: Anjds
00:00
00:04
Synthesis output sound obtained by analysis and synthesis of veena concert sound (https://www. Freesound. Org/people/anjds/sounds/377315/ ) with harmonic plus stochastic model implemented in the sms-tools software package (http://github. Com/mtg/sms-tools)parameters used in analysis are :- window type = blackman, window size(m) = 1575, fft size(n) = 2048, magnitude threshold in db(t) = -100, minimum duration of harmonic tracks = 0. 01, maximum number of harmonics = 100, minimum fundamental frequency = 100, maximum fundamental frequency = 800, maximum error in f0 detection algorithm = 5, max frequency deviation in harmonic tracks = 0. 01,stochastic approximation factor = 0. 2.
Автор: Anjds
00:00
00:04
Stochastic synthesis output sound obtained by analysis and synthesis of sound speech-female. Wav (http://freesound. Org/people/xserra/sounds/317745/) with harmonic plus stochastic model implemented in the sms-tools software package (http://github. Com/mtg/sms-tools)parameters used in analysis are :- window type = blackman, window size(m) = 2019, fft size(n) = 2048, magnitude threshold in db(t) = -100, minimum duration of harmonic tracks = 0. 1, maximum number of harmonics = 100, minimum fundamental frequency = 80, maximum fundamental frequency = 300, maximum error in f0 detection algorithm = 5, max frequency deviation in harmonic tracks = 0. 01,stochastic approximation factor = 0. 7.
Автор: Anjds
00:00
00:04
Stochastic approximation of the residual signal obtained after subtracting the harmonics from a female speech sound: http://www. Freesound. Org/people/xserra/sounds/254374/. This was done using the harmonic plus stochastic model implemented in the sms tools: http://mtg. Upf. Edu/technologies/sms. The parameters used for the analysis were:. - window: blackman- window size: 2001- fft size: 2048- magnitude threshold: -100- minimum duration of sinusoidal tracks: 0. 05- maximum number of harmonics: 100- minimum fundamental frequency: 150- maximum fundamental frequency: 250- maximum error in f0 detection algorithm: 5- max frequency deviation in harmonic tracks: 0. 05stochastic approximation factor: 1.
Автор: Wantingchen
00:00
00:04
Harmonic sinusoidal output sound obtained by analysis and synthesis of sound speech-female. Wav (http://freesound. Org/people/xserra/sounds/317745/) with harmonic plus stochastic model implemented in the sms-tools software package (http://github. Com/mtg/sms-tools)parameters used in analysis are :- window type = blackman, window size(m) = 2019, fft size(n) = 2048, magnitude threshold in db(t) = -100, minimum duration of harmonic tracks = 0. 1, maximum number of harmonics = 100, minimum fundamental frequency = 80, maximum fundamental frequency = 300, maximum error in f0 detection algorithm = 5, max frequency deviation in harmonic tracks = 0. 01,stochastic approximation factor = 0. 7.
Автор: Anjds
00:00
00:02
Piano sound produced with fl studio 10 for the aspma course peer assesment 7 (part 2). Original sound from http://freesound. Org/people/hmartelb/sounds/328547/. This sound is the stochastic component of the hps model analysis using sms-tools. The parameters used in the analysis were:. Window-type = hamming;window-size = 3001;fft-size = 4096;magnitude-threshold = -120;minimum-duration-of-harmonic-tracks = 0. 1;maximum-number-of-harmonics = 200;minimum-fundamental-frequency = 80;maximum-fundamental-frequency = 280;maximum-error-in-f0-detection-algorithm = 5;max-frequency-deviation-in-harmonic-tracks = 0. 01;stochastic approximation-factor = 0. 05;.
Автор: Hmartelb
00:00
01:40
Sound create use fm synthesis and use 16 bit for high quality. Create sound use c program. Sample have different frequency (power 2) and length. Last several sample have wave frequency above nyquest limit 48000 hz/2 = 24000 hz. Some effect sound like effect in game strider hiryu (ストライダー飛竜) from capcom 1989 (robot gorilla in level siberia) and sonic hedgehog 1 from sega 1990 (sonic jump in large ring at level end if have more than 100 ring). Algorithm:• one carrier and modulate pair• modulate frequency 1. 4 of note (carrier frequency)• modulate amplitude (β) change from 0. 0 to 10. 0 across note• hill envelope with top at 0. 1 of note length.
Автор: Sieuamthanh
00:00
00:03
We develop iphone app that perform musical analysis on recorded audio from the iphone. Our app implementation make use of the audio queue service to receive raw audio buffers from the audio queue callback. In the first version of our app we had the problem of too much clipping on the recording which degrade the accuracy of our analysis. We also suspected that the noise canceling algorithm in iphone 5 produce distorted sound, which is not much noticeable by human ear but distorted enough to affect our sensitive algorithm. We found that the solution to our problem is to set the audio session mode to kaudiosessionmode_measurement. This session mode is supposed to give maximum freedom for us to control the microphone input, which include turning off the automatic gain control and probably noise canceling as well. The solution works very well except that it introduce a strange waveform pattern in the beginning of all recordings in iphone 5. It is very hard to explain the waveform we get, so i made two recordings at freesound so that you can see it visually. The first recording is made in an almost quite environment, and you can see the weird spike in the beginning of the recording. The second recording (this recording) is made with constant background noise, and you can see that the actual sound wave is offset from the strange curve and gradually increase to its original volume. This waveform only happens on iphone 5 devices that we tested, and there is no problem at all for iphone 4s and older generations. We have tried various settings and the glitch is still unavoidable as long as we set the audio session mode to kaudiosessionmode_measurement. We also find similar glitch in one of our iphone 5 devices, in which the glitch happens even if we try to set just the input gain level without changing the session mode. We are not sure if this is a hardware-related bug in iphone 5, or if it is fixable software glitch in the future version of ios. For the moment we are looking for workaround that can avoid this glitch while automatic gain control and noise canceling are disabled.
Автор: Soareschen
00:00
10:00
Made some adjustements and a new recording. Terrible result but fun work/programming!. Algorithmic drone music program. The computer is my analog modular synth. 01 to 08 are clock sequencer steps. 00 rem osc_1 - wave shaped sin oscillator (osc) - tuned to 130hz00 rem osc_2 - clean sin from oscillator - tuned to 130hz00 rem osc_3 - sqr from oscillator through filter - osc tuned to 130hz00 rem clk speed = 0. 5 hz00 rem line 01 each of the 3 vcas gets an unique cv value ([gate] -> [3 s/h] -> [3 vca])00 rem ---------------------------------------------------01 sample values for vca (cv in) x 3 (osc_1, osc_2, osc_3)02 sample frq for osc_103 sample frq for osc_204 sample new clk speed05 sample frq for vibrato in osc_106 sample frq for osc_307 env to all vca08 sample cv for (osc_3) filter10 goto 01. When i begin the recording the program has been running for a while.
Автор: Gis Sweden
00:00
00:01
Start sound of mac ii iix iicx iici se/30. Create by dissessemble rom code and use wave table algorithm write c program write wav file. C program below:. /* mac_ii. C *//* boot beep mac ii *//* 2558/09/06 */. #include. #define knumber_samples 30000#define kdelay_note 300#define kwave_table_value 0x30013f10#define ksample_rate 22257 // hz. Void preparewavetable( unsigned short *wavetable, unsigned int value );void updatewavetable( unsigned short *wavetable, unsigned short chiso );void savesound( char *filename, short *sounddata, unsigned int numberframes, unsigned int samplerate );. Int main () {. // ---- wave tableunsigned short wavetable[256];// ---- sound data, stereoshort sounddata[knumber_samples << 1];// ---- increment array (16/16 bit fix point integer)int arrayincrement[] = {3 << 16, 4 << 16, (3 << 16) + 0x2f2, 6 << 16};// ---- prepare wave tablepreparewavetable( wavetable, kwave_table_value );. // ---- array phase (16/16 bit fix point integer)unsigned int arrayphase[] = {0, 0, 0, 0}; // set all = 0. Unsigned int samplenumber = 0;while( samplenumber < knumber_samples ) {. // ---- calculate sampleunsigned int channelleft = 0;unsigned int channelright = 0;unsigned char notenumber = 0;while ( notenumber < 4 ) {// ---- see if should update phase for note, only do if play noteif( samplenumber >= notenumber*kdelay_note ) {// ---- up date phase beforearrayphase[notenumber] += arrayincrement[notenumber];// ---- not let out of range [0; 255]if( arrayphase[notenumber] > 0xff0000 ) // 0xff0000 == 255 << 16arrayphase[notenumber] -= 0xff0000; // return to begin of wave table}unsigned short mauvat = wavetable[arrayphase[notenumber] >> 16];. // ---- add sound componentsif( notenumber < 2 ) // ---- first 2 notes left channelchannelleft += mauvat;else // ---- last 2 notes right channelchannelright += mauvat;// ---- next notenotenumber++;}// ---- save left and right samplessounddata[samplenumber << 1] = (channelleft << 9) - 0x8000; // use << 1 for 16 bitsounddata[(samplenumber << 1) + 1] = (channelright << 9) - 0x8000; // use << 1 for 16 bitupdatewavetable( wavetable, samplenumber & 0xff );samplenumber++;}// ---- save wav filesavesound( "mac ii. Wav", sounddata, samplenumber << 1, ksample_rate ); // multiply 2 because stereo. Return 1;}. Void preparewavetable( unsigned short *wavetable, unsigned int value ) {. // ---- prepare wave tableunsigned short index = 0;unsigned short wavetablevalue = value & 0xff;while( index < 64 ) {wavetable[index] = wavetablevalue; // << 8; // for 16 bitindex++;}. Wavetablevalue = (value >> 8) & 0xff;while( index < 128 ) {wavetable[index] = wavetablevalue; // << 8; // for 16 bitindex++;}. Wavetablevalue = (value >> 16) & 0xff;while( index < 192 ) {wavetable[index] = wavetablevalue; // << 8; // for 16 bitindex++;}wavetablevalue = (value >> 24) & 0xff;while( index < 256 ) {wavetable[index] = wavetablevalue; // << 8; // for 16 bitindex++;}}. Void updatewavetable( unsigned short *wavetable, unsigned short index ) {// ---- get value from wave tableunsigned short value = wavetable[index];// ---- calculate new value for wave tableif( index == 255 ) { // careful at last element of wave tablevalue += wavetable[0];value = (value >> 1);wavetable[0] = value;}else {value += wavetable[index+1];value = (value >> 1);wavetable[index+1] = value;}. }. #pragma mark ---- save wavvoid saveheader( file *filename, unsigned int samplerate );void savesounddatainteger16bit( file *filename, short *sounddata, unsigned int numbersamples );. Void savesound( char *filename, short *sounddata, unsigned int numberframes, unsigned int samplerate ) {// ---- open filefile *file = fopen( filename, "wb" );if( file ) {// ---- "riff"fprintf( file, "riff" );// ---- length sound file - 8unsigned int lengthsoundfile = 32;lengthsoundfile += numberframes << 1; // một không có một mẫu vạt cho kênh trái và phải// ---- save file lengthfputc( (lengthsoundfile) & 0xff, file );fputc( (lengthsoundfile >> 8) & 0xff, file );fputc( (lengthsoundfile >> 16) & 0xff, file );fputc( (lengthsoundfile >> 24) & 0xff, file );// ---- "wave"fprintf( file, "wave" );// ---- save headersaveheader( file, samplerate );// ---- save sound datasavesounddatainteger16bit( file, sounddata, numberframes );// ---- close filefclose( file );}else {printf( "problem save file %s\n", filename );}}. Void saveheader( file *file, unsigned int samplerate ) {// ---- name for header "fmt "fprintf( file, "fmt " );// ---- header lengthfputc( 0x10, file ); // length 16 bytefputc( 0x00, file );fputc( 0x00, file );fputc( 0x00, file );// ---- method for encode, 16 bit pcmfputc( 0x01 & 0xff, file );fputc( (0x00 >> 8) & 0xff, file );// ---- number channels (stereo)fputc( 0x02, file );fputc( 0x00, file );// ---- sample rate (hz)fputc( samplerate & 0xff, file );fputc( (samplerate >> 8) & 0xff, file );fputc( (samplerate >> 16) & 0xff, file );fputc( (samplerate >> 24) & 0xff, file );// ---- number bytes/secondunsigned int numberbytessecond = samplerate << 2; // multiply 4 because short (2 byte) * 2 channelfputc( numberbytessecond & 0xff, file );fputc( (numberbytessecond >> 8) & 0xff, file );fputc( (numberbytessecond >> 16) & 0xff, file );fputc( (numberbytessecond >> 24) & 0xff, file );// ---- byte cho một khung (nên = số lượng mẫu vật * số lượng kênh)// ---- number bytes for sampleunsigned short bytesoneframe = 4; // short (2 byte) * 2 channelunsigned char bitsonesample = 16; // shortfputc( bytesoneframe & 0xff, file );fputc( (bytesoneframe >> 8) & 0xff, file );. Fputc( bitsonesample, file );fputc( 0x00, file );}. Void savesounddatainteger16bit( file *file, short *sounddata, unsigned int numbersamples ) {fprintf( file, "data" );unsigned int datalength = numbersamples << 1; // each sample 2 bytefputc( datalength & 0xff, file );fputc( (datalength >> 8) & 0xff, file );fputc( (datalength >> 16) & 0xff, file );fputc( (datalength >> 24) & 0xff, file );unsigned int sampleindex = 0;while( sampleindex < numbersamples ) {short shortdata = sounddata[sampleindex];fputc( shortdata & 0xff, file );fputc( (shortdata >> 8) & 0xff, file );sampleindex++;}}.
Автор: Sieuamthanh
51 - 90 z celkového počtu 90
/ 2