c# - BASS.NET - Create wave file from a StreamFX -


i have stream file bass_streamcreatefile, , create resampling stream channel bass_fx_tempocreate.

i change pitch , tempo of stream, works , sounds fine when call bass_channelplay.

however, when attempt use wavewriter generate modified audio file, plays in short bursts lot of static. in addition, length of file around 2 hours , file size 6 gb.

here loadfile code:

private void openmenu_click(object sender, eventargs e) {     openfiledialog open = new openfiledialog();     if (open.showdialog() == dialogresult.ok)     {         path = open.filename;         if (init)         {             stream = bass.bass_streamcreatefile(path, 0l, 0l, bassflag.bass_stream_decode | bassflag.bass_sample_float);             fx = bassfx.bass_fx_tempocreate(stream, bassflag.bass_fx_freesource);             bass.bass_channelsetattribute(fx, bassattribute.bass_attrib_tempo, temposhift);             bass.bass_channelsetattribute(fx, bassattribute.bass_attrib_tempo_pitch, pitchshift / 100 * 12);             console.writeline(fx + " | " + path);         }     } } 

and here save code:

private void savemenu_click(object sender, eventargs e) {     savefiledialog save = new savefiledialog();     save.filter = "music file | *.wav";     if(save.showdialog() == dialogresult.ok)     {         string savepath = save.filename;         if (init)         {             wavewriter ww = new wavewriter(savepath, fx, 32, true);             float[] data = new float[32768];             bass.bass_channelplay(fx, false);             while (bass.bass_channelisactive(fx) == bassactive.bass_active_playing)             {                 int length = bass.bass_channelgetdata(fx, data, 32768);                 if (length > 0)                     ww.write(data, length);             }              console.writeline(savepath + " | " + ww.filename);             ww.close();             bass.bass_streamfree(fx);         }     } } 

how create proper audio file, sounds should (faster version of imported sound file)?


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -