Speech Synthesis

Anything QL Software or Programming Related.
User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: Speech Synthesis

Post by dilwyn »

bwinkel67 wrote:Thank you Dilwyn!

Btw, here is what digitized speech sounds like on a ZX81...maybe someday we can have that on the QL too...

https://youtu.be/UnfJG_H_Dsc
Thanks - that's of interest to me as I'll explain below.

Back in the 1980s, a then colleague of mine at the BBC and I collaborated on very basic speech synthesis for the Welsh language, which was very rare in those days. We worked on BBC micros and Spectrums, as there were no or very few PCs or Macs in common use in the BBC at the time, especially out in the regions. We used a system of (I think it was called) allophones and phonemes to tie together basic sounds of a language. Given how primitive was the equipment we had in those days, and we didn't really know what we were doing, we did achieve quite a lot I suppose.

I had started on the Spectrum by writing machine code routines (called using FN statements from ZX Basic IIRC - the code is in one of my early Spectrum books) to get simple zaps, etc from the Spectrum speaker as opposed to the usual simple BEEPs. So we did what we could to send simple sounds to the beeper, but although it worked fairly well on the BBC micro (that had a better sound system than the Spectrum), we didn't have much success with Spectrum speech until we started sending the output to the cassette save port and listened to it using a cassette recorder in record mode on pause. Using the cassette recorder as an amplifier if I remember correctly. I think we achieved something fairly similar to the sound on your video.

IIRC, one problem we had was that the 8-bit micros at the same didn't have enough memory or mass storage to save the data files used adequately, so we were limited to short phrases at a time. Certainly, BASIC at the time was too slow, we had to use machine code. In a broadcast environment, of course, we could edit these short sentences together on tape to make meaningful speech. It was understandable, but quite low quality.

We then used one of the early Spectrum speech synthesisers which was allophone based and got fairly good results, good enough that one of the radio producers liked it enough to record some output in Welsh and a program was broadcast in Welsh with the Spectrum speech synth speaking Welsh, which was quite a novelty in those days. At some point, the BBC micro got a speech synthesis chip, so we stopped working on that, and the Spectrum work became more of a hobby thing than the original aim of doing enough work to get the local university to take an interest if we developed it far enough. Long term, it achieved nothing because technology moved on quickly, but I got quite a bit of kudos and respect for the work we did on it at the time. I just wish nowadays that we'd kept the work we did - that was 35 years ago, of course, the evidence is probably long since lost.

At one stage, I had a QL sound and speech board called the QSV400, produced by an English company called Maurice Computers. I gave the board away when I lost interest in it, but some of the software I wrote to use that board is still in Quanta software library. I think there was a 3D Tic Tac Toe (3D Oxo for Brits) or 4-in-a-row (I forget which) and a simple program to make it easier to use the device.

Just had a nostalgic day remembering back to those days!


User avatar
RalfR
Aurora
Posts: 871
Joined: Fri Jun 15, 2018 8:58 pm

Re: Speech Synthesis

Post by RalfR »

I remember Alien Hijack running with the QTalk speech synthesizer. Was it that with a real device driver to let it "talk"?


4E75 7000
User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Re: Speech Synthesis

Post by bwinkel67 »

Looka like QTALK was a serial device that synthesized speech for the QL.

https://www.youtube.com/watch?v=5slnMemLtgs


User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Re: Speech Synthesis

Post by bwinkel67 »

dilwyn wrote: Thanks - that's of interest to me as I'll explain below.

...
I had started on the Spectrum by writing machine code routines (called using FN statements from ZX Basic IIRC - the code is in one of my early Spectrum books) to get simple zaps, etc from the Spectrum speaker as opposed to the usual simple BEEPs. So we did what we could to send simple sounds to the beeper, but although it worked fairly well on the BBC micro (that had a better sound system than the Spectrum), we didn't have much success with Spectrum speech until we started sending the output to the cassette save port and listened to it using a cassette recorder in record mode on pause. Using the cassette recorder as an amplifier if I remember correctly. I think we achieved something fairly similar to the sound on your video.!

---
Wow, so you basically did (on a phonetic level) what the ZX81 software did on a word level. I can't imagine using the simple speaker on the Spectrum (I'm guessing it's only slightly more sophisticated than the QL) could produce any legible speech but the audio out on the mic would. So the digitized audio you sent to the mic port, was it just a concatenation of phonemes to form words or was it recorded speech (i.e. words like the ZX81 demo I played)? If the latter, how was that digitized speech stored (format) in Spectrum's memory?

So if we combine your and Jan's work and we could end up with a software-based speech synthesizer (and eventually BBQL sound driver that could even play music) on the QL...not that I'm suggesting the two of you start doing work :D


