vDrive: With MDV sound? I wonder.

Nagging hardware related question? Post here!
stephen_usher
Trump Card
Posts: 242
Joined: Tue Mar 11, 2014 8:00 pm

vDrive: With MDV sound? I wonder.

Postby stephen_usher » Wed Jun 24, 2020 10:08 pm

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&fbclid=IwAR3U-wpaofaHdwUo5HTOKcSBJJQgSFxGFJwFEOr_xNs9m7Aso0-_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
Gold Card
Posts: 455
Joined: Thu Oct 03, 2019 2:09 am

Re: vDrive: With MDV sound? I wonder.

Postby bwinkel67 » Wed Jun 24, 2020 10:18 pm

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
Trump Card
Posts: 242
Joined: Tue Mar 11, 2014 8:00 pm

Re: vDrive: With MDV sound? I wonder.

Postby stephen_usher » Fri Jun 26, 2020 2:50 pm

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
Trump Card
Posts: 242
Joined: Tue Mar 11, 2014 8:00 pm

Re: vDrive: With MDV sound? I wonder.

Postby stephen_usher » Sat Jun 27, 2020 1:46 pm

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
Trump Card
Posts: 242
Joined: Tue Mar 11, 2014 8:00 pm

Re: vDrive: With MDV sound? I wonder.

Postby stephen_usher » Sat Jun 27, 2020 5:32 pm

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
Trump Card
Posts: 242
Joined: Tue Mar 11, 2014 8:00 pm

Re: vDrive: With MDV sound? I wonder.

Postby stephen_usher » Sat Jun 27, 2020 8:16 pm

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
Trump Card
Posts: 242
Joined: Tue Mar 11, 2014 8:00 pm

Re: vDrive: With MDV sound? I wonder.

Postby stephen_usher » Wed Jul 01, 2020 12:05 am

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: 1039
Joined: Sat Jan 22, 2011 8:47 am

Re: vDrive: With MDV sound? I wonder.

Postby Peter » Fri Jul 10, 2020 3:10 pm

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
QL Wafer Drive
Posts: 1833
Joined: Mon Dec 20, 2010 11:40 am
Location: Runcorn, Cheshire, UK

Re: vDrive: With MDV sound? I wonder.

Postby Derek_Stewart » Sat Jul 11, 2020 3:24 pm

Hi,

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


Regards,

Derek
stephen_usher
Trump Card
Posts: 242
Joined: Tue Mar 11, 2014 8:00 pm

Re: vDrive: With MDV sound? I wonder.

Postby stephen_usher » Sat Jul 11, 2020 5:24 pm

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;
  }
}



Who is online

Users browsing this forum: No registered users and 6 guests