CPCWiki forum

General Category => Amstrad CPC hardware => Topic started by: arnoldemu on 12:25, 18 March 10

Title: sampling sound using cpc+ analogue port
Post by: arnoldemu on 12:25, 18 March 10
I was asked this many years ago.

So, is it possible to sample sound using the cpc+ analogue joystick port?

I know the accuracy would be 6-bit, but is it possible to read the hardware fast enough to sample sound? I think the analogue joystick registers are not updated by the asic fast enough?

EDIT: Updated 200 times per second = 200Hz samples. hmmm.. too slow.  :o
Title: Re: sampling sound using cpc+ analogue port
Post by: Bryce on 13:15, 18 March 10
I built a device for the Atari 800XL which allowed you to sample music through its analogue port. For the time (some time in the 80's) it was ok, music / voices were recognisable, but by no means anything like the 44Khz MP3s we have got used to these days. It was used to create masterpieces such as the voice in Codemasters Super Robinhood (if you can remember what that sounded like) . As long as you don't expect too much and you play it back at the correct speed, it can add some cool effects to games or demos.

Bryce.
Title: Re: sampling sound using cpc+ analogue port
Post by: nocash on 17:33, 18 March 10
> 200Hz samples. hmmm.. too slow.  :o

You can shortcut all 8 inputs with each other, then you have 1600Hz :-) Of course that isn't much better, and you'd need to modify some things inside of the computer to get the extra 4 inputs. So that idea isn't recommended at all.
Title: Re: sampling sound using cpc+ analogue port
Post by: Cholo on 01:03, 19 March 10
Back in the day i visited a fellow Amstrad user and got a sample program he had written himself. Idea of the program was quite simple. It would record up to about 20 second of audio from a audio tape. Simply had to insert a tape in my 464 and it would read the audio back and create a rsx for playback. You could then save the whole thing and use it in your basic programs.
What impressed me back then was the quality of the audio, as it was much "cleaner" than the usual game samples. Fun and easy recording your own voice yelling "King of the world" then let the 464 tapedeck read it into memory and then hear it play back from the speakers.
Title: Re: sampling sound using cpc+ analogue port
Post by: MacDeath on 01:35, 19 March 10
Perhaps the 464+ is not the shitfest unusefull shit we may think...

Let me explain : a device (software), french if I remember well, permited to sample using the Tape recorder/drive from the 464... As you explained us.

