34

My ZX Spectrum 48k seems very resistant to working with audio input. I no longer have any cassette players, so am relying on audio files from digital players. I have been able to save and verify a tiny BASIC program to a digital recorder, but getting the right volume to save files from playtzx or OTLA is eluding me.

Things I've tried:

  • TeeZiX - TZX/TAP player on my phone
  • Many different audio cables, mono, stereo and TRRS
  • Edirol R-1 digital recorder/player (this is the one I got the save and verify to work on, and it has good input/output volume control)
  • a Sandisk Sansa player running Rockbox
  • an 800 Hz square wave tone at 0 dB to see if I could trigger the record level and make the screen border flicker. (summary: nope)
  • Audio files from tape2wav/PlayTZX and otla (via wine).

What else should I try?

  • You are using the EAR input on your Spectrum, aren't you? – mcleod_ideafix Jun 7 '16 at 15:30
  • Yes, but thanks for asking. The Sinclair's EAR ↔ EAR and MIC ↔ MIC (but never both at the same time) is different from RX ↔ TX I typically do with null modems. – scruss Jun 7 '16 at 16:21
  • Try using DivIDE device -- while not a sound player, it effectively emulates tape loading calls and makes loading faaast. – lvd Mar 27 '17 at 11:07
  • But it's not an audio solution, @lvd — and that's what I was asking about. I have a Retroleum SMART card that does fast loading of snapshots – scruss Mar 27 '17 at 14:39
  • 2
    Newest developments: TZX Duino and Arduitape (Google for them) are Arduino-based devices that can play TZX files as audio into the Spectrum. They are kind of new in summer 2017. – tofro Jun 28 '17 at 6:27
40

If (and only if) your audio player is battery powered, and your Spectrum is the 48K or 128K toastrack model, try the following procedure, intended to boost the volume of your wave signal, as seen by the Spectrum EAR circuitry:

  • Get one of these audio cables. They are very common. And yes, they are stereo.

enter image description here

Why do we need it to be stereo? The trick is that both channels from the 3.5'' stereo plug will make contact inside the Spectrum jack this way:

enter image description here

So when you use it to load from a digital audio player, that will normally output the same level in both channels, you won't hear (or load) anything.