User avatar
janbredenbeek
Super Gold Card
Posts: 629
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: Speech Synthesis

Post by janbredenbeek »

dilwyn wrote:
janbredenbeek wrote:
bwinkel67 wrote: Should your software be put on Dilwyn's page so it's more visible to us ordinary folks? :D
That's up to Dilwyn, but If he does I would appreciate a link to my GitHub page too since that contains the source files and documentation.
Thank you Jan. I've put it on the Misc Software page on my site, under 'Basicode'

As I don't know what I'm talking about with this, I'd be grateful if you'd take a quick look to see that my description and links are as you would want them.

http://www.dilwyn.me.uk/misc/index.html
The description is excellent, though it looks like you've pasted an URL by accident just before '8-bit platforms'.


User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: Speech Synthesis

Post by dilwyn »

bwinkel67 wrote:
dilwyn wrote: Thanks - that's of interest to me as I'll explain below.

...
I had started on the Spectrum by writing machine code routines (called using FN statements from ZX Basic IIRC - the code is in one of my early Spectrum books) to get simple zaps, etc from the Spectrum speaker as opposed to the usual simple BEEPs. So we did what we could to send simple sounds to the beeper, but although it worked fairly well on the BBC micro (that had a better sound system than the Spectrum), we didn't have much success with Spectrum speech until we started sending the output to the cassette save port and listened to it using a cassette recorder in record mode on pause. Using the cassette recorder as an amplifier if I remember correctly. I think we achieved something fairly similar to the sound on your video.!

---
Wow, so you basically did (on a phonetic level) what the ZX81 software did on a word level. I can't imagine using the simple speaker on the Spectrum (I'm guessing it's only slightly more sophisticated than the QL) could produce any legible speech but the audio out on the mic would. So the digitized audio you sent to the mic port, was it just a concatenation of phonemes to form words or was it recorded speech (i.e. words like the ZX81 demo I played)? If the latter, how was that digitized speech stored (format) in Spectrum's memory?

So if we combine your and Jan's work and we could end up with a software-based speech synthesizer (and eventually BBQL sound driver that could even play music) on the QL...not that I'm suggesting the two of you start doing work :D


User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: Speech Synthesis

Post by dilwyn »

janbredenbeek wrote:
dilwyn wrote:
janbredenbeek wrote:
That's up to Dilwyn, but If he does I would appreciate a link to my GitHub page too since that contains the source files and documentation.
Thank you Jan. I've put it on the Misc Software page on my site, under 'Basicode'

As I don't know what I'm talking about with this, I'd be grateful if you'd take a quick look to see that my description and links are as you would want them.

http://www.dilwyn.me.uk/misc/index.html
The description is excellent, though it looks like you've pasted an URL by accident just before '8-bit platforms'.
Ah, thanks for spotting that. Obviously I was trying to do too much in too short a time as usual these days. :oops:


User avatar
janbredenbeek
Super Gold Card
Posts: 629
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: Speech Synthesis

Post by janbredenbeek »

bwinkel67 wrote:Thank you Dilwyn!

Btw, here is what digitized speech sounds like on a ZX81...maybe someday we can have that on the QL too...
I remember having written a small sound sampling routine for the Spectrum using the cassette port. It samples just 1 bit at a time so the sound will be very distorted but still intelligible.
I don't have a Spectrum anymore but was able to retrieve the source from my tape archive. It's entirely Z80 assembly but shouldn't be too hard to port to the QL if you know which I/O bit to bang...

