Software SOX: Question about


FBnil

They'll own everything and be miserable.
Joined
Dec 14, 2012
Messages
5,118
Location
Yurp
SoX (Sound eXchange; it's in the Pandora Repo) can do a lot of things, for example:

When you run it it drops you in a shell, from there, you must first export some environment variables:

Code:
export LD_LIBRARY_PATH=`pwd`/lib
export PATH=$PATH:`pwd`/bin
export SOX_OPTS="--buffer 4096 -q"

Now try to pluck a sound:
Code:
bin/play -n synth 4 pluck E2

From there, you can make the Pandora help finetune your guitar:

Code:
 for n in E2 A2 D3 G3 B3 E4; do
     play -n synth 4 pluck $n repeat 2; done

Or create telephone sounds:
Code:
alias pause='play -n trim 0.0 0.1 remix - ' # North American Off Hook Signal Gap
pause # I need this because the pandora is silent on the first command!
play -n synth 0.1 sin 697 sin 1209 remix -  # Keypad 1 Signal
play -n synth 0.1 sin 697 sin 1336 remix -  # Keypad 2 Signal

play -n synth 0.1 sin 697 sin 1477 remix -  # Keypad 3 Signal
play -n synth 0.1 sin 697 sin 1633 remix -  # Keypad A Signal
play -n synth 0.1 sin 770 sin 1209 remix -  # Keypad 4 Signal
play -n synth 0.1 sin 770 sin 1336 remix -  # Keypad 5 Signal
play -n synth 0.1 sin 770 sin 1477 remix -  # Keypad 6 Signal
play -n synth 0.1 sin 770 sin 1633 remix -  # Keypad B Signal
play -n synth 0.1 sin 852 sin 1209 remix -  # Keypad 7 Signal
play -n synth 0.1 sin 852 sin 1336 remix -  # Keypad 8 Signal
play -n synth 0.1 sin 852 sin 1477 remix -  # Keypad 9 Signal
play -n synth 0.1 sin 852 sin 1633 remix -  # Keypad C Signal
play -n synth 0.1 sin 941 sin 1209 remix -  # Keypad * Signal
play -n synth 0.1 sin 941 sin 1336 remix -  # Keypad 0 Signal
play -n synth 0.1 sin 941 sin 1477 remix -  # Keypad # Signal
play -n synth 0.1 sin 941 sin 1633 remix -  # Keypad D Signal

possibly appending a sequence into a wav, then play the wav.


However, I'm trying to reverse it: I get a sound in the microphone, and I want the corresponding letter. In a way, I need some information about how Commodore and spectrum transformed a tape audio into bytes.

So far, I learned that the Goertzel_algorithm is faster than FFT (Fast Fourier Transforms) and there seems to be code available but nothing I can work with at the moment . Does anybody have a shortcut into that? Can SoX do it with FIR or Hilbert commands?
 
I think there was a computerphile about how the C64 encodes and decodes audio. It's two tones, one for 0 bit, the other for the 1 bit. I'm not sure how it measures it, but I guess it's based on rising edges (it's all square wave, at least at origin). You wouldn't be doing anything as complicated as FFTs in those days and ages. Even using a PLL or something and checking the two frequencies is likely to take longer to sync than just measuring rising edge timing; you probably need only two or three cycles to do that.

Here it is:
 
Back
Top