[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tape input to speaker



Simon Williams replied:

>Originally I was interested in just getting sound to travel from the
>input jack to the speaker, but apparently my lack of assembly skills
>are proving themselves, as I can only get the speaker to click once.

I'm a bit reluctant to try to compose a correct assembler program
at the keyboard without any opportunity to debug.  ;-)

But...here's the plan (pardon the spacing--proportional font ;-):

loop      lda cassin   ;Read the cassette input
          eor oldcass   ;Compare with previous state (hi bit)
          bpl nochange  ;Hi-bit off if no change
          sta oldcass   ;Save the new state
          sta spkr      ;Flip the speaker
          bmi loop      ;Branch always.

nochange  pha     ;Kill 7 cycles
          pla
          jmp loop

The timing here is designed to keep the loop repetition rate
constant whether there is a change in the cassette input or
not.  I've assumed that "oldcass" is on page zero, and the
period of the loop is 20 cycles, for a rep rate of 50kHz.

This will reproduce every zero crossing seen at the cassette
port at the speaker, for all input frequencies under 25kHz--
which ought to do the job very nicely (in fact, it's overkill).

If you wanted to save the sounds (record) and play them
back later, you could build two loops, with the record loop
shifting the high bit of the cassette port into an array of
bytes in memory, and the play loop shifting them out at
the same rate, and plinking the speaker whenever the
bit changed.  Of course, both loops must run at the same
rate for frequency fidelity, and the loop frequency should
be at least twice the highest frequency to be reproduced.

Remember, it's still a 1-bit A/D converter, so sound will
only contain the zero crossing information.  It will sound
"infinite clipped"--or like everything has gone through a
maximum fuzz box. 

>On a related matter: is it possible to load and save to tape under
>Prodos... I've tried it in DOS 3.3 (using my mac as a tape recorder)
>and it seems to work fine, albeit very slowly... using the SAVE and
>LOAD commands from Prodos just gives me SYNTAX ERROR -- is the pro-
>cedure different?

Never tried under ProDOS--it probably intercepts all LOAD and SAVE
commands and subjects them to ProDOS syntax checking.

-michael

Check out 8-bit Apple sound that will amaze you on my
Home page:  http://members.aol.com/MJMahon/