Ooops
July 26, 2021, 15:00:14

Author Topic: Creating ZX SOUND  (Read 3154 times)

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2343
Re: Creating ZX SOUND
« Reply #90 on: July 16, 2021, 18:51:30 »
Quote
I am getting this message sometimes. RINGBUFFER: Prevent "Buffer Overrun! Wait for 20 msec"
Ive already tried ajusting the 40Khz down to 22,100Hz but then emulation runs very slow and laggy.
Im going to try and not use the CheckBufferOverRun() Function and see what effect that has.

That would suggest something is wrong with the ring buffer. Plus also the code itself might be doing something funky.

As an example a general ringbuffer should support up to 32 channels at the same time with no slowdown!

if you look at the spectrum, the sound is just a simple square wave.

The speed of your system should have no bearing as you should be syncing into the reatime clock and working out timing from there.

if you are looking at the AY chip then you will need to do some serious research into FM synthesis.

Another thing to think about is separating the sound system from the main code in it's own thread system. That way it wont ever slow things down unless you are doing something very odd...

Offline Baggey

  • Full Member
  • ***
  • Posts: 135
Re: Creating ZX SOUND
« Reply #91 on: July 16, 2021, 21:22:06 »
Okay!  ???

Trying Bandicam to upload a video Currently ???

For 'Fook Sake' Don't Laugh. I feel like a 52 year old Kid trying to bash the "ROUND PEG" into the Star "HOLE"  ::) Things used to be so easy!

Nearly there. :-\ This is a 'Hobby'

Baggey
Currently Running a PC that just Aint fast enough!?
ZX Spectrum 48k, NEXT, C64, ORIC Atmos 48K, Enterprise 128K, The SID chip.

Jesus was only famous because of his DAD.

Online Midimaster

  • Sr. Member
  • ****
  • Posts: 329
    • Midimaster Music Education Software
Re: Creating ZX SOUND
« Reply #92 on: July 17, 2021, 00:16:42 »
Quote
I am getting this message sometimes. RINGBUFFER: Prevent "Buffer Overrun! Wait for 20 msec"
Ive already tried ajusting the 40Khz down to 22,100Hz but then emulation runs very slow and laggy.
Im going to try and not use the CheckBufferOverRun() Function and see what effect that has.

That would suggest something is wrong with the ring buffer. Plus also the code itself might be doing something funky.

As an example a general ringbuffer should support up to 32 channels at the same time with no slowdown!

if you look at the spectrum, the sound is just a simple square wave.

The speed of your system should have no bearing as you should be syncing into the reatime clock and working out timing from there.

if you are looking at the AY chip then you will need to do some serious research into FM synthesis.

Another thing to think about is separating the sound system from the main code in it's own thread system. That way it wont ever slow things down unless you are doing something very odd...


That would suggest something is wrong with the ring buffer.

@Adam

could you please read the complete topics before you fire your comments with no context to the theme?

The FreeAudioRingbuffer feeds the Audio-Device with the (user's) given HERTZ, CHANNELS and FORMAT. If then a user fires the double amout of datas every ringbuffer gets to the point of overrun. My FreeaudioRingBuffer reports this at the state of 80% to the DEBUG window to inform the user that the source datas are fired to fast. And it waits for 20msec until the buffer is again free enough to receive the additional datas.

Baggey wants to simulate with the FreeAudioRingbuffer an old Spectrum Hardware. On the old hardware the timing was always perfect, because the hardware speed was a given limitation. If he now fires the same datas on a modern computer, then they reach 10 to 100 times faster the "soundchip". So, when he now received the message "buffer overrun" this means that his simulator timing is faster than the original vintage timing was.

His problem is not that the FreeAudioRingbuffer slows down! He does not send 32 channels but one!!!! My FreeaudioRingbuffer is 100% able to handle 32 channels with 96kHz and 4byte-FLOATs.

But he sends SF_MONO8 with 40kHz and this means only 40000  bytes per second should be sended to the RingBuffer and not 400.000 each second!!!
So he receives the helpful message "Please send slower! This are to many for the rate you decided!"

Quote
if you look at the spectrum, the sound is just a simple square wave
What do you think we are doing here? We send only SQUARE WAVES. But in the tricky way of the 70th.

Quote
...Another thing to think about is separating the sound system from the main code in it's own thread system.
What do you think we are doing here? FreeAudioRingBuffer is in it's own thread system.

Sometimes READING would help!
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

Offline Baggey

  • Full Member
  • ***
  • Posts: 135
Re: Creating ZX SOUND
« Reply #93 on: July 24, 2021, 14:16:06 »
So Finaly a post of SpecBlitz playing "Jet Set Willy".

Cant get Full screen video up  ??? This isnt really a showcase im still trying to get Sounds to work! And further mods todo to the SpecBlitz Emulator.

There are holes in the in game tune and when an effect of jump, collect item or being Killed. Video is about 4 Mins but ive tried to capture every sound effect that should or dosent happen  ;D

Im getting buffer Overrun at the mo will try code for more precise TCycles latter  ;)



