Page 1 of 1

PostPosted: Tue Dec 12, 2000 1:40 pm
by wittchow

I am trying to code an audio editor / synthesis tool in pocket c. Wave form calculation works fine yet, but sound playback / writing wav files makes difficulties:
The wave()-function does not allow to write data to a playing (looped) wave, so this function can't be used as audio buffer. A workaround for this could be two files playing alternating, writing only to the one not currently playing. But then wave() would have to be included in the main loop which means bad timing.
Finally every wave starts/ends with an awful click, even when looped.

An other problem is how to write wav files quickly:
The wave form to write is held in an array of ints or chars. Writing an array to a file with a loop of writechar() takes rather long. Since wav data are 16-bit they can also be stored as string and be written with one writechars() command. This is much faster, but converting an array to a string with a loop of strsetc() is just as slow as the loop of writechar().
Is there any way to write an array of chars to a file or to convert the array to a string with only one command?

Thank you

Oliver Wittchow