Then what? Just invert one of the channels so the voltage level of one channel, reffered to the other channel, will appear to be double the value of any of both channel reffered to ground (which won't be connected at all in our setup)

If the TAP/TZX conversion program allows this inversion, use it. If not, you can use an editor program like Audacity to perform the inversion. Here is how:

First, load your generated WAV into Audacity. The generated WAV should be stereo, but if not, it doesn't matter. We can clone one channel to the other one to make it stereo.

enter image description here

Use the magnifier tool inside the wave window to amgnify it to the point you can clearly see both waves, that initially will look the same.

enter image description here

Now click on the wav name tab and select "Split stereo track"

enter image description here

Now we have the left and right channels in different tracks, so we can manipulate each one independently.

Change to the select tool (above the magnifier tool) and click the second track (the one below the other) as near as possible to the beginning of it. Press Home to bring the selection mark to the very beginning of the track. From the menu, select Edit -> Select -> Cursor to Track End so the whole track is selected.

enter image description here

With that selection active, select Effect -> Invert

enter image description here

Now we have two independent tracks, one of them with an inverted version of the sound of the other one.

enter image description here

Now select both tracks: press Shift and click on both tracks (the region where the properties of each track are displayed). Then, click on the name of any of them and select "Make stereo track"

enter image description here

The final result should be a stereo track with one channel inverted.

enter image description here

Save this wave as PCM stereo track by choosing File -> Export

enter image description here

And then, WAV

enter image description here

Copy it to your digital audio player and use the stereo cable as described to play the resulting sound. Don't be surprised if you need to lower the volume in order to get it loaded.

For example, in order to load this Bruce Lee example with a Samsung Onyx, I had to do it using the MIC input on the Spectrum, as the EAR input was too loud to be usable.

enter image description here

  • 4
    Somewhat to my surprise, that worked rather well. Thank you! I'll add a sox script to this page to do the same as your very well explained Audacity method. – scruss Jun 7 '16 at 21:30
  • 2
    What a fantastic answer. Both in terms of the actual answer, and in terms of the effort you made to present and explain the answer. Awesome work! – robsoft Jul 28 '16 at 20:39
  • 4
    Why "IF YOUR AUDIO PLAYER IS BATTERY POWERED ONLY"??? Thanks – Sewa Mar 23 '17 at 3:43
  • 2
    If the audio player and the computer share a common ground — as they would if they were mains powered — there would no longer be the differential voltage range of +0 → +2×Vₛ. – scruss Mar 23 '17 at 12:52
  • 2
    What is the purpose of all this? To effectively double the volume without adding distortion? In other words, why would a tape player work while an audio player wouldn't? – snips-n-snails Mar 24 '17 at 0:00
17

I've confirmed that mcleod_ideafix's method is reliable for regular tape images. Here is a shell script to do (effectively) the same thing:

#!/bin/bash
# wav2differential.sh - convert mono game tape audio to 2× stereo
# usage:   wav2differential.sh infile.wav
#          (creates  infile-differential.wav)
# scruss - 2016-06-07
# method by ‘mcleod_ideafix’; many thanks / greetz
#   — https://retrocomputing.stackexchange.com/a/774/439

base="${1%.wav}"
sox -q --norm=-3 "$1" -b 16 "${base}-n.wav"
sox -q  "${base}-n.wav" "${base}-ni.wav" vol -1.0
sox -q  --norm=-0.1 -M -c 1 "${base}-n.wav" -c 1 "${base}-ni.wav" "${base}-differential.wav"
rm -f  "${base}-n.wav" "${base}-ni.wav"

Ultimately I'd like to encode these as MP3s, tag them properly, and add loading screens as cover art. But that can come later.

What this script does — for people who might want to port it to systems without the Bash shell. Assume the script has been called with an argument game.wav, a mono audio file of the game loader:

  1. set the variable base to the value game; that is, the base name of the file argument, stripped of its file extension. I'll assume that the variable has been substituted from here on

  2. create a temporary mono audio file game-n.wav from game.wav with the volume set to -3 dB (--norm=-3) with 16-bit samples (-b 16)

  3. create a temporary mono audio file game-ni.wav from game-n.wav with the samples inverted (vol -1.0)

  4. merge (-M) the two mono temporary files game-n.wav and game-ni.wav into a stereo output file game-differential.wav, correcting the peak volume to be -0.1 dB, or just below clipping (--norm=-0.1)

  5. remove the temporary files game-n.wav and game-ni.wav

The -q sox option I used throughout is just to make sox quiet: it tends to create lots of text output that you don't really need.

  • 7
    For MP3, encode them as stereo (not joint stereo) and 128 kbps or more. – mcleod_ideafix Jun 8 '16 at 17:06
  • Dear @scruss can you give me more details (if and) how can I use this script in Windows? (I have SOX installed of course). Thanx – PanosPlat Nov 20 '17 at 9:19
  • 1
    Sorry, @PanosPlat, I don't know anything about Windows scripting, but I'll add something to my answer so you can see what it does to port it – scruss Nov 20 '17 at 13:43
  • Thank you very much @scruss! If I achieve anything, I ll post it here. – PanosPlat Nov 21 '17 at 9:39
0

I also had problems getting my PC to work with OTLA on my 48+ model. What I did was play the .wav file through Video Lan Player (VLC) on full blast (125%) and it worked!

I used a stereo to split channel lead using phono to jack adaptors (basically green line in to red/white phono audio connections). I'm sure there's an easier way but this is the way that worked for me.

  • Welcome to Retro SE! Why did you decide to physically split the cable? Couldn't you simply mute one channel in VLC to achieve the same effect? – nabulator Jul 22 '18 at 4:09
  • By the way, 125% isn't full, so you might get some distortion (floating point rounding errors, clipping) if you do that. Probably nothing that a system / emulated system wouldn't be able to deal with, but still... – wizzwizz4 Jul 22 '18 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.