I will indue corse get some more vids up with other game sounds trying to demonstrate where sounds are or arent working.

Kind Regards Baggey
Currently Running a PC that just Aint fast enough!?
ZX Spectrum 48k, NEXT, C64, ORIC Atmos 48K, Enterprise 128K, The SID chip.

Jesus was only famous because of his DAD.

Offline Baggey

  • Full Member
  • ***
  • Posts: 135
Re: Creating ZX SOUND
« Reply #94 on: July 24, 2021, 14:56:07 »
MidiMaster has a new Version of the RingBuffer Version 1.2

https://www.syntaxbomb.com/worklogs/done!-a-new-audio-out-approach-in-blitzmax-freeaudio-ringbuffer/msg347049187/#msg347049187

I Shall try this new code in SpecBlitz to see if it will iron out writing to fast to the Ring Buffer.

Hopefully we may hear Sound's that are being misssed by my incorrect timing or Buffer overrun's  ;D

Baggey
Currently Running a PC that just Aint fast enough!?
ZX Spectrum 48k, NEXT, C64, ORIC Atmos 48K, Enterprise 128K, The SID chip.

Jesus was only famous because of his DAD.

Offline Baggey

  • Full Member
  • ***
  • Posts: 135
Re: Creating ZX SOUND
« Reply #95 on: July 24, 2021, 16:50:14 »
Here's a Link to Highway Encounter about 4 mins



I think all sounds in this game are being Sounded but i think there are small holes in the sound. This could be due to my Timing not quite right.

Not Running RingBuffer 1.2 yet and if i need to make my Timing more acurate thats a lot of CODE to alter  :o

Noticed theres a write to 16384 which isnt aloud when watching back video! Could be a another Bug ive just found  :-X

Kind Regards Baggey
« Last Edit: July 24, 2021, 17:00:26 by Baggey »
Currently Running a PC that just Aint fast enough!?
ZX Spectrum 48k, NEXT, C64, ORIC Atmos 48K, Enterprise 128K, The SID chip.

Jesus was only famous because of his DAD.

Online Midimaster

  • Sr. Member
  • ****
  • Posts: 329
    • Midimaster Music Education Software
Re: Creating ZX SOUND
« Reply #96 on: July 25, 2021, 10:00:02 »
There are holes in the in game tune and when an effect of jump, collect item or being Killed. Video is about 4 Mins but ive tried to capture every sound effect that should or dosent happen  ;D

Im getting buffer Overrun at the mo will try code for more precise TCycles latter  ;)



In your audio example you can hear both possible situations with the RingBuffer. And you can als ohear how comfortable the Overrun message works.

As long as the Ringbuffer fires the Overrund-Message the sounds are perfect. This is because the Ringbuffer takes command about the corrrect timing. Your app fires the datas to fast and the fingbuffer interrupts your app and forces it to send a optimal timing. So in this situation your timing control fails and the app is sending to often packets.

The second possible situation is that your app sends datas too slow. Now the number of datas reaching the ringbuffer are to low. you can hear this in the "stuttering". This is caused by little pauses where the buffer has no more data to process and it reacts with SILENCE.

There a some possible solutions or reasons for this:

1. The buffer works to fast. Set the HERTZ lower and the buffer expects less datas.

2. The sender sends to slow. Try to send the packets more often.

3. The processor speed simulation is not perfect.
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal