[問題] wav adpcm格式

看板C_and_CPP (C/C++)作者 (哈哈哈)時間14年前 (2011/12/29 02:48), 編輯推噓0(004)
留言4則, 2人參與, 最新討論串1/1
WAV檔的格式: 起始點 大小 輸出 ----------------------------------------------------------- 0 4 bytes "RIFF" 4 4 bytes <File length - 8> 8 4 bytes "WAVE" 12 4 bytes "fmt " 16 4 bytes <Length of the fmt data> // (=16) 20 2 bytes <WAVE File Encoding Tag> 22 2 bytes <Channels> // Channels: 1 = mono, 2 = stereo 24 4 bytes <Sample rate> // Samples per second: e.g., 44100 28 4 bytes <bytes/second> // sample rate * block align 32 2 bytes <block align> // channels * bits/sample / 8 34 2 bytes <bits/sample> // 8 or 16 36 4 bytes "data" 40 4 bytes <Sample data size(n)> 44 (n)bytes <Sample data> ------------------------------------------------------------ 所以我要讀位置22的 Channels 不是應該int Channels fseek(f,0x22,SEEK_SET); fread(&nChannels,2,1,f); cout<< Cannels <<'\n'; 然後就可以跑出我要的Channels數,但 正確的寫法卻是 fseek(f,0x16,SEEK_SET); fread(&nChannels,2,1,f); cout<< Cannels <<'\n'; 我的疑問是:1.怎麼是0x16而不是0x22, 怎麼會差六個BYTE呢??? 2.若要讀取sample data: int data=0; fseek(f,0x44,SEEK_SET); fread(&data,2,1,f); cout<< data <<'\n'; 執行出來卻是 0 ?????? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.37.18.48

12/29 02:52, , 1F
大概是因為你看的那份文件, 起始點欄的數字標的是10進位
12/29 02:52, 1F

12/29 02:53, , 2F
原來如此ˇˇ
12/29 02:53, 2F

12/29 02:54, , 3F
0x16即10進位的22; 也可以對一下每行起始點+size....:)
12/29 02:54, 3F

12/29 02:56, , 4F
瞭解 感謝〞_〝
12/29 02:56, 4F
※ 編輯: wowrz 來自: 114.37.18.48 (12/29 04:22)
文章代碼(AID): #1E-sI8uw (C_and_CPP)
文章代碼(AID): #1E-sI8uw (C_and_CPP)