Sample to BEEP in the olden days

On the creation of AY or Beeper music, including the packages used to do so.
Post Reply
User avatar
R-Tape
Site Admin
Posts: 6409
Joined: Thu Nov 09, 2017 11:46 am

Sample to BEEP in the olden days

Post by R-Tape »

The SC page for Pippo links to this interview with the author, in which he says that the blood curdling scream was a sample of his own voice. It doesn't give any more detail beyond:
"I recorded that myself," chuckles Giovanni, "by shouting into my old-style cassette player. One day my mother had some friends downstairs and they could all hear me shouting 'arrrgggh arrgggh'. She said to her friends: 'Giovanni, he is a good boy, but from time to time he needs to let off steam!'"
How would he have converted his recording into data for the sound in ~1986? I've ripped the player and data here if anyone's interested (a zipped snapshot, and ASM). The player is tiny, just a pause loop and an OUT loop, but the data is 6K. Even still the scream is so good that it's well worth it.

The same question goes for anything back then, like the "Yippeee!" in Splat!
User avatar
p13z
Manic Miner
Posts: 611
Joined: Sun Feb 17, 2019 10:41 pm
Location: UK
Contact:

Re: Sample to BEEP in the olden days

Post by p13z »

There are a few samplers amongst the "type ins". Can't remember exactly when - but I do remember a hex listing in YS for a sound sampler - and there are various others in the archives, some with very misleading names (seem to remember one called Speech Synthesis, or Speech Synthesiser).
User avatar
stupidget
Dynamite Dan
Posts: 1644
Joined: Wed Jan 24, 2018 2:09 pm
Location: Sunny Wolverhampton

Re: Sample to BEEP in the olden days

Post by stupidget »

I remember typing this one in:

https://spectrumcomputing.co.uk/entry/1 ... nd_Sampler

And using it to take samples of a flock, or murder, of crows from some random thrash metal track I’d recorded from the Tommy Vance Radio 1 Rock Show :lol:
User avatar
druellan
Dynamite Dan
Posts: 1475
Joined: Tue Apr 03, 2018 7:19 pm

Re: Sample to BEEP in the olden days

Post by druellan »

I, Ball has many samples, the voice that sounds at the start seems stored on the screen itself, but the Firebird loader placed a counter over the sample, and that might explain why the sample has some random noise at one part.
User avatar
lister_of_smeg
Microbot
Posts: 145
Joined: Thu Nov 16, 2017 1:44 pm

Re: Sample to BEEP in the olden days

Post by lister_of_smeg »

R-Tape wrote: Sun Jan 31, 2021 7:50 pm The SC page for Pippo links to this interview with the author, in which he says that the blood curdling scream was a sample of his own voice. It doesn't give any more detail beyond:
"I recorded that myself," chuckles Giovanni, "by shouting into my old-style cassette player. One day my mother had some friends downstairs and they could all hear me shouting 'arrrgggh arrgggh'. She said to her friends: 'Giovanni, he is a good boy, but from time to time he needs to let off steam!'"
How would he have converted his recording into data for the sound in ~1986? I've ripped the player and data here if anyone's interested (a zipped snapshot, and ASM). The player is tiny, just a pause loop and an OUT loop, but the data is 6K. Even still the scream is so good that it's well worth it.

The same question goes for anything back then, like the "Yippeee!" in Splat!
Those NOPs seem quite conspicuous, so I would guess something like:-

Code: Select all

        org 32768

        ld de,16256     ; make sure we stop before reaching the end of memory
        ld hl,screamdat
        di

smp:    ld b,0
smp0:   ld (hl),b       ; yes, it's inefficient to update (hl) every loop,
        in a,(254)      ; but it keeps the timing consistent with the player routine
        rla             ; move the ear bit into carry
        rla
        inc b
        jr nc,smp0      ; loop if ear bit reset/low
        inc hl

        ld b,0
smp1:   ld (hl),b 
        in a,(254)
        rla
        rla
        inc b
        jr c,smp1       ; loop if ear bit set/high
        inc hl

        dec de
        ld a,e
        or d
        jr nz,smp

        ei
        ret