Code: Select all

   10 *C-
   20 *D+
   30 ;SPEECH VERSION 2
   40 
   50 ;APRIL 6  1985
   60 
   70        ORG  40000
   80 LENGTH EQU  20000	; length of data to be stored in bytes
   90 
  100 FS     EQU  10	; Timing constant defining sample frequency
  110  ; Listen routine (record)
  120 LISTEN LD   HL,41000
  130        LD   DE,LENGTH
  140        DI
  150        LD   C,#01
  160 NEXT   IN   A,(#FE)
  170        RLA
  180        RLA
  190        RL   C
  200        JR   C,L_BYTE
  210        LD   B,FS+1
  220 L_WAIT DJNZ L_WAIT
  230        JR   NEXT
  240 L_BYTE LD   (HL),C
  250        INC  HL
  260        DEC  DE
  270        LD   A,D
  280        OR   E
  290        LD   B,FS-3
  300        LD   C,#01
  310        JR   NZ,L_WAIT
  320        EI
  330        RET
  340 ; Speak routine (playback)
  350 SPEAK  DI
  360        LD   HL,41000
  370        LD   DE,LENGTH
  380        LD   C,(HL)
  390        SCF
  400        RL   C
  410 S_BIT  SBC  A,A
  420        AND  #10
  430        OUT  (#FE),A
  440        LD   B,FS
  450        RL   C
  460        JP   Z,S_BYTE
  470 S_WAIT DJNZ S_WAIT
  480        LD   A,#00
  490        JR   S_BIT
  500 S_BYTE INC  HL
  510        LD   C,(HL)
  520        SCF
  530        NOP
  540        LD   B,FS-4
  550        RL   C
  560        DEC  E
  570        JR   NZ,S_WAIT
  580        DEC  B
  590        DEC  D
  600        JP   P,S_WAIT
  610        EI
  620        RET



User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: Speech Synthesis

Post by dilwyn »

dilwyn wrote:
bwinkel67 wrote:
dilwyn wrote: Thanks - that's of interest to me as I'll explain below.

...
I had started on the Spectrum by writing machine code routines (called using FN statements from ZX Basic IIRC - the code is in one of my early Spectrum books) to get simple zaps, etc from the Spectrum speaker as opposed to the usual simple BEEPs. So we did what we could to send simple sounds to the beeper, but although it worked fairly well on the BBC micro (that had a better sound system than the Spectrum), we didn't have much success with Spectrum speech until we started sending the output to the cassette save port and listened to it using a cassette recorder in record mode on pause. Using the cassette recorder as an amplifier if I remember correctly. I think we achieved something fairly similar to the sound on your video.!

---
Wow, so you basically did (on a phonetic level) what the ZX81 software did on a word level. I can't imagine using the simple speaker on the Spectrum (I'm guessing it's only slightly more sophisticated than the QL) could produce any legible speech but the audio out on the mic would. So the digitized audio you sent to the mic port, was it just a concatenation of phonemes to form words or was it recorded speech (i.e. words like the ZX81 demo I played)? If the latter, how was that digitized speech stored (format) in Spectrum's memory?

So if we combine your and Jan's work and we could end up with a software-based speech synthesizer (and eventually BBQL sound driver that could even play music) on the QL...not that I'm suggesting the two of you start doing work :D
I had written quite a lengthy reply to this and it hasn't appeared on here??? (Bangs head hard on wall :cry: ).

(more briefly)
You have to remember we didn't really know what we were doing back then (any more than I do nowadays?). The speech add-ons were becoming more common and affordable and our project was running into dead ends. By then we were quite glad when we were moved on to other things. We simply couldn't get it working well enough to anywhere near compete with the emerging add-ons when we were trying to play speech via the cassette port, so we briefly moved on to better results using the speech synthesisers before the project was eventually ended.

As you say, the Spectrum speaker was no good for trying to play speech. We did get some quite nice sound effects from the Spectrum speaker through a process which IIRC involved playing back short beeps of varying pitches and durations under interrupts to form more complex sounds - if of interest I'm sure I could scan the chapter concerned from my Delving Deeper Spectrum book from 1985-ish.

I have no code or listings left from the work we did on Spectrums and BBC micros back then and have spent the day trying to recall how we did it. I'll see if I can get in touch with my former colleague to ask if he still has any information from back then and pass them on to you if he has.

What I do remember is that he got the sound files from somewhere, converted them to the BBC micro himself, wrote the 6502 assembler for that half of the project while I spent ages trying to transfer files via RS232 (ever tried to get BBC micros and Interface 1's to successfully transfer large files?) and struggling with writing the Z80 code as I didn't have the best of assemblers at the time and Z80 assembler was still fairly new to me at that level too. I do remember the constant struggles, great frustrations, the trade-offs between what we wanted to do and what we could actually achieve - we were working on this alongside our other work and at the limits of our knowledge at the time. Then after we'd spent a lot of time on it, technology moved on quickly and it all got abandoned.

In some ways, with hindsight, the project was never going to succeed, although there were a lot of spin-off benefits, in terms of our learning and getting computers into our broadcasting and office environments. He and I wrote several softwares for BBC micros which in turn encouraged other staff to get involved. Some of the programs were used for a while in studios and offices in Wales until PCs etc became more common and affordable. So it wasn't a complete waste of time, although the speech project itself came to nothing in the end.


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: Speech Synthesis

Post by NormanDunbar »

Dilwyn wrote:I had written quite a lengthy reply to this and it hasn't appeared on here??? (Bangs head hard on wall :cry: ).
This one? viewtopic.php?f=3&t=3847&view=unread&si ... 687#p42300

It certainly appeared for me, and, was very interesting indeed. Thanks.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Post Reply