So a 464 may do this too (while a 6128, tapeless as we know, can't!...)

And it has the extra PLUS DMA stuff...so is fully compatible with a 6128+PLUS...


Bref...brief...


Do you think an update from the soft permiting samplings from tape drive may be updated to the 464+ ?
And with the additionnal Tape port and any modern digital sound device (so a clear signal...) enable a sweet sample ?

with even better capacity than on a good old 464 ? (thanks perhaps to the DMA channels or even a Ram upgrade ???)


Yet, thx to the modern era, we may get compatible samples just by any kind of software ripping from a PC... no ?
Title: Re: sampling sound using cpc+ analogue port
Post by: Bryce on 09:20, 19 March 10
Connecting an ADC (Analogue to Digital Convertor) to the expansion port, mapped to an address, would be simple and not particularly expensive to build and would work on all CPCs, I'd put together a schematic if somebody really wants it, but is the interest there? How many people are interested in building a piece of hardware with such limited functionality?

Bryce.
Title: Re: sampling sound using cpc+ analogue port
Post by: arnoldemu on 10:39, 19 March 10
Quote from: MacDeath on 01:35, 19 March 10
Perhaps the 464+ is not the shitfest unusefull shit we may think...
Fantastic. I love the use of 464+ and shitfest here.

I have a 464+ (and a 6128+), and indeed it is like having a geforce 8 graphics card with 32k of ram  :P
Title: Re: sampling sound using cpc+ analogue port
Post by: arnoldemu on 10:40, 19 March 10
Quote from: Cholo on 01:03, 19 March 10
Back in the day i visited a fellow Amstrad user and got a sample program he had written himself. Idea of the program was quite simple. It would record up to about 20 second of audio from a audio tape. Simply had to insert a tape in my 464 and it would read the audio back and create a rsx for playback. You could then save the whole thing and use it in your basic programs.
What impressed me back then was the quality of the audio, as it was much "cleaner" than the usual game samples. Fun and easy recording your own voice yelling "King of the world" then let the 464 tapedeck read it into memory and then hear it play back from the speakers.
This sounds like the common sample using the tape-input, 1-bit samples.

It is actually suprising how well it can do this especially since the tape hardware is effectively turning an analogue input into a 1-bit digital output.

Title: Re: sampling sound using cpc+ analogue port
Post by: arnoldemu on 10:42, 19 March 10
Quote from: Bryce on 09:20, 19 March 10
Connecting an ADC (Analogue to Digital Convertor) to the expansion port, mapped to an address, would be simple and not particularly expensive to build and would work on all CPCs, I'd put together a schematic if somebody really wants it, but is the interest there? How many people are interested in building a piece of hardware with such limited functionality?

Bryce.
hmmm.. I'm not interested to be honest,  I was more wondering if the existing analogue on the cpc+ can be used.
But it seems no, it is useless. I am not sure that putting all the ADC channels together would actually increase the sample rate. I suppose it all depends on how each of the adc channels are updated. e.g. if they are all updated in parallel or if they are updated serially.

Serially, then you could improve the sample rate because you would spread the samples over the time, parallel then all your getting is a better sample value (e.g. 16-bit compared to 8-bit) but still every 200Hz  :P
Title: Re: sampling sound using cpc+ analogue port
Post by: redbox on 10:55, 19 March 10
Quote from: Bryce on 09:20, 19 March 10
Connecting an ADC (Analogue to Digital Convertor) to the expansion port, mapped to an address, would be simple and not particularly expensive to build and would work on all CPCs, I'd put together a schematic if somebody really wants it, but is the interest there? How many people are interested in building a piece of hardware with such limited functionality?

I'm pretty sure Dragonbreed Wetware did this back in the day... they had some 4-bit samples on a classic CPC that sounded really good.

Can't find a link to the DSK on any of the normal FTP servers though  :(
Title: Re: sampling sound using cpc+ analogue port
Post by: arnoldemu on 11:59, 19 March 10
Quote from: redbox on 10:55, 19 March 10
I'm pretty sure Dragonbreed Wetware did this back in the day... they had some 4-bit samples on a classic CPC that sounded really good.

Can't find a link to the DSK on any of the normal FTP servers though  :(
I've seen these, but I don't have any of them anymore :(
Title: Re: sampling sound using cpc+ analogue port
Post by: MacDeath on 14:37, 19 March 10
http://cpcwiki.eu/index.php/Ultra_Son

Ultra Son, I was searching how it was named.

Has some of you tried it on a 464+ yet ?
Do you think the software be updated to get extra stuff for the PLUS range  or extra memory ? is this even possible ?

Or is it better to get a proper hardware extension card indeed ?

QuoteFantastic. I love the use of 464+ and shitfest here.
I was in BDC-IRON mode... ;D
But yeah, a shame a PLUS from Amstrad still got only 64K while any Amstrad's Speccy had their 128K on...Oh, and tapes of course...


Yet it may be a usefull use to add the Tape connector socket to a 6128+...
Title: Re: sampling sound using cpc+ analogue port
Post by: zhulien on 11:14, 29 September 16
From memory I put the Dragonbreed sampled I think We're Alone Now on the 1994 CPC Decade CDROM for Amstrad CPC if you can find it... It does have a very good quality sample - which makes me wonder if it uses a similar method to the 14 bit Samples on OCS Amigas.  But CPC has really only 3 bits and a noise - with the PlayCity we now have 9bits and 3 noises, so maybe a better quality 8+ bit sample method can play on that combination.  By playing all 3 AY's at different volumes hopefully with minimal or no overlap - then playing the sample bits out to all 3 chips.  The downside is that it will sound crap if you are listening in stereo - so might want to run the outputs back to the CPC's audio line in on the expansion bus so that all 3 chips come out through the internal speaker.
Title: Re: sampling sound using cpc+ analogue port
Post by: Shining on 15:06, 29 September 16
Back in 87 or 88 I was jealous about something I've seen on an evil commodore machine. The thing played a song called holiday rap (https://en.wikipedia.org/wiki/Holiday_Rap). Then some time later the german mag CPCAI published a rsx-extension to record via tape and play this back. So I did a version, for sure superior to the evil version, of this rap. Also using some loops, years before we had something like the digitrakker. Since I did not own this song, I recorded it from fm-radio. So the cpc-version is recorded from a recorded version  :) .


So for reference, here an attached dsk with the rap and the rsx-extension.


I think, I still have the CPCAI issue. So if there is interest (especially perhaps for our basic-coders here), I can translate the article.
Title: Re: sampling sound using cpc+ analogue port
Post by: PulkoMandy on 15:37, 29 September 16
Quote from: arnoldemu on 10:42, 19 March 10
But it seems no, it is useless. I am not sure that putting all the ADC channels together would actually increase the sample rate. I suppose it all depends on how each of the adc channels are updated. e.g. if they are all updated in parallel or if they are updated serially.

Serially, then you could improve the sample rate because you would spread the samples over the time, parallel then all your getting is a better sample value (e.g. 16-bit compared to 8-bit) but still every 200Hz  :P


It's quite likely to be done serially, as this allows a single real DAC unit, and an analogue multiplexer to connect it to the various outputs. In a typical converter there is a "sample and hold" (https://en.wikipedia.org/wiki/Sample_and_hold) unit, and then the actual conversion is done on the stored value. It is easy to sample from multiple sources serially, then.
Title: Re: sampling sound using cpc+ analogue port
Post by: TFM on 16:06, 29 September 16
Why to invent the wheel again?


We got the very wonderful CPC Booster+ which allows to sample stereo in 8 bit. For playback you can use it too (stereo) or you also can use the DigiBlaster (however in mono only).


And for MP3 playback somebody could make some more FuturePlayers.  ;D
Title: Re: sampling sound using cpc+ analogue port
Post by: ASiC on 21:43, 29 September 16
Quote from: TFM on 16:06, 29 September 16


And for MP3 playback somebody could make some more FuturePlayers.  ;D


Yeah, but we'll need an mp3 encoder for the CPC ...
I'm assuming speed will be around one track per month?!  :P
Title: Re: sampling sound using cpc+ analogue port
Post by: zhulien on 15:00, 30 September 16
Really cpc booster+ can do that?
Title: Re: sampling sound using cpc+ analogue port
Post by: TFM on 15:47, 30 September 16
Quote from: ASiC on 21:43, 29 September 16

Yeah, but we'll need an mp3 encoder for the CPC ...
I'm assuming speed will be around one track per month?!  :P

Why using an encoder, you can everything online in these days. And CPC can play up to 128 kbps. Never tried more, it may be possible.

Quote from: zhulien on 15:00, 30 September 16Really cpc booster+ can do that?

Yes, you just read or write to a port. Everything else (also the timing!) can be done by the CPC Booster+. But don't confuse it with the cut down Mini-Booster, the Mini-Booster can't.
Title: Re: sampling sound using cpc+ analogue port
Post by: PulkoMandy on 15:49, 30 September 16
One of the two jacks is the audio/analog input. The other is audio/PWM output. So yes, it can do that.
I think the only software using this is ROM Orange: http://ftp.cpc-power.com/index.php?page=detail&num=7683 (http://ftp.cpc-power.com/index.php?page=detail&num=7683)
Title: Re: sampling sound using cpc+ analogue port
Post by: TotO on 18:12, 30 September 16
Quote from: TFM on 15:47, 30 September 16But don't confuse it with the cut down Mini-Booster, the Mini-Booster can't.
Exactly, the CPC Booster offer an ADC feature while the MiniBooster offer a SPI interface.
Title: Re: sampling sound using cpc+ analogue port
Post by: TFM on 18:46, 30 September 16
Quote from: TotO on 18:12, 30 September 16
Exactly, the CPC Booster offer an ADC feature while the MiniBooster offer a SPI interface.


Can you please tell how to use the SPI for sound-sampling and playback? Sorry for asking, but I'm more a Softie Software person.  ;) :)
Title: Re: sampling sound using cpc+ analogue port
Post by: TotO on 19:52, 30 September 16
The MiniBooster offer two PWM channels for playback.
About sampling, we can probably do something funny with that: https://www.adafruit.com/product/856


:-*
Title: Re: sampling sound using cpc+ analogue port
Post by: TFM on 22:02, 30 September 16
Quote from: TotO on 19:52, 30 September 16
The MiniBooster offer two PWM channels for playback.
About sampling, we can probably do something funny with that: https://www.adafruit.com/product/856
:-*


Ah cool!  :)  How to connect to PWM channels to an amplifier?

Title: Re: sampling sound using cpc+ analogue port
Post by: Bryce on 22:22, 30 September 16
Quote from: TFM on 22:02, 30 September 16

Ah cool!  :)  How to connect to PWM channels to an amplifier?

