|
|
This is pretty simple stuff (hardcoded path etc), but may be useful: It converts a 8bit unsigned Mono raw sample to C array code.
I use CoolEdit 2000 (http://www.syntrillium.com/) to do the sound recording and conversion. A very cool program and shareware to boot.
Private Sub Form_Load() Dim ifile As Integer Dim s As String Dim b As Byte Dim l As Long Dim lLen As Long Dim sOut As String ifile = FreeFile Open "d:\lego\qc\andy\rcx.raw" For Binary As ifile
Do Until EOF(ifile) Get ifile, , b 'change to 8 sound levels offset from 127 If b >= 128 Then b = (b - 128) \ 8 Else b = (127 - b) \ 8 End If l = l + 1 If l Mod 2 = 1 Then s = s & "0x" & Hex$(b) Else s = s & Hex$(b) & "," End If If l = 32 Then sOut = sOut & s & vbCrLf s = "" l = 0 End If lLen = lLen + 1 Loop Close ifile
'copy results to clipboard ready to paste '(dont forget: check the last byte and remove the final comma) Clipboard.Clear Clipboard.SetText sOut MsgBox lLen End Sub
|
|