From: Larry on 29 Dec 2009 23:21 "Larry" <dontmewithme(a)got.it> ha scritto nel messaggio news:4b3ac5ba$0$1112$4fafbaef(a)reader2.news.tin.it... > "Bob Masta" <N0Spam(a)daqarta.com> ha scritto nel messaggio > news:4b39fd1f.339630(a)news.eternal-september.org... > ok, so supposed I have a .wav file containg: > > 1) the first 44 bytes padded with zeroes (0x00) > 2) 100000 bytes of actual raw data > > what values should I set RIFF and DATA dwords? I have great difficulties understanding this: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ "(offset 4, size 4) ChunkSize: 36 + SubChunk2Size, or more precisely: 4 + (8 + SubChunk1Size) + (8 + SubChunk2Size) This is the size of the rest of the chunk following this number. This is the size of the entire file in bytes minus 8 bytes for the two fields not included in this count: ChunkID and ChunkSize." So it should basically be: 36 + SubChunk2Size Now, "(offset 40, size 4) Subchunk2Size == NumSamples * NumChannels * BitsPerSample/8 This is the number of bytes in the data. You can also think of this as the size of the read of the subchunk following this number." I don't really get that! Does it mean how long one single sample is, or the whole file? thanks
From: Larry on 30 Dec 2009 07:13 "Bob Masta" <N0Spam(a)daqarta.com> ha scritto nel messaggio news:4b39fd1f.339630(a)news.eternal-september.org... > As mentioned in my first post, you can fill in > everything but the RIFF and DATA sizes at the > start, since you know the sample rate, number of > bits, and mono/stereo already. All you need to do > at the end of the recording is fill in the sizes. > But it won't hurt to write the entire header at > that time. Also, Is there anyway to have mmioOpen() open a file with the APPEND flag and seek to the very start of it? thanks
From: Bob Masta on 30 Dec 2009 08:33 On Wed, 30 Dec 2009 05:21:40 +0100, "Larry" <dontmewithme(a)got.it> wrote: > >"Larry" <dontmewithme(a)got.it> ha scritto nel messaggio >news:4b3ac5ba$0$1112$4fafbaef(a)reader2.news.tin.it... >> "Bob Masta" <N0Spam(a)daqarta.com> ha scritto nel messaggio >> news:4b39fd1f.339630(a)news.eternal-september.org... > >> ok, so supposed I have a .wav file containg: >> >> 1) the first 44 bytes padded with zeroes (0x00) >> 2) 100000 bytes of actual raw data >> >> what values should I set RIFF and DATA dwords? >I have great difficulties understanding this: >https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ >"(offset 4, size 4) ChunkSize: 36 + SubChunk2Size, or more precisely: 4 + (8 >+ SubChunk1Size) + (8 + SubChunk2Size) This is the size of the rest of the >chunk following this number. This is the size of the entire file in bytes >minus 8 bytes for the two fields not included in this count: ChunkID and >ChunkSize." > >So it should basically be: 36 + SubChunk2Size > >Now, > >"(offset 40, size 4) Subchunk2Size == NumSamples * NumChannels * >BitsPerSample/8 This is the number of bytes in the data. You can also think >of this as the size of the read of the subchunk following this number." > >I don't really get that! > >Does it mean how long one single sample is, or the whole file? > >thanks Think about the 'data' subchunk size first, before 'RIFF'. The explanation makes it clear that this is the size of the entire data by giving that little formula. So in your case it would be 100000. Then the 'RIFF' chunk size is (as they say in words) the size of everything after that, which includes the data plus all the header stuff. So add up all the header bytes after the RIFF size dword, (36 total, as you note above) and then add 100000 to that for the data. I've never used MMIO and never understood why I'd want to. But that's probably just me... <g> Best regards, Bob Masta DAQARTA v5.00 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, FREE Signal Generator Pitch Track, Pitch-to-MIDI DaqMusic - FREE MUSIC, Forever! (Some assembly required) Science (and fun!) with your sound card!
From: Larry on 30 Dec 2009 19:17 "Bob Masta" <N0Spam(a)daqarta.com> ha scritto nel messaggio news:4b3b52c4.494290(a)news.eternal-september.org... > Think about the 'data' subchunk size first, before > 'RIFF'. The explanation makes it clear that this > is the size of the entire data by giving that > little formula. So in your case it would be > 100000. > > Then the 'RIFF' chunk size is (as they say in > words) the size of everything after that, which > includes the data plus all the header stuff. So > add up all the header bytes after the RIFF size > dword, (36 total, as you note above) and then add > 100000 to that for the data. the app finally works!!!!!!! the whole source code is avaible here: http://theartofweb.net/cpp/waveform_recorder_07.txt I'd like to record MONO at 16bit 44,1KHZ, so I passed 3 buffers of 65535 Bytes each to the waveInPrepareHeader() and waveInAddBuffer() functions...well sometimes I still get some choppies in the audio when I playback...I have to founf a good buffer size! without having too much delay as well... thanks
From: ScottMcP [MVP] on 30 Dec 2009 23:31 On Dec 30, 7:17 pm, "Larry" <dontmewit...(a)got.it> wrote: > I'd like to record MONO at 16bit 44,1KHZ, so I passed 3 buffers of 65535 > Bytes each to the waveInPrepareHeader() and waveInAddBuffer() > functions...well sometimes I still get some choppies in the audio when I > playback...I have to founf a good buffer size! without having too much delay > as well... > > thanks That's an "odd" buffer size choose. Make the buffer an even number of bytes. After all, you are recording 2 bytes per sample. Congratulations on getting it working.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: CreateEvent / WaveForm API Next: Assembly code with Borland's C compiler |