PWM is a digital signal, it would need to be decoded, not just amplified.

Bryce.
Title: Re: sampling sound using cpc+ analogue port
Post by: TFM on 23:44, 30 September 16
Quote from: Bryce on 22:22, 30 September 16
PWM is a digital signal, it would need to be decoded, not just amplified.

Bryce.


Would be great if somebody could show how to wire it.  ;) :)
Title: Re: sampling sound using cpc+ analogue port
Post by: TotO on 04:27, 01 October 16
No decoding is required... Just add a lowpass filter and listen the analog result.
You can out stereo 8bit or mono 16bit with a 57.5kHz maximum accuraty with the MiniBooster.


(http://www.openmusiclabs.com/wp/wp-content/uploads/2013/01/dual_pwm.jpg)



https://www.youtube.com/watch?v=tCmaOb-VAEo
Title: Re: sampling sound using cpc+ analogue port
Post by: Bryce on 10:41, 01 October 16
Ah, I thought it was a proper PWM encoded binary, so it's just a PWM of the analogue voltage levels.

Bryce.

Gesendet von meinem Motorola DynaTEC 8000X mit Tapatalk.

Title: Re: sampling sound using cpc+ analogue port
Post by: TFM on 01:30, 02 October 16
Aha, ok, if somebody will build one, I'll happily buy it.  :)
Title: Re: sampling sound using cpc+ analogue port
Post by: zhulien on 13:35, 02 October 16
Me too. Today i was playing with the cpcbooster+. Didnt know the minibooster preserved the audio playback. Id rather the minibooster given the formfactor.  I also was wondering how to get audio out in the most convenient way. Pitty playcity didnt have an audio in for daisy chaining/amplifying.  Dont really want 3 sound systems to hear all the cpcs audio too... on the amdrum i was able to wire the audio out back to the audio in on the expansion bus. Can minibooster or cpcbooster+ work that way?
Title: Re: sampling sound using cpc+ analogue port
Post by: TotO on 21:06, 02 October 16
Quote from: zhulien on 13:35, 02 October 16Pitty playcity didnt have an audio in for daisy chaining/amplifying.  Dont really want 3 sound systems to hear all the cpcs audio too...
It is not the Playcity work to mix the differents audio sources...  :-\
Better to use an external audio mixer box to manage all the sources with the good amplification.
Title: Re: sampling sound using cpc+ analogue port
Post by: zhulien on 03:35, 03 October 16
Quote from: TotO on 21:06, 02 October 16
It is not the Playcity work to mix the differents audio sources...  :-\
Better to use an external audio mixer box to manage all the sources with the good amplification.


Please don't take it as a criticism. Playcity is great :)  Still i wished it did that to fix the deficiencies in everyone else's audio solutions.
Title: Re: sampling sound using cpc+ analogue port
Post by: TotO on 09:17, 03 October 16
I don't take that bad, I just said that is not his job.  ;)
It would have made the board more complex to not solve all the mixing problem.
Title: Re: sampling sound using cpc+ analogue port
Post by: Bryce on 08:55, 04 October 16
Quote from: zhulien on 03:35, 03 October 16

Please don't take it as a criticism. Playcity is great :)  Still i wished it did that to fix the deficiencies in everyone else's audio solutions.

My version of the DigiBlaster had an Audio input to allow daisy-chaining of sources.

Bryce.
Title: Re: sampling sound using cpc+ analogue port
Post by: TotO on 09:22, 04 October 16
Quote from: Bryce on 08:55, 04 October 16
My version of the DigiBlaster had an Audio input to allow daisy-chaining of sources.
Yes, but it is not a good way to process. Serial mixing by chaining only destroy the sound quality each time that you will add an audio source.
A clever way will be to use an external parallel mixer with audio amplifiers powered by at less +12Vcc.

EDIT:
To understand better how audio mixing is a pain in ass, here the schematic for 3 mono channels.
You require two times this for properly mixing 3 stereo inputs.  :D

(http://www.electroschematics.com/wp-content/uploads/2008/09/audio-mixer-schematic.gif)
Title: Re: sampling sound using cpc+ analogue port
Post by: Bryce on 10:11, 04 October 16
Yup, to do it properly you need to normalise the signals and the mix them through a single op-amp. In the case of the DigiBlaster, I just wanted a very simple (cheap) method of allowing the AY output to come out the same speakers as the DigiBlaster sound. I also had the problem that I didn't have a power source on the printer port to use.

Bryce.
Title: Re: sampling sound using cpc+ analogue port
Post by: TotO on 10:17, 04 October 16
Yes, exactly!
Powered by SMFPacks Menu Editor Mod