MAMEWorld >> Programming
View all threads Index   Flat Mode Flat  

italieAdministrator
MAME owes italie many thank yous, hah
Reged: 09/20/03
Posts: 15246
Loc: BoomTown
Send PM
awesome, I'll have a deeper look at this over the weekend. <nt>
09/05/08 03:23 PM


> Here's a little application I whipped up to process those .wav files mentioned in
> this thread:
>
> http://www.mameworld.info/ubbthreads/sho...amp;o=&vc=1
>
> Attached is a .zip file with the VB6 .exe and source code. You many need the VB6
> runtime .dll, if you don't already have it, in order to run the .exe without
> compiling. (see if Google can help you find it).
>
> This particular program isn't particularly user friendly, sort of a "first stab" at
> the problem.
>
>
> Overview on how it works:
>
> A valid .wav path/filename is entered into the upper left text box. Double-click the
> textbox to pre-process the file. A percent completed figure will appear on the title
> bar. It will take a few seconds to a couple of minutes depending on the length of the
> file.
>
> The preprocessing upsamples the data (linear interpolation) by 4x. This makes it a
> little easier to deal with the jitter encountered in the main processing stage. The
> routine that does this is named "ovrSamp". It also converts 16 bit data to 8 bit
> data, if necessary.
>
> Next, press the "see" button to see the beginning of the sample on a sample editor
> type layout. It, (and some of the other controls) can be pressed while the
> pre-processing is still occurring, but don't overdo it.
>
> I didn't bother to make the graphics persistent on this app, so just click the "see"
> button to refresh the data view if it gets cleared by another overlapping app.
>
> If things are working out, there should be a green squarewave appearing beneath the
> black sample wave. Click the mouse once on the vertical green line above the first
> number on the left under the green squarewave. A number will appear just to the right
> of the "sho" button in the middle.
>
> Double click on this number and it will appear in the text box to the left of the
> "proc" button. Then press the "proc" button to process the file.
>
> The process will take a few minutes. A percent complete figure will appear on the
> title bar of the app. When it is done, click the "sho" button.
>
> The routine that does the dirty work is named "proc". Here is the core loop of it:
>
> For i = st To UBound(a)
> lb = b: b = a(i): If b >= 128 Then b = 255 Else b = 0
> If (lb = 0) And (b = 255) Then ' this detects zero crossings
> lc = c: c = i - ld: ld = i ' and measures how long ago the last one occurred
> If c < cu Then c = cn Else c = cm ' this sets a threshold for hi/low periods
> If (lc c) And (Round(CSng(i - lld) / rate1) > 0) Then
> ch = "0": If c < cu Then ch = "1" ' this sets whether to record a mark/space
> res = res & String(Round(CSng(i - lld) / rate1), ch) ' adds string to result
> lld = i
> End If
> End If
> If (i And 1023) = 0 Then Form1.Caption = Round(100# * i / UBound(a)): DoEvents
> Next
>
> After pressing the "sho" button (it's a toggle), a text box appears with the binary
> data. Click the "frm10" button on the far right. The idea here is to delete the first
> few characters until the first three characters are "110", and then click the "frm10"
> button as needed while continuing to edit. Add or remove characters as needed to keep
> the "110" columns in line. If the recording was good, it should only take a few key
> edits to line things up. If you find a spot with 5 to 8 "1"s in a row, and the format
> is messed up at that point, add more "1" characters at that spot until the columns
> match up again.
>
> Simplified example:
> before:
>
> 0010100011010000001101100000110110100011000000101101101000110010010011010000001101011000110101
>
> after first "frm10":
>
> 001010001101000000110110000011
> 011010001100000010110110100011
> 001001001101000000110101100011
> 0101
>
> after removing chars before first "110" pattern:
>
> 1101000000110110000011
> 011010001100000010110110100011
> 001001001101000000110101100011
> 0101
>
> after 2nd "frm10"
>
> 110100000011011000001101101000
> 110000001011011010001100100100
> 11010000001101011000110101
> After double-checking everything lines up (and maybe selecting all and copying to the
> clipboard), press the "2nd" button to see the plaintext.
>
> The routine that maps the binary to ascii is named "proc2". It decodes each binary
> pattern into a code number, and that number references a specific character in the
> ascii map (map reproduced from the 2513N spec. sheet).
>
> If there is significant garbling, paste the contents of the clipboard (if you saved
> to it) and check the columns again. If you didn't save, press the "proc" button again
> and wait for the binary data to be re-created.
>
> What the rest of the controls do:
> "" move the viewing point of the sample up and down by the amount of the current
> width of the form. By default, just the green squarewave appears (to save time). To
> see the waveform automaticly, ensure the checkbox named "autosee" is checked.
>
> To zoom in on the waveform, change the number in the first text box to the right of
> the "autosee" checkbox. Click he "see" button after changing the number. "16" means
> compress by 16 samples to one pixel. This number can be a fraction (like "2.333"), if
> desired.
>
> The other buttons allow for some crude editing of the waveform. Only the in-memory
> waveform is edited, the file on the disk is not affected. To paste a burst of 4800 hz
> data, click somewhere on the form (around the middle, for example), then click a
> second time a short distance to the left. Then click the "48" button, then click the
> "see" button. The results should be obvious. To reset any modifications to the
> in-memory waveform, doubleclick the filename textbox to re-pre-process it (and wait
> for a few moments for it to finish, then press the "see" button again).
>
> Most of the controls have tool-tip reminders for their functions.







Entire thread
Subject Posted by Posted on
* Little app to decode triva tape data mw 08/20/08 02:00 AM
. * awesome, I'll have a deeper look at this over the weekend. <nt> italieAdministrator  09/05/08 03:23 PM

Extra information Permissions
Moderator:  Pi 
0 registered and 72 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 2936