screamdat:
Then you can use the player routine to tweak HL and DE to the start and length of the part you want to keep, and use those values to SAVE the sample.
User avatar
flatduckrecords
Manic Miner
Posts: 787
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: Sample to BEEP in the olden days

Post by flatduckrecords »

R-Tape wrote: Sun Jan 31, 2021 7:50 pmHow would he have converted his recording into data for the sound in ~1986?
David Webb's (1983) Supercharge Your Spectrum pp. 149–155. has a routine and instructions for doing just that. Webb describes using a cassette player in record mode but paused, connected to the EAR socket of the Spectrum:
Webb, D. wrote:Speak loudly and clearly into the microphone. You may need to shout[…]
Which might explain all the yelling that led to the awkward conversation in the Zanetti household that day!
User avatar
R-Tape
Site Admin
Posts: 6409
Joined: Thu Nov 09, 2017 11:46 am

Re: Sample to BEEP in the olden days

Post by R-Tape »

stupidget wrote: Sun Jan 31, 2021 9:59 pm I remember typing this one in:

https://spectrumcomputing.co.uk/entry/1 ... nd_Sampler
I've just done a title search for 'Speech' and there are loads of similar titles. I didn't realise it was a thing since the earliest days of the speccy.
And using it to take samples of a flock, or murder, of crows from some random thrash metal track I’d recorded from the Tommy Vance Radio 1 Rock Show :lol:
Cool! Funnily enough yesterday I took a Herring Gull sample from the bbc sound effect archive and put it into beepfx.
flatduckrecords wrote: Mon Feb 01, 2021 9:33 am David Webb's (1983) Supercharge Your Spectrum pp. 149–155. has a routine and instructions for doing just that. Webb describes using a cassette player in record mode but paused, connected to the EAR socket of the Spectrum:
Ah! I have this book, and never made use of it before. It could be a fun Sunday afternoon project - dare I try this on real hardware?
Which might explain all the yelling that led to the awkward conversation in the Zanetti household that day!
It reminds me of when I asked for a ready to use digitised 'Oh yeah!' for use in Mole Rat. Someone (I think it was Metalbrain) provided me with one, and I asked if a small tweak was possible - and he pointed out that it was late and if he yelled 'Oh yeah!' again he'd be sleeping on the couch!
Sparky
Manic Miner
Posts: 611
Joined: Tue Dec 15, 2020 9:42 pm

Re: Sample to BEEP in the olden days

Post by Sparky »

Is this for 48K Speccys or AY sound like for the 128?
Alex
User avatar
Nitrowing
Manic Miner
Posts: 607
Joined: Mon Sep 21, 2020 8:38 pm
Location: Cleethorpes

Re: Sample to BEEP in the olden days

Post by Nitrowing »

Sparky wrote: Mon Feb 01, 2021 11:18 am Is this for 48K Speccys or AY sound like for the 128?
The book was written in '83 so I'd think this was for the 48k
User avatar
Joefish
Rick Dangerous
Posts: 2059
Joined: Tue Nov 14, 2017 10:26 am

Re: Sample to BEEP in the olden days

Post by Joefish »

There are two ways of recording and playing back samples on the Spectrum. One is to record a series of 1/0 bits from the EAR/MIC port packed into bytes, then replay them to the speaker. The other is 'PWM' (Pulse Width Modulation) where you record the times between the switches from 0 to 1 and 1 to 0, then replay it from that data using a series of varying delays.

A third method is open to you if you have other processing hardware. You convert the sound into a very fast stream of dithered bits that rely on the resistor/capacitor circuit of the Speccy's speaker to smooth them out into an audio waveform. Though I've never seen any software that can generate this sort of data. It'd be interesting if someone could write one. I sort of understand the theory but you probably want someone with several real Spectrums and oscilloscopes and stuff to work out all the details.
User avatar
patters
Manic Miner
Posts: 471
Joined: Thu Apr 11, 2019 1:06 am

Re: Sample to BEEP in the olden days

