Around the 1982 a book called "66 programmi per zx81" proposed a cool way to connect a 555 based oscillator to the ZX81 and get a cheap and simple sound board. The book is available online as well as a re-arrangement of the circuit (the board is now called "Octavia").
I thought at a quick hack to get it emulated: to use the already existing AY emulation and convert the bytes being poked to the sound card to AY registers.
The conversion expression is not very good (can you find a better one?) but the idea looks nice.. feel free to use it into your favorite emulator: here's my code for the SZ81:
if (Address>8191 && Address<16384) {
extern void sound_ay_write(int reg,int val);
/* keep only audio channel 0 */
sound_ay_write(7,254);
/* set volume to zero if "makic key" found to disable audio */
if ((Data & 15) == 15) {sound_ay_write(8,0);}
else {
/* enable the 555 oscillator */
int val=170*Data*Data/7040-39227*Data/3520+1450;
sound_ay_write(8,7); /* raise volume */
sound_ay_write(0,(val)&255);
sound_ay_write(1,(val>>8)&15);
sound_ay_write(6,0);
}
}
..I can provide a (partial) tone conversion table, in case a maths would want to challenge himself
Idea to quickly emulate another sound board
Re: Idea to quickly emulate another sound board
Reference to the sound card:
Original book (in good resolution) Sound card is described starting at page 95:
http://www.microatena.it/scheda_libro.php?id=198&ord=N
..there is an error in the sound table in page 100, note #47 should be played by POKEing value 237 rather than 372.
Remake:
http://zx81.ordi5.free.fr/brico/son/index.htm
I understood that every bit in the value has a different "weight" than expected, I'm still trying to decode it in a better way, but few demos sound good already, even if music wouldn't play right.
Original book (in good resolution) Sound card is described starting at page 95:
http://www.microatena.it/scheda_libro.php?id=198&ord=N
..there is an error in the sound table in page 100, note #47 should be played by POKEing value 237 rather than 372.
Remake:
http://zx81.ordi5.free.fr/brico/son/index.htm
I understood that every bit in the value has a different "weight" than expected, I'm still trying to decode it in a better way, but few demos sound good already, even if music wouldn't play right.
- 1024MAK
- Posts: 5529
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
- Contact:
Re: Idea to quickly emulate another sound board
Yes, 372 does not fit in an 8 bit bytestefano wrote:R..there is an error in the sound table in page 100, note #47 should be played by POKEing value 237 rather than 372.

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp
Standby alert 
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Spring approaching...
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp


There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb

Spring approaching...
Re: Idea to quickly emulate another sound board
This should explain why the current conversion function is not accurate: I provided a simple parabolic conversion while the sigle bits weight differently. Here's the diagram of the right values based on a conversion table. you can see the 4 octaves split in 4 note blocks.
[img=0]octavia-zonx.jpg[/img]
[img=0]octavia-zonx.jpg[/img]
- Attachments
-
- Octavia<>ZonX values
- octavia-zonx.jpg (33.42 KiB) Viewed 15561 times
Re: Idea to quickly emulate another sound board
Ok, I partially decoded the board logic and got a better simulation of the oscillator. Bit 6 and 7 are octave multipliers, bit 4 and 5 shift the frequency in one of the possible three positions for the 4 notes in the 12 semi-tones scale.
Bit 1..4, inverted, determine the reference frequency for the note and normally are not combined (but for the higer 2 notes).
this code snippets fits into SZ81, in file "zx81.c", just before the line:
Here it is:
23/12.. edited the expression for freq to make it more suitable for music. Tuning is not perfect but it is close to the results I'd likely get building the circuit myself
I'm not sure on how to name this board, I like the "Octavia" name but the its original description is probably historically correct: "50 notes music interface" by Gaetano Marano.
Bit 1..4, inverted, determine the reference frequency for the note and normally are not combined (but for the higer 2 notes).
this code snippets fits into SZ81, in file "zx81.c", just before the line:
Code: Select all
if (Address>8191 && Address<16384 && zx81.shadowROM && zx81.protectROM) return;
Code: Select all
if (Address>8191 && Address<16384) {
extern void sound_ay_write(int reg,int val);
/* keep only audio channel 0 */
sound_ay_write(7,254);
/* set volume to zero if "makic key" found to disable audio */
if ((Data & 15) == 15) {sound_ay_write(8,0);}
else {
/* enable the 555 oscillator */
float freq=(60.0 + 5.4*(float)(~Data>>3&1) + 9.4*(float)(~Data>>2&1) + 13.2*(float)(~Data>>1&1) + 22.1*(float)(~Data&1) + 17.5*(float)(Data>>4&1) + 42.1*(float)(Data>>5&1)) * (float)(1<<(Data>>6));
unsigned int val=(1625000/(16*freq));
/* raise volume */
sound_ay_write(8,7);
sound_ay_write(0,(val)&255);
sound_ay_write(1,(val>>8)&15);
sound_ay_write(6,0);
}
}
23/12.. edited the expression for freq to make it more suitable for music. Tuning is not perfect but it is close to the results I'd likely get building the circuit myself

I'm not sure on how to name this board, I like the "Octavia" name but the its original description is probably historically correct: "50 notes music interface" by Gaetano Marano.
Re: Idea to quickly emulate another sound board
More sound demos, they integrate the ones already published by XavSnap.
Re: Idea to quickly emulate another sound board
I just found this article:
http://www.muzines.co.uk/articles/zx81-sequencer/3220
Similar idea, different implementation. In the article it looks that the valid values to POKE had to be <127. 5 octaves, though!
http://www.muzines.co.uk/articles/zx81-sequencer/3220
Similar idea, different implementation. In the article it looks that the valid values to POKE had to be <127. 5 octaves, though!