Well, it's "trivial" to adapt to the Oric all the methods used on other AY/YM based machines.

I did my first 8 bit replay routine in 1997, for the "Oric Mega Demo" - mega only in the name -, making it replay the "Welcome" sample of the Barbarian 2 game "Welcome to the Dungeon of Drax: Please choose your warrior".

Performance wise, 8 bits is not very efficient, it's easier and way less CPU intensive to replay 4 bits samples. It also takes half the memory, since you can pack 2 samples on one byte.

The idea is just to play with the volume registers on the chanels. On one chanel you can get a value between 0 and 15 (0 to 1volt), and by using two or three chanels, you can get a larger value which increase the number of potential values and the volume (from 0 to 3 volts), giving a nearly 8 bit quality by using the cumulated 12 bits creatively.

I used the conversion tables from ST Replay, and they worked fine on the Oric as well.

Twilighte can provide good code for replaying samples. Mine is very crappy, I did that a very long time ago.

Thanks Dbug, Pure WAV files from the PC contain about 16 or 32 bytes of header info, which is not so cool at the start of a sample when played on the Oric.

Their are several ways to play samples on the Oric, some are faster than others but remember, the faster the routine the more memory the sample may use.
I have written sample players from 200Hz up to 44Khz.
If you need a routine, let me know and i'll see if i can find time to find one.

- welcome.s is a 8bit sample saved in raw/unsigned format
- digit.s is the replay code, including three 256 bytes tables used to convert the 8 bit sample to a single 4 bits value for each separate chanel.

waskol wrote:DBUG, I am afraid but... you are the best !!!!
It is really impressive.

This demo shows that it is possible to get anything out of the oric...
really impressive... (my jaw is still on the floor...)

Well, I only adapted what we did on the Atari ST (same sound chip).

And both Fabrice and Twilighte made sample sound, and there is this Rambo demo of the Tivoli Pirat as well, so please give the credits to other people

Well, a last technical question about this wonderfull "welcome".

what is the sample rate of this ?

For example, imagine that I want to digitalize a sound effect and play it back :
- First I convert my little wav file to an unsigned 8 bits (but at which sample rate ?)
- then I extract the raw data (it is just a question of removing the wav header, and convert the binaries to a text file)
- finally I compile with OSDK

Thing is, this routine does not use any timer, it is just disabling the interruptions and try to send stuff to the soundchip as fast as possible.

You probably noticed the 7 "nop" instructions, it's to slow down the replay.

The faster the loop, the higher the frequency

If you use a sample at a different (lower) frequency, you can just change the number of nop, or use instructions that take more time, this way you can play longer samples.

Also you can probably optimise the code quite a lot

If you use one channel instead of 3, the sound quality is a lot worse, but then you can use 4 bit samples, meaning that you store twice as many sample data in the same number of bytes, and you speedup the code by a HUGE factor (not x3, a lot more) because you can remove almost all the VIA register switching. Just need to select the volume register and write values in here as fast as you can - the methid we used to replay the 20th century fox and Digital DTS jingles in the other demos -