Post by patters »

stupidget wrote: Sun Jan 31, 2021 9:59 pm I remember typing this one in:

https://spectrumcomputing.co.uk/entry/1 ... nd_Sampler

And using it to take samples of a flock, or murder, of crows from some random thrash metal track I’d recorded from the Tommy Vance Radio 1 Rock Show :lol:
Wow, I remember typing that one in too. I was so impressed with it. It was like some kind of voodoo. I also digitised some screams and made the beginnings of an Aliens-style text adventure game which used it and some pulsing high speed BEEPs to simulate gun fire, mixing in lots of the same scream repeating with various durations :)
I made a text display routine with a green screen simulating the kind of low-fi terminals from Alien Breed on the Amiga, complete with blinking cursor tracing out the text and some signal errors etc.
In typical programmer fashion I got bored of it once I'd made the tech showcase, and couldn't be arsed with making the actual narrative-driven game. :lol:
I did put some speech in too: "This is bravo team, reporting our position over..." haha, takes me back. I think I realised I had spent most of the 128K on sound samples though, so there simply wasn't room for much game.
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Sample to BEEP in the olden days

Post by Alone Coder »

BTW what exactly does the voice in I, Ball 2 say?
User avatar
p13z
Manic Miner
Posts: 611
Joined: Sun Feb 17, 2019 10:41 pm
Location: UK
Contact:

Re: Sample to BEEP in the olden days

Post by p13z »

Alone Coder wrote: Sun Feb 07, 2021 8:46 am BTW what exactly does the voice in I, Ball 2 say?
Intro is just: " I Ball "
When the game starts " OK - Go for it " ?
I think we'll have to write off some of the other ones as Dalek sex noises.
User avatar
XTM
Manic Miner
Posts: 794
Joined: Mon Jun 22, 2020 12:09 am
Location: Cologne, Germany
Contact:

Re: Sample to BEEP in the olden days

Post by XTM »

stupidget wrote: Sun Jan 31, 2021 9:59 pmAnd using it to take samples of a flock, or murder, of crows from some random thrash metal track I’d recorded from the Tommy Vance Radio 1 Rock Show :lol:
Off-topic, but I wonder if that name was the inspiration for the character names Tommy Vercetti and Lance Vance in GTA Vice City ...
User avatar
utz
Microbot
Posts: 116
Joined: Wed Nov 15, 2017 9:04 am
Contact:

Re: Sample to BEEP in the olden days

Post by utz »

Joefish wrote: Mon Feb 01, 2021 12:12 pm A third method is open to you if you have other processing hardware. You convert the sound into a very fast stream of dithered bits that rely on the resistor/capacitor circuit of the Speccy's speaker to smooth them out into an audio waveform. Though I've never seen any software that can generate this sort of data. It'd be interesting if someone could write one. I sort of understand the theory but you probably want someone with several real Spectrums and oscilloscopes and stuff to work out all the details.
Not particularly great-sounding, but using exactly this technique: https://spectrumcomputing.co.uk/entry/2 ... Tracker_3T

I wrote my own a couple of years ago. Sound example here.
User avatar
4thRock
Manic Miner
Posts: 415
Joined: Thu Nov 09, 2017 9:35 am
Location: Portugal

Re: Sample to BEEP in the olden days

Post by 4thRock »

utz wrote: Sun Feb 07, 2021 8:34 pm Sound example here.
That's quite good!
I messed with a 8bit WAV to 1bit binary file converter (on the PC of course) and didn't get far because 48k is too small.

An out of the box solution is to convert your sample to 8bits and save it as a raw file.
Load that raw file into an image processing program as grayscale. Convert the image into 1bit black and white using random dither.
Save as raw (or BMP) and you have your 1bit dithered file :lol:
User avatar
Joefish
Rick Dangerous
Posts: 2059
Joined: Tue Nov 14, 2017 10:26 am

Re: Sample to BEEP in the olden days

Post by Joefish »

Ordered dither really, but it's pretty much the same algorithm!

You're only going to be able to record the shortest words or shouts like that though, as you'd be churning through it at something in the order of 10 k per second (80,000 bits per second). You need to be several times higher than the response time of the speaker circuit.

What sort of rate does that on-the-Speccy sampling routine run at? How long a sample does it fit in the memory in total?

This is interesting:
http://www.robeesworld.com/blog/58/puls ... usic-works

It shows how a sine wave can be cut up into varying hi/lo cycles at a fixed rate (Pulse Width Modulation). For replay, this relies on the smoothed response of the speaker circuit. Is there a similar smoothed response on the input circuit? Since the methods of sampling and replaying actually on the Spectrum itself would need to have fairly similar responses in input and output to be any good.
User avatar
4thRock
Manic Miner
Posts: 415
Joined: Thu Nov 09, 2017 9:35 am
Location: Portugal

Re: Sample to BEEP in the olden days

Post by 4thRock »

This is a fun sample program to play with:
https://spectrumcomputing.co.uk/entry/1 ... it_Sampler
Use the TZX because the TAP is an early version.


A quick test using an emulator recorded this (just press play on program):
https://drive.google.com/file/d/1KyAVY0 ... sp=sharing

Not bad at all given that there's no dither, just a straight recording from a streaming radio :D
User avatar
utz
Microbot
Posts: 116
Joined: Wed Nov 15, 2017 9:04 am
Contact:

Re: Sample to BEEP in the olden days

Post by utz »

Joefish wrote: Mon Feb 08, 2021 1:28 pm This is interesting:
http://www.robeesworld.com/blog/58/puls ... usic-works

It shows how a sine wave can be cut up into varying hi/lo cycles at a fixed rate (Pulse Width Modulation). For replay, this relies on the smoothed response of the speaker circuit. Is there a similar smoothed response on the input circuit? Since the methods of sampling and replaying actually on the Spectrum itself would need to have fairly similar responses in input and output to be any good.
This isn't feasible on Spectrum. It's much easier to approximate a sine wave with 4-bit PCM playback, or synthesize a triangle wave, which sounds more or less the same.

An possible approach for sampling could be to read 3-bit PCM (should be doable within a 224 t-state loop), and then encode it as 1-bit DPCM on the fly.
User avatar
Joefish
Rick Dangerous
Posts: 2059
Joined: Tue Nov 14, 2017 10:26 am

Re: Sample to BEEP in the olden days

Post by Joefish »

It's all quite feasible, and been done before. It's just that preparing the bitstream on a PC from the original sample will give a better result than downgrading the sample bit depth and then doing the final stage on the Spectrum. It might take double the memory at the highest quality but it's not a show-stopper. You're just turning bytes of data into a single bitstream at a constant rate.
User avatar
utz
Microbot
Posts: 116
Joined: Wed Nov 15, 2017 9:04 am
Contact:

Re: Sample to BEEP in the olden days

Post by utz »

Do you have an example of that? I know [mention]RMartins[/mention] tried a couple of years ago, and it was just barely working (for mixing two channels).
It's unfeasible for two reasons, first of all because it takes too much memory, and second of all because the Speccy is barely fast enough for the intended waveform smoothing to occur. Eg, the fastest way would be to store bits as bytes and churn them out with otir/otdr at 166.6 KHz, and that wouldn't provide a constant bitrate because of contention (aside from burning loads of memory). Compare that with CD Audio, which churns out samples at 705.6 KHz per channel. I'm not saying it's impossible, I'm just saying it will have serious drawbacks, and there are better approaches.
Patrik Rak
Microbot
Posts: 117
Joined: Mon Apr 13, 2020 3:07 pm

Re: Sample to BEEP in the olden days

Post by Patrik Rak »

4thRock wrote: Mon Feb 08, 2021 2:24 pm This is a fun sample program to play with:
https://spectrumcomputing.co.uk/entry/1 ... it_Sampler
That's the one we have used for Qang just for the kicks. Still can hear the author's voice saying "High Quality Edit Sampler"... Imagine how much loading time was wasted by loading that! :lol:
Post Reply