vDrive: With MDV sound? I wonder.

Nagging hardware related question? Post here!
stephen_usher
Gold Card
Posts: 429
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

vDrive: With MDV sound? I wonder.

Post by stephen_usher »

A conversation on the QL Facebook page got me wondering how easy it would be to get the digitised sound of a microdrive running to play when the vDrive was accessed.

I came across this interesting project, with uses the internal flash in an ATtiny85 chip as a sample storage and outputs audio directly. http://www.technoblogy.com/show?QBB&fbc ... 0-_7zAhHQ0

The device is 5V tolerant so can be powered directly from the vDrive's regulator. It could be triggered using the LED output, though that may need a transistor.

I'm not sure if the beeper on the vDrive could be coaxed into playing a normal sound or if you'd need a separate speaker.


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

Re: vDrive: With MDV sound? I wonder.

Post by bwinkel67 »

You mean play that whirring sound instead of the beep? That would be great. One of the nicer sounds I remember on the QL is when a microdrive was working perfectly and it would just do a whir for a sector read, stop, and then do the next one and continue all the way through to the end. That would be nice vDrive add-on.


stephen_usher
Gold Card
Posts: 429
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: vDrive: With MDV sound? I wonder.

Post by stephen_usher »

Well, I've managed to program an ATTiny85 device with a sampled recording of a Microdrive running.

It's a bit too quiet and needs a low-pass filter. I'd also need a transistor to allow the output of the red LED to trigger the device.

https://youtu.be/JjI5IM0YOJQ


stephen_usher
Gold Card
Posts: 429
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: vDrive: With MDV sound? I wonder.

Post by stephen_usher »

I've now managed to get the vDrive to control the power to the ATTiny85, not before accidentally blowing up the LED when I had the base and collector wired the wrong way araound, but that's easily fixable.

https://youtu.be/KWYmWIQzo5A

I need to add an opamp and a low-pass filter to get the proper rumble.


stephen_usher
Gold Card
Posts: 429
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: vDrive: With MDV sound? I wonder.

Post by stephen_usher »

Actually I think I'm there, other than making a PCB and soldering the components.

I've created a new and better sample, with a higher volume and cutting out some of the peaks and then set the ATTiny85 to play at double the speed it was previously, which was already a factor of 4 faster than the sample code said it should be and...

https://youtu.be/VhUG1TIi_j8

P.S. I've only been testing this with the vDrive ZX at the moment but does it make difference to the experience! It just feels and sounds right. It's as if you're using a real Microdrive. It make soooo much difference.

I'll generate a schematic and post the code so that others can make this. Maybe Charles can change the vDrive and add this instead of the beeper? The cost of the components is probably in the region of 50p or less.


stephen_usher
Gold Card
Posts: 429
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: vDrive: With MDV sound? I wonder.

Post by stephen_usher »

Here are the schematics for the vDrive sampled sound board plus source code and compiled HEX file to load onto the ATTiny85 20U.

http://www.lingula.org.uk/~steve/share/vdrive-sound/


stephen_usher
Gold Card
Posts: 429
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: vDrive: With MDV sound? I wonder.

Post by stephen_usher »

I've built the first version of the sound unit today and it does actually work.

The card itself fits nicely under the SD card holder.
IMG_1938.jpg
IMG_1940.jpg


User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Re: vDrive: With MDV sound? I wonder.

Post by Peter »

stephen_usher wrote:I've built the first version of the sound unit today and it does actually work.
Cool idea, congratulations!

Crazy how far the gap between wishes for QL style hardware is. Ranging from "several generations newer than Q60" down to "simulate 1984 technology - but please with sound"... :D


Derek_Stewart
Font of All Knowledge
Posts: 3929
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: vDrive: With MDV sound? I wonder.

Post by Derek_Stewart »

Hi,

Is it possible to programme the sound, so that we can have custom sounds?


Regards,

Derek
stephen_usher
Gold Card
Posts: 429
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: vDrive: With MDV sound? I wonder.

Post by stephen_usher »

Yes, as it's merely a WAV file which has been converted into a C array of unsigned byte values which is then sent to the chips digital to analogue converter. The sample can't be very long though as the chip only has a small memory for the program.

i.e.

Code: Select all

// Audio encoded as unsigned 8-bit, 8kHz sampling rate
const uint8_t mdvsnd_wav[] PROGMEM = {
  0x52, 0x49, 0x46, 0x46, 0xa2, 0x0a, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45,

...

  0x52, 0x24, 0x69, 0x95, 0x96, 0xac
};
unsigned int mdvsnd_wav_len = 2730;

// Sample interrupt
ISR (TIMER0_COMPA_vect) {
  char sample = pgm_read_byte(&mdvsnd_wav[p++]);
  OCR1A = sample; OCR1B = sample ^ 255;
  // End of data? Go to sleep
  if (p == mdvsnd_wav_len) {
    p = 0;
  }
}


Post Reply