Hello.I need to merge several sound files into one. Assume that all files have the same format. I read this topic and want to use code written by infratec. Here is a non-working example(very dirty), but it shows what I want to do (based on code by infratec):

CELTIC88, thanks a lot!!!It does. Tested with 16-bit wav-files. With 24-bit sample - not work (don't need, only for info). Comment in structure //Should be 16 for PCM.If I need merge much than two files, then for each of files need declare new copy of wavfileheader-structure?For example, I have directory contains about 50-files. Enumerate files - not a problem, but I want create one big file (database of sounds). This file must have only one wave-header. But... I also want to create list-file(during create database-file) with follow description(bias from beginning of database-file and size of data/raw). In the end, I need to create a sentence from some words (using data from list-file). Please, comment my question about new copy of wavfileheader-structure for each of files.Until you answered I looked ffmpeg for this task.Your version is better than additional dlls of ffmpeg.Thanks again.

Hi, CELTIC88Very glad to hear you again. Sorry for my stupid previous question and post without code. Today I was busy a whole time. Without access to PC and Internet. But today I have a fresh brain and eyes. And I have some idea how to do this. I'll try to write this, and you'll check, okay? I can not say exactly what it will be today. Please wait.

Hi, CELTIC88Very glad to hear you again. Sorry for my stupid previous question and post without code. Today I was busy a whole time. Without access to PC and Internet. But today I have a fresh brain and eyes. Many people have this issue, where they need a fresh day to start over. And I have seen some information here which shows how to do it and how to deal with all the problems. So, I think it should be doable. I have some idea how to do this. I'll try to write this, and you'll check, okay? I can not say exactly what it will be today. Please wait.

hello,

are you going to post it today?

Last edited by tatne on Fri Aug 24, 2018 7:28 pm, edited 1 time in total.

What's your goal with it ?If it's for your own personal use and it is working, it is fine.If you want others to use it as well, you should do it differently and scan all chunks until you have found both the 'fmt ' and 'data' chunks.

I already have a parser program for meteorological telegrams. Now I want to voice this program (without use SAPI). Like this or this.

Quote:

If it's for your own personal use...

This is for personal use (one side), because no one will change the once created database of sounds (otherwise everything will be corrupted). However, a few people will use final vesion of program (another side).

wilbert, in other words, you suggest keeping a directory containing 100-200 separate wav-files and playback them sequentially? It seemed to me that it would be better to create one output-file and send it to Windows Media Player. Anyway, thanks for advice.

wilbert, in other words, you suggest keeping a directory containing 100-200 separate wav-files and playback them sequentially? It seemed to me that it would be better to create one output-file and send it to Windows Media Player. Anyway, thanks for advice.

No, that's not what I'm suggesting.Combining all those files into one SoundsDB is a good idea

What I'm suggesting is that if you need to create a sentence from samples 5, 8, 2 and 7, you allocate memory for the total raw bytes and header.You copy the header and raw bytes of those samples to the allocated memory, use CatchSound to catch the wav from memory and PlaySound to play it back.I was assuming you would use PlaySound to play back the sentence.But you are talking about sending it to Windows Media Player. If you play it back using an external application my suggestion of course won't work. In that case you need to create a wav file like you were already doing.

Yes.reason: result wav-file will take up a lot of space in memory. I afraid that program will crashed. Even if we assume that the memory will be free after merge all fragments(catchsound) and playback(PlaySound -> FreeSound) or after export to disk(whole immediately). So I chose way write file to disk "step by step" ("byte by byte").