Differenze tra le versioni di "Estrarre informazioni da un file VOC con le sole risorse di Gambas"
Da Gambas-it.org - Wikipedia.
Riga 10: | Riga 10: | ||
Dim fl As File | Dim fl As File | ||
Dim bb As Byte[] | Dim bb As Byte[] | ||
+ | Dim i, n, conto As Integer | ||
voc = "<FONT Color=gray>''/percorso/del/file.voc''</font>" | voc = "<FONT Color=gray>''/percorso/del/file.voc''</font>" | ||
Riga 22: | Riga 23: | ||
Print "Versione del file 'voc': "; bb[&17]; "."; bb[&16] | Print "Versione del file 'voc': "; bb[&17]; "."; bb[&16] | ||
− | + | ||
− | + | i = Val("&" & Hex(bb[29], 2) & Hex(bb[28], 2) & Hex(bb[27], 2)) + 1 | |
+ | conto = i | ||
+ | n = 29 + conto | ||
+ | While bb[n] = &02 | ||
+ | i = Val("&" & Hex(bb[n + 3], 2) & Hex(bb[n + 2], 2) & Hex(bb[n + 1], 2)) | ||
+ | conto += i | ||
+ | n += i + 4 | ||
+ | Wend | ||
+ | Print "Dimensione dei dati audio: "; conto;; "byte" | ||
+ | |||
Print "Frequenza di campionamento: "; Fix(1000000 / (256 - bb[30]));; "hertz" | Print "Frequenza di campionamento: "; Fix(1000000 / (256 - bb[30]));; "hertz" | ||
Select Case bb[31] | Select Case bb[31] | ||
Riga 57: | Riga 67: | ||
* http://www.justindeltener.com/sound-programming/sound-blaster-16-tutorial/reading-the-creative-voc-sound-file-format/ | * http://www.justindeltener.com/sound-programming/sound-blaster-16-tutorial/reading-the-creative-voc-sound-file-format/ | ||
* https://github.com/fabiensanglard/libRealSpace/blob/master/doc/Creative%20Voice%20%28VOC%29%20file%20format | * https://github.com/fabiensanglard/libRealSpace/blob/master/doc/Creative%20Voice%20%28VOC%29%20file%20format | ||
− | |||
− | |||
− |
Versione attuale delle 16:46, 15 giu 2015
Il formato di file audio VOC è stato creato dalla Creative.
Esso è composto da un blocco di intestazione di 31 byte seguito da uno o più blocchi di dati. Tutti i valori interi sono in ordine dei byte di tipo Little Endian.
Mostriamo un semplice codice per estrarre alcune informazioni generali relative ad un file VOC:
Public Sub Main() Dim voc, codec As String Dim fl As File Dim bb As Byte[] Dim i, n, conto As Integer voc = "/percorso/del/file.voc" Print "File voc: "; voc fl = Open voc For Read With bb = New Byte[32] .Read(fl, 0, bb.Count) If .ToString(0, 19) <> "Creative Voice File" Then Error.Raise("Il file non è un file 'voc' !") End With Print "Versione del file 'voc': "; bb[&17]; "."; bb[&16] i = Val("&" & Hex(bb[29], 2) & Hex(bb[28], 2) & Hex(bb[27], 2)) + 1 conto = i n = 29 + conto While bb[n] = &02 i = Val("&" & Hex(bb[n + 3], 2) & Hex(bb[n + 2], 2) & Hex(bb[n + 1], 2)) conto += i n += i + 4 Wend Print "Dimensione dei dati audio: "; conto;; "byte" Print "Frequenza di campionamento: "; Fix(1000000 / (256 - bb[30]));; "hertz" Select Case bb[31] Case 0 codec = "8 bits unsigned PCM" Case 1 codec = "4 bits to 8 bits Creative ADPCM" Case 2 codec = "3 bits to 8 bits Creative ADPCM (2.6 bits)" Case 3 codec = "2 bits to 8 bits Creative ADPCM " Case 4 codec = "16 bits signed PCM " Case 6 codec = "alaw" Case 7 codec = "ulaw" Case &200 codec = "4 bits to 16 bits Creative ADPCM" End Select Print "Codec: "; codec fl.Close End
Riferimenti
- http://wiki.multimedia.cx/index.php?title=Creative_Voice
- http://www.lim.di.unimi.it/IEEE/VROS/FAQ/CRCREATV.HTM
- http://www.justindeltener.com/sound-programming/sound-blaster-16-tutorial/reading-the-creative-voc-sound-file-format/
- https://github.com/fabiensanglard/libRealSpace/blob/master/doc/Creative%20Voice%20%28VOC%29%20file%20format