CPCWiki forum

General Category => General Discussion - Introductions => Topic started by: mr_lou on 16:51, 14 June 11

Title: Which emulator has the most accurate sound playback?
Post by: mr_lou on 16:51, 14 June 11
When listening to my tracks in various emulators, I find that none of them plays back my tracks correctly.
Arnold plays one channel much too loud.
WinAPE seems to put too much volume on all channels, as if the volume is linear.
JavaCPC seems to cut off too much volume, leaving some instruments mute

Sorry if this has been discussed before. Was too lazy to do a search. But I'm also hoping new versions of various emulators have become better.
Title: Re: Which emulator has the most accurate sound playback?
Post by: arnoldemu on 17:15, 14 June 11
Quote from: mr_lou on 16:51, 14 June 11
When listening to my tracks in various emulators, I find that none of them plays back my tracks correctly.
Arnold plays one channel much too loud.
WinAPE seems to put too much volume on all channels, as if the volume is linear.
JavaCPC seems to cut off too much volume, leaving some instruments mute

Sorry if this has been discussed before. Was too lazy to do a search. But I'm also hoping new versions of various emulators have become better.

Are you talking about the sound from the internal speaker, or sound from the stereo connector? There is a difference between the two.

I think most emus emulate the stereo connector sound.
Title: Re: Which emulator has the most accurate sound playback?
Post by: mr_lou on 17:27, 14 June 11
Quote from: arnoldemu on 17:15, 14 June 11
Are you talking about the sound from the internal speaker, or sound from the stereo connector? There is a difference between the two.

I think most emus emulate the stereo connector sound.

Yes, it's the stereo output.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Phi2x on 19:11, 14 June 11
.
Title: Re: Which emulator has the most accurate sound playback?
Post by: mr_lou on 20:34, 14 June 11
Quote from: phi2x on 19:11, 14 June 11
Something is coming very soon... ;)

I like the sound of that. :)
Do I dare hope it'll run on Linux?  ::)
Title: Re: Which emulator has the most accurate sound playback?
Post by: Phi2x on 21:24, 14 June 11
.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Executioner on 01:36, 15 June 11
Quote from: mr_lou on 16:51, 14 June 11
WinAPE seems to put too much volume on all channels, as if the volume is linear.

WinAPE has always had logarithmic volumes (at least since 2.0A9).

The logarithmic volumes used by WinAPE are:

0,1,3,4,5,7,8,10,12,14,16,19,23,27,33,42

Assuming your sound cars has linear volumes of course. Perhaps this isn't logarithmic enough.

These are used so I can add three channels at maximum volume and still get a value less than 127.

Title: Re: Which emulator has the most accurate sound playback?
Post by: mr_lou on 06:42, 15 June 11
Quote from: Executioner on 01:36, 15 June 11
WinAPE has always had logarithmic volumes (at least since 2.0A9).

The logarithmic volumes used by WinAPE are:

0,1,3,4,5,7,8,10,12,14,16,19,23,27,33,42

I don't suppose those values would be easy to find in the exe file with a hex-editor? I'd like to have a go at finding the values I think should be there.

(Or how about changing those values in JavaCPC Markus? I suppose I should look at the source then. Can you tell me which source file the volumes are encoded in?)

I compose my tracks using a CPC464. I don't suppose this should mean anything? I mean, can this create a different sound on a CPC6128? My CPC6128 is packed down at the moment, so I can't check. But as far as I can remember, my CPC464 and CPC6128 plays back STarKos tracks the same.
Title: Re: Which emulator has the most accurate sound playback?
Post by: McKlain on 08:12, 15 June 11
Quote from: mr_lou on 16:51, 14 June 11
When listening to my tracks in various emulators, I find that none of them plays back my tracks correctly.
Arnold plays one channel much too loud.
WinAPE seems to put too much volume on all channels, as if the volume is linear.
JavaCPC seems to cut off too much volume, leaving some instruments mute

Sorry if this has been discussed before. Was too lazy to do a search. But I'm also hoping new versions of various emulators have become better.

Have you tried CPCE?
Title: Re: Which emulator has the most accurate sound playback?
Post by: Bryce on 09:13, 15 June 11
The sound on a real 464 should be identical to the sound on a real 6128 because they use exactly the same circuit and components.

Bryce.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 12:17, 15 June 11
Quote from: mr_lou on 06:42, 15 June 11
I don't suppose those values would be easy to find in the exe file with a hex-editor? I'd like to have a go at finding the values I think should be there.

(Or how about changing those values in JavaCPC Markus? I suppose I should look at the source then. Can you tell me which source file the volumes are encoded in?)

Well JavaCPC already uses logarithmic sound.
Whereby JavaCPC has volume values between 0 and 15...
You can choose between 4 presets in the audio-settings.
I of course also compared JavaCPC (And a few other emulators, too) with the real CPC sound.
You can select 2 presets from AY_Emul, the CPCe95 preset and linear sound output.
The values of them you can see here:
    //
    // AY Amplitude values taken from CPCe95
    // and re-calculated for JavaCPC
    //
    // To calculate:
    // FOR n=0 TO 15: PRINT 15*(2^((1+n)/2))/256: NEXT n
    public static final double[] LOG_VOLUME = {
        0.08286408, 0.1171875, 0.1657282, 0.234375,
        0.3314563, 0.46875, 0.6629126, 0.9375,
        1.325825, 1.875, 2.65165, 3.75,
        5.303301, 7.5, 10.6066, 15
    };
    //
    // AY Amplitude values taken from Ay_Emul
    // and re-calculated for JavaCPC (divided with 4369)
    //
    // { (c)Hacker KAY }
    //  Amplitudes_AY:array[0..15]of Word=
    //   (0, 836, 1212, 1773, 2619, 3875, 5397, 8823, 10392, 16706, 23339,
    //   29292, 36969, 46421, 55195, 65535);
    public static final double[] LOG_VOLUME_A = {
        0, 0.117418174, 0.189517052, 0.283588922, 0.440146487,
        0.741130694, 1.12748913, 2.08514534, 2.36758984, 4.09155413,
        5.64934768, 6.96772717, 8.8908217, 10.8194095, 12.9095903, 15
    };
    //{ (c)V_Soft }
    // Amplitudes_AY:array[0..15]of Word=
    //   (0, 513, 828, 1239, 1923, 3238, 4926, 9110, 10344, 17876, 24682,
    //   30442, 38844, 47270, 56402, 65535);}
    public static final double[] LOG_VOLUME_B = {
        0, 0.191348135, 0.277409018, 0.405813687, 0.599450675,
        0.886930648, 1.23529412, 2.01945525, 2.37857633, 3.8237583,
        5.34195468, 6.70450904, 8.46166171, 10.6250858, 12.6333257, 15
    };
    public static final double[] LOG_VOLUME_L = {
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
    };


That sound is perhaps still a bit in-accurate does not depend on the logarithms but more on incomplete emulation.
(You still can hear fancy tones when you playback "Tire-Au-Flan" demo for example... It has a few disturbing sounds (Same than in WinApe.))

But JEMU already has some AY change. I'll try to implement them soon in JavaCPC, too...
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 12:50, 15 June 11
Here's a small diagram for WinApe's, CPCe's and JavaCPC's volume tables:
10 INK 0,0:BORDER 0:INK 1,26:INK 2,2:INK 3,6:MODE 1:GOSUB 360:PLOT 0,0,1
20 LOCATE 1,1:PRINT"CPCe AY volume table"
30 FOR n=0 TO 15: a=15*(2^((1+n)/2))/256
40 a=a*25
50 DRAW d,a,1:FOR t=-4 TO 4 STEP 2:PLOT d+t,a-4,3:DRAW d+t,a+4:NEXT t:PLOT d,a,1:d=d+(640/16)
60 NEXT
70 CALL &BB18
80 PLOT 0,0,1
90 LOCATE 1,1:PRINT"JavaCPC AY volume table A (Hacker Kay)"
100 RESTORE 330:d=0
110 FOR n=0 TO 15: READ a
120 a=a*25
130 DRAW d,a,1:FOR t=-4 TO 4 STEP 2:PLOT d+t,a-4,3:DRAW d+t,a+4:NEXT t:PLOT d,a,1:d=d+(640/16)
140 NEXT
150 CALL &BB18
160 PLOT 0,0,1
170 LOCATE 1,1:PRINT"JavaCPC AY volume table B (V-Soft)     "
180 RESTORE 340:d=0
190 FOR n=0 TO 15: READ a
200 a=a*25
210 DRAW d,a,1:FOR t=-4 TO 4 STEP 2:PLOT d+t,a-4,3:DRAW d+t,a+4:NEXT t:PLOT d,a,1:d=d+(640/16)
220 NEXT
230 CALL &BB18
240 PLOT 0,0,1
250 LOCATE 1,1:PRINT"WinApe AY volume table            "
260 RESTORE 350:d=0
270 FOR n=0 TO 15: READ a:a=a/2.8
280 a=a*25
290 DRAW d,a,1:FOR t=-4 TO 4 STEP 2:PLOT d+t,a-4,3:DRAW d+t,a+4:NEXT t:PLOT d,a,1:d=d+(640/16)
300 NEXT
310 CALL &BB18
320 RUN
330 DATA 0, 0.117418174, 0.189517052, 0.283588922, 0.440146487,0.741130694, 1.12748913, 2.08514534, 2.36758984, 4.09155413,5.64934768, 6.96772717, 8.8908217, 10.8194095, 12.9095903, 15
340 DATA 0, 0.191348135, 0.277409018, 0.405813687, 0.599450675,0.886930648, 1.23529412, 2.01945525, 2.37857633, 3.8237583,5.34195468, 6.70450904, 8.46166171, 10.6250858, 12.6333257, 15
350 DATA 0,1,3,4,5,7,8,10,12,14,16,19,23,27,33,42
360 FOR t=0 TO 15:PLOT 0,t*25,2:DRAW 600,t*25:NEXT
370 d=0:FOR t=0 TO 15:PLOT d,0:DRAW d,374:d=d+(640/16):NEXT:d=0:RETURN


Edit: updated code!
Title: Re: Which emulator has the most accurate sound playback?
Post by: mr_lou on 13:05, 15 June 11
Quote from: Devilmarkus on 12:17, 15 June 11
You can choose between 4 presets in the audio-settings.
I of course also compared JavaCPC (And a few other emulators, too) with the real CPC sound.
You can select 2 presets from AY_Emul, the CPCe95 preset and linear sound output.

I actually missed those, but just tried them out now. I'm sorry to say that none of them gives the correct playback.
Any way I can change each of the 15 values individually, in order to make a custom volume table?

Quote from: mcklain on 08:12, 15 June 11
Have you tried CPCE?

No, but if it uses the same table as the CPCe95 option in JavaCPC, then it's no good either.
Title: Re: Which emulator has the most accurate sound playback?
Post by: arnoldemu on 13:05, 15 June 11
My answer to you is that none of the emus give an accurate result ;)
Title: Re: Which emulator has the most accurate sound playback?
Post by: Bryce on 13:09, 15 June 11
You can't beat real hardware with that "software-stuff" you all seem to be so fond of :D

Bryce.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 13:13, 15 June 11
Quote from: mr_lou on 13:05, 15 June 11
I actually missed those, but just tried them out now. I'm sorry to say that none of them gives the correct playback.
Any way I can change each of the 15 values individually, in order to make a custom volume table?

To say that exactly you would need to connect your CPC to a clear, non-logarithmic hifi-system!
A CPC will sound different on several HIFI-systems.

Sure you can change the volume-tables in JEMU.core.device.sound.AY_3_8910.java... But I don't think this makes sense until you really check your CPC direct output... (Perhaps by measuring the voltages on the 3,5mm jack?)
Title: Re: Which emulator has the most accurate sound playback?
Post by: arnoldemu on 13:16, 15 June 11
Quote from: Bryce on 13:09, 15 June 11
You can't beat real hardware with that "software-stuff" you all seem to be so fond of :D

Bryce.
True, it's not as good as the stylophone.
Title: Re: Which emulator has the most accurate sound playback?
Post by: mr_lou on 13:16, 15 June 11
Quote from: arnoldemu on 13:05, 15 June 11
My answer to you is that none of the emus give an accurate result ;)
Quote from: Bryce on 13:09, 15 June 11
You can't beat real hardware with that "software-stuff" you all seem to be so fond of :D

Of course not, but this is a question about a simple volume table that seems to be wrong on all emulators. That's silly.
One thing is to accurately simulate the synth, especially when talking sawtooth, but to not play the synth at the correct volume is just silly, when it easy to adjust.

I have my PC and my CPC connected to the same mixer, so I can have the sound from both output at the same time. I should be able to find the correct volume table relatively easy.
Just gimme the tool to adjust the volume-table in some emulator.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 13:23, 15 June 11
Stylophone:
80s Hits Medley - STYLOPHONE (http://www.youtube.com/watch?v=HkTQsOQLEeU#)
Title: Re: Which emulator has the most accurate sound playback?
Post by: McKlain on 13:23, 15 June 11
Quote from: mr_lou on 13:05, 15 June 11No, but if it uses the same table as the CPCe95 option in JavaCPC, then it's no good either.

I have no idea of how it works internally, but to me is the one that sounds better. Just give it a try.  :)

http://cngsoft.no-ip.org/cpce/index.htm (http://cngsoft.no-ip.org/cpce/index.htm)
Title: Re: Which emulator has the most accurate sound playback?
Post by: mr_lou on 13:43, 15 June 11
Quote from: mcklain on 13:23, 15 June 11
I have no idea of how it works internally, but to me is the one that sounds better. Just give it a try.  :)

http://cngsoft.no-ip.org/cpce/index.htm (http://cngsoft.no-ip.org/cpce/index.htm)

Groovy! CPCE does give the most accurate playback. The volume-table at least feels about 99%, which is very good.
The timing is a little bit off, but that doesn't matter much. Two CPC's would probably do that too.

So that settles it. CPCE gives the most accurate playback regarding volume-tables, in my opinion. Thanks mcklain.  :)
Title: Re: Which emulator has the most accurate sound playback?
Post by: McKlain on 13:45, 15 June 11
You are welcome  ;D

I know that Cesar put a lot of effort in the sound emulation.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 13:49, 15 June 11
Here are the 4 diagrams I calculated:
Title: Re: Which emulator has the most accurate sound playback?
Post by: mr_lou on 13:49, 15 June 11
Quote from: mcklain on 13:45, 15 June 11
You are welcome  ;D

I know that Cesar put a lot of effort in the sound emulation.

Well tell him he's done a great job. :)

Also, ask him if he'd be willing to shared his volume-table here, so other coders can use it.

Markus: What table is used in JavaCPC when selecting CPCe95? Clearly it's not the one actually used in CPCE.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 13:56, 15 June 11
Quote from: mr_lou on 13:49, 15 June 11
Markus: What table is used in JavaCPC when selecting CPCe95? Clearly it's not the one actually used in CPCE.

This is:

    //
    // AY Amplitude values taken from CPCe95
    // and re-calculated for JavaCPC
    //
    // To calculate:
    // FOR n=0 TO 15: PRINT 15*(2^((1+n)/2))/256: NEXT n
    public static final double[] LOG_VOLUME = {
        0.08286408, 0.1171875, 0.1657282, 0.234375,
        0.3314563, 0.46875, 0.6629126, 0.9375,
        1.325825, 1.875, 2.65165, 3.75,
        5.303301, 7.5, 10.6066, 15
    };


César himself gave me the method how he calculated the volumes.

I'll check the output routines, too, perhaps there is a little bug in...
Title: Re: Which emulator has the most accurate sound playback?
Post by: Bryce on 13:58, 15 June 11
Quote from: mr_lou on 13:43, 15 June 11
The timing is a little bit off, but that doesn't matter much. Two CPC's would probably do that too.

Eh, no. The AY is crystal controlled and those crystals are very accurate, I doubt you would find two CPCs with Timing so different, that you would ever notice it.

Bryce.
Title: Re: Which emulator has the most accurate sound playback?
Post by: mr_lou on 14:03, 15 June 11
Quote from: Bryce on 13:58, 15 June 11
Eh, no. The AY is crystal controlled and those crystals are very accurate, I doubt you would find two CPCs with Timing so different, that you would ever notice it.

Well in that case, the timing in CPCE needs to be slightly faster.  :)
Title: Re: Which emulator has the most accurate sound playback?
Post by: arnoldemu on 14:14, 15 June 11
Quote from: Bryce on 13:58, 15 June 11
Eh, no. The AY is crystal controlled and those crystals are very accurate, I doubt you would find two CPCs with Timing so different, that you would ever notice it.

Bryce.
perhaps the gate-array doesn't divide it correctly?
or would the phase of it compared to the cpu cause the difference?

(16Mhz goes into gate-array, it generates 1Mhz and 4Mhz clocks.)
Title: Re: Which emulator has the most accurate sound playback?
Post by: Bryce on 14:21, 15 June 11
No, they are TTL dividers that don't depend on any other clock/timing and switch instantly, so they would all divide exactly the same. If there was a difference it would be in the femto-second range. Not exactly something you are going to notice.

Bryce.

Edit: This is what's usually used in 8-Bit computers to divide the frequency: http://www.electronics-tutorials.ws/counter/count_1.html (http://www.electronics-tutorials.ws/counter/count_1.html)
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 21:57, 15 June 11
Well, I read what mr lou wrote and so I coded a new audio-settings panel, where you can now user-define your own "very special volume table".
You can now select the "User" preset as volume table and paint with your mouse inside the level-diagram.
The volumes are stored in JavaCPC's ini file and so it restores them when you restart it.
Demonstration:
http://cpc-live.com/ay_settings (http://cpc-live.com/ay_settings)
Title: Re: Which emulator has the most accurate sound playback?
Post by: Executioner on 01:43, 16 June 11
When someone actually figures this out, perhaps they could enlighten me as to what the correct values should be. I would have thought you'd get totally different results depending on the PC sound card also.

The problem with the logarithmic values is they are so close together that at lower volumes there's hardly any difference at all.

P.S. Markus, I like the way you can adjust the settings in JavaCPC while it's playing the music.
Title: Re: Which emulator has the most accurate sound playback?
Post by: AMSDOS on 08:30, 16 June 11
Quote from: Bryce on 13:09, 15 June 11
You can't beat real hardware with that "software-stuff" you all seem to be so fond of :D

Bryce.

Unless your 'alf deaf like I am from loud noise, I have no hope of fine tuning my ears to the smallest of detail! I will say that some games in Winape (e.g. Ikari Warriors) have a high pitched ringing sound which is quite irritating (sorry Richard!), unsure if it's emulator fault, hardware, or something else is happening. I think it's been happening with some of the other games as well!  :(
Title: Re: Which emulator has the most accurate sound playback?
Post by: Bryce on 09:40, 16 June 11
Shit, so our parents were right all along! Listening to Alice Cooper at that volume WILL make us deaf :D

Bryce.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 10:24, 16 June 11
Quote from: Executioner on 01:43, 16 June 11
P.S. Markus, I like the way you can adjust the settings in JavaCPC while it's playing the music.

Thankyou.
The diagram was a very simple piece of code...
Took me less than 1 hour to code it.

Here's the code:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* VolumeDiagram.java
*
* Created on 15.06.2011, 20:46:50
*/
package jemu.ui;

import java.net.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.swing.*;
import javax.imageio.*;
import java.io.*;

import jemu.core.device.sound.AY_3_8910;
import jemu.settings.Settings;

/**
*
* @author Markus
*/
public class VolumeDiagram extends JPanel implements MouseMotionListener {
   
    private JLabel level;
    final Color spot = new Color(0x0ff, 0x000, 0x000, 0x80);
    protected Color choosenspot = new Color(0x0ff, 0, 0);
    BufferedImage bout, glossy;
    protected diagram dia;
    int choosen = 0;
    int puls = 0;
    int pulsdirection = 0x0f;
    double[] volumes;

    public VolumeDiagram() {
        level = new JLabel() {
            public void paintComponent(Graphics g) {
                super.paintComponent(g);
                g.drawImage(dia.getDisplay(), 0, 0, this);
            }
        };

        setMaximumSize(new java.awt.Dimension(313, 100));
        setMinimumSize(new java.awt.Dimension(313, 100));
        setPreferredSize(new java.awt.Dimension(313, 100));
        setLayout(new java.awt.BorderLayout());
        add(level, java.awt.BorderLayout.CENTER);
        dia = new diagram();
        level.addMouseMotionListener(this);
    }

    public void mouseMoved(MouseEvent e) {
        int x = e.getX();
        choosen = (int) (x / 19.65);
    }

    public void mouseDragged(MouseEvent e) {
        int x = e.getX();
        choosen = (int) (x / 19.65);

        int y = e.getY();
        double yy = y / 6.667;
        if (yy < 0) {
            yy = 0;
        }
        if (yy > 15) {
            yy = 15;
        }
        if (Switches.linear) {
            if (choosen < 16 && choosen >= 0) {
                AY_3_8910.LOG_VOLUME_L[choosen] = 15 - yy;
                Settings.set(Settings.AYVOLUME + Integer.toString(choosen), Double.toString(AY_3_8910.LOG_VOLUME_L[choosen]));
            }
        }
    }

    public class diagram {

        protected BufferedImage getDisplay() {
            if (bout == null) {
                return new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
            }
            volumes = AY_3_8910.LOG_VOLUME_B;
            if (Switches.VSoftOutput) {
                volumes = AY_3_8910.LOG_VOLUME_A;
            }
            if (Switches.CPCE95) {
                volumes = AY_3_8910.LOG_VOLUME;
            }
            if (Switches.linear) {
                volumes = AY_3_8910.LOG_VOLUME_L;
            }
            Graphics g = bout.getGraphics();
            g.setColor(Color.black);
            g.fillRect(0, 0, 313, 100);
            g.setColor(Color.blue);
            for (int i = 0; i < 16; i++) {
                int x = 6 + (i * (320 / 16));
                g.drawLine(x, 0, x, 100);
            }
            for (int i = 0; i < 16; i++) {
                int y = (194 - (int) (i * 12.5)) / 2;
                g.drawLine(6, y, 307, y);
            }
            g.setColor(Color.white);
            int xalt = 6 / 2;
            int v = (int) (volumes[0] * 12.5);
            int yalt = (194 - v) / 2;
            for (int i = 0; i < 16; i++) {
                v = (int) (volumes[i] * 12.5);
                g.drawLine(6 + (i * (320 / 16)), (194 - v) / 2, xalt, yalt);
                xalt = 6 + (i * (320 / 16));
                yalt = (194 - v) / 2;
            }
            for (int i = 0; i < 16; i++) {
                if (choosen == i) {
                    g.setColor(choosenspot);
                } else {
                    g.setColor(spot);
                }
                v = (int) (volumes[i] * 12.5);
                int x = 6 + (i * (320 / 16));
                int y = (194 - v) / 2;
                g.fillOval(x - 4, y - 4, 8, 8);
            }
            g.drawImage(glossy, 0, 0, 313, 100, null);
            return bout;
        }
    };

    public void pulseColor() {
        choosenspot = new Color(puls, 255, 255 - puls);
        puls += pulsdirection;
        if (puls > 255) {
            puls = 255;
            pulsdirection = -0x0f;
        }
        if (puls < 1) {
            puls = 1;
            pulsdirection = 0x0f;
        }
    }

    public void put() {
        URL front = getClass().getResource("icon/glossywindow.png");
        bout = new BufferedImage(313, 100, BufferedImage.SCALE_SMOOTH);
        try {
            glossy = ImageIO.read(front);
        } catch (Exception e) {
        }
        for (int i = 0; i < 16; i++) {
            AY_3_8910.LOG_VOLUME_L[i] = Double.parseDouble(Settings.get(Settings.AYVOLUME + Integer.toString(i), "" + i));
        }
        fireUpdate.start();
    }

    ActionListener update = new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (level.isShowing()) {
                pulseColor();
                level.repaint();
            }
        }
    };
    javax.swing.Timer fireUpdate = new javax.swing.Timer(15, update);
}
Title: Re: Which emulator has the most accurate sound playback?
Post by: Executioner on 11:40, 16 June 11
Quote from: CP/M User on 08:30, 16 June 11

I will say that some games in Winape (e.g. Ikari Warriors) have a high pitched ringing sound which is quite irritating (sorry Richard!), unsure if it's emulator fault, hardware, or something else is happening. I think it's been happening with some of the other games as well!  :(

That may be something to do with the bug which stopped Express Raider from playing at all, who knows. I'll try it out.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 12:18, 16 June 11
Winape (And also JEMU, JavaCPC) also have as "ringing" noise in TAF- demo.
I will record a snippet and upload it to see...
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 12:32, 16 June 11
Here are 3 recordings for the beginning of Tire-Au-Flan demo.
You will clearly hear the ringing noises in WinApe and JavaCPC.
The effect is not hearable in WinCPC and also not on a real CPC.

Also: WinApe's "Noise" output is 1 octave too high... (JEMU's, too!!!)
In JavaCPC this is fixed by 1 added line:
                    case NOISEPERIOD: {
                        int val = (value & 0x1f) * updateStep;
                        // NOISE is 1 octave too high! Let's fix that...
                        val *= 2;
                        int last = period[NOISE];
                        period[NOISE] = val = val == 0 ? updateStep : val;
                        int newCount = count[NOISE] - (val - last);
                        count[NOISE] = newCount < 1 ? 1 : newCount;
                        break;
                    }
Title: Re: Which emulator has the most accurate sound playback?
Post by: einoeL on 13:05, 16 June 11
CPCE sounds nice and punchy, WinApe sounds awful.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 13:13, 16 June 11
Quote from: einoeL on 13:05, 16 June 11
CPCE sounds nice and punchy, WinApe sounds awful.

I think that depends on the personal opinion.
IMO CPCe cuts the sounds too quick and WinApe sounds better here, whereby WinApe sounds more linear than other emulators like WinCPC, JavaCPC or a real AY chip.
Title: Re: Which emulator has the most accurate sound playback?
Post by: einoeL on 13:19, 16 June 11
You're right. CPCE sounds too punchy sometimes, WinApe is the very reverse.
But at the end of the day, CPCE sounds better in most cases.
Title: Re: Which emulator has the most accurate sound playback?
Post by: McKlain on 13:26, 16 June 11
I like it punchy  8)
Title: Re: Which emulator has the most accurate sound playback?
Post by: mr_lou on 15:09, 16 June 11
Quote from: Executioner on 01:43, 16 June 11
When someone actually figures this out, perhaps they could enlighten me as to what the correct values should be. I would have thought you'd get totally different results depending on the PC sound card also.

I'll post the values I feel should be there, when I get the time to sit down and work it out.

Theoretically, since I have my CPC and my PC connected to the same speakers using a mixer, it should be a matter of me typing SOUND commands on both, and starting with the highest volume in order to adjust the mixer first. Then go down and adjust the values in JavaCPC as I go along.

SOUND 1,478,1000,15 for starters to adjust the mixer to both emulator and CPC has the same volume.
SOUND 1,478,1000,14 second, and adjust the value in JavaCPC until I feel they are the same volume.
And then continue down to 1

Shouldn't be a problem as far as I can see.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 15:31, 16 June 11
@ mr_lou: When you checked the volumes and adjusted them all in JavaCPC:
Please check javacpc.ini (Should be in user.home/JavaCPC)
And send me the stored values.
They should look like:
ay_volume_0=0.0
ay_volume_10=8.100344982750862
ay_volume_11=8.550322483875807
ay_volume_12=9.600269986500674
ay_volume_13=11.40017999100045
ay_volume_14=13.200089995500225
ay_volume_15=15.0
ay_volume_1=7.499625018745348E-4
ay_volume_2=0.3007349632518377
ay_volume_3=1.5006749662516867
ay_volume_4=2.250637468126593
ay_volume_5=3.300584970751462
ay_volume_6=3.9005549722513866
ay_volume_7=4.500524973751313
ay_volume_8=5.4004799760012006
ay_volume_9=7.200389980500975

You can change volumes in latest beta:
http://cpc-live.com/data/download.php?type=-beta&fichier=2011_06_16_JavaCPC_Desktop_BETA.zip (http://cpc-live.com/data/download.php?type=-beta&fichier=2011_06_16_JavaCPC_Desktop_BETA.zip)

Also make sure that "AY-Effect" is not enabled! It gives false noises.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Executioner on 03:00, 17 June 11
Quote from: Devilmarkus on 12:32, 16 June 11
Also: WinApe's "Noise" output is 1 octave too high... (JEMU's, too!!!)

I've checked this, and double-checked it. The Noise output appears to be correct on both WinAPE and JEMU. I need to get the real CPC out and try it. I wrote a simple BASIC program:


10 sound 1,0,100,15,,,1
20 call &bb18
30 sound 1,0,100,15,,,31
40 call &bb18
50 goto 10


which seems to sound the same on most emulators, but CPCE 1.81 sounds lower pitched on period 31.
Title: Re: Which emulator has the most accurate sound playback?
Post by: AMSDOS on 08:33, 17 June 11
Quote from: Executioner on 11:40, 16 June 11
That may be something to do with the bug which stopped Express Raider from playing at all, who knows. I'll try it out.

Thanks, I wouldn't say Ikari Warriors is overly bad, it seems to be in the beginning of the tune when it's finished loading and when it returns to that point back in the tune. The other game where I noticed it was notoriously bad is Cavemania, the opening screen tune is fine, followed by the tune on the Island Screen, though when you get into the game itself with the volcano, it's constantly ringing!  :(  It maybe hardware cause I'm always testing out the Sound card though.  :o
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 11:22, 17 June 11
Quote from: Executioner on 03:00, 17 June 11
I've checked this, and double-checked it. The Noise output appears to be correct on both WinAPE and JEMU. I need to get the real CPC out and try it. I wrote a simple BASIC program:


10 sound 1,0,100,15,,,1
20 call &bb18
30 sound 1,0,100,15,,,31
40 call &bb18
50 goto 10


which seems to sound the same on most emulators, but CPCE 1.81 sounds lower pitched on period 31.

Please check the attachment I added in reply #36 ;)
Title: Re: Which emulator has the most accurate sound playback?
Post by: Executioner on 08:21, 18 June 11
Quote from: Devilmarkus on 11:22, 17 June 11
Please check the attachment I added in reply #36 ;)

The taf.zip attachment? Can you make a YM file with this section of the tune on WinAPE, then I can un-lzh it and check out exactly what registers are being changed.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 09:11, 18 June 11
Sure... Here you go:

Edit: Interesting is, that WinApe records the YM properly but when it plays the demo, the sound is weird...
JavaCPC does both: Playback is weird and also the recording, too...  :-X
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 11:46, 18 June 11
Fixed the music in Tire-Au-Flan demo.
Problem: The AY 3 8912 chip uses 16 registers but should be handled like it has 32 registers...
Title: Re: Which emulator has the most accurate sound playback?
Post by: McKlain on 11:50, 18 June 11
Oh, i hear digidrums.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 11:57, 18 June 11
Quote from: mcklain on 11:50, 18 June 11
Oh, i hear digidrums.

Yes, this tune uses digidrums... (That already worked before) ;)
Title: Re: Which emulator has the most accurate sound playback?
Post by: Gryzor on 18:35, 18 June 11
Quote from: Devilmarkus on 21:57, 15 June 11
Well, I read what mr lou wrote and so I coded a new audio-settings panel, where you can now user-define your own "very special volume table".
You can now select the "User" preset as volume table and paint with your mouse inside the level-diagram.
The volumes are stored in JavaCPC's ini file and so it restores them when you restart it.
Demonstration:
http://cpc-live.com/ay_settings (http://cpc-live.com/ay_settings)



Wow, a real-time EQ. Kudos!
Title: Re: Which emulator has the most accurate sound playback?
Post by: Executioner on 01:24, 21 June 11
Quote from: Devilmarkus on 11:46, 18 June 11
Fixed the music in Tire-Au-Flan demo.
Problem: The AY 3 8912 chip uses 16 registers but should be handled like it has 32 registers...

Not sure about this actually Markus. I need to do some more testing.
Title: Re: Which emulator has the most accurate sound playback?
Post by: arnoldemu on 09:37, 21 June 11
Quote from: Executioner on 01:24, 21 June 11
Not sure about this actually Markus. I need to do some more testing.
same here, I re-read the datasheet, made a test program (not run it yet), and it does have only 16 registers.

Title: Re: Which emulator has the most accurate sound playback?
Post by: arnoldemu on 09:41, 21 June 11
Quote from: arnoldemu on 09:37, 21 June 11
same here, I re-read the datasheet, made a test program (not run it yet), and it does have only 16 registers.
I have a program for the cpc that reads the ay registers, does some testing. In the datasheet it says the lower 4 bits are for register select, but only if the upper 4 bits are 0000 exactly. The program tests this, and checks what happens if you write an "invalid" register.

If anyone can test it for me (on a real cpc) and provide me with the results please send me a private message with your e-mail and I will send it to you.

The program lists a lot of numbers, then changes some sound registers (so you need to listen).
Title: Re: Which emulator has the most accurate sound playback?
Post by: robcfg on 10:28, 21 June 11
As for the number of registers, it depends on the AY model, because the 8910 has two IO ports that are accessed as registers, whereas the 8912 has only one IO port and the 8913 has no IO ports.


The YM files contain always 16 registers because the last two of them are used to control the digidrums.By the way, could anyone point me to some info on how the digidrums are stored and how they work?


I found a datasheet that has some errors, it claims that the chip has 16 registers but they are ill numbered in the description and registers 8 and 9 are not there, that left us with the usual 14 sound-generation registers plus the two IO registers.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Phi2x on 10:57, 21 June 11
.
Title: Re: Which emulator has the most accurate sound playback?
Post by: robcfg on 11:13, 21 June 11
Quote from: phi2x on 10:57, 21 June 11
I saw that datasheet. It's because it references the registers by using octal numerotation instead of decimal.
So the 16 registers are then numbered from 0 to 7 and 10 to 17.


Hey, thanks!


I found it too weird and I didn't thought they'd go for anything different as decimal or hexadecimal....
Title: Re: Which emulator has the most accurate sound playback?
Post by: Executioner on 11:41, 21 June 11
The datasheet is correct in this case. There are 16 registers, selecting anything greater than 16 means the data written is ignored since the chip is not selected. This also applies to the extra pins on the AY (A8/A9) which appear to be stored in the internal 10 bit register. GI made some of these chips with different chip select settings so you'd have to use a different set of top bits.

As far as the CPC is concerned, since it's an 8912 and R8/9 aren't used, and all the chips have 000000 select, just ignore data writes if the selected register > 15, and return #ff for register reads.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Executioner on 11:42, 21 June 11
Quote from: robcfg on 11:13, 21 June 11
I found it too weird and I didn't thought they'd go for anything different as decimal or hexadecimal....

Octal was used quite often in electronics and data sheets. This one caught me out the other day.
Title: Re: Which emulator has the most accurate sound playback?
Post by: arnoldemu on 16:38, 21 June 11
Quote from: Executioner on 11:41, 21 June 11
The datasheet is correct in this case. There are 16 registers, selecting anything greater than 16 means the data written is ignored since the chip is not selected. This also applies to the extra pins on the AY (A8/A9) which appear to be stored in the internal 10 bit register. GI made some of these chips with different chip select settings so you'd have to use a different set of top bits.

As far as the CPC is concerned, since it's an 8912 and R8/9 aren't used, and all the chips have 000000 select, just ignore data writes if the selected register > 15, and return #ff for register reads.
My tests confirm the read.

Registers 0-15 return data.
Registers 16-255 return 0x0ff.

My tests for writes were not as conclusive as I hoped.. but they seem to lean towards ignoring data writes (for registers >=16).
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 17:32, 21 June 11
Quote from: arnoldemu on 16:38, 21 June 11
My tests confirm the read.

Registers 0-15 return data.
Registers 16-255 return 0x0ff.

My tests for writes were not as conclusive as I hoped.. but they seem to lean towards ignoring data writes (for registers >=16).

When I return the data here as you explain... (And as how it is in JEMU) the game "death wish 3", "prehistorik 1" (and perhaps more unknown) do strange things:
http://cpc-live.com/dw3bug/ (http://cpc-live.com/dw3bug/)
I did not touch the keyboard while I recorded this video...
Title: Re: Which emulator has the most accurate sound playback?
Post by: Executioner on 04:00, 22 June 11
Quote from: Devilmarkus on 17:32, 21 June 11
When I return the data here as you explain... (And as how it is in JEMU) the game "death wish 3", "prehistorik 1" (and perhaps more unknown) do strange things:
http://cpc-live.com/dw3bug/ (http://cpc-live.com/dw3bug/)
I did not touch the keyboard while I recorded this video...

I'm pretty sure WinAPE isn't doing that, perhaps it's the other fix you put in for Thing On a Spring, which isn't required... Maybe you should try the new AY code.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 07:38, 22 June 11
Quote from: Executioner on 04:00, 22 June 11
I'm pretty sure WinAPE isn't doing that, perhaps it's the other fix you put in for Thing On a Spring, which isn't required... Maybe you should try the new AY code.

Well, it's not because a patch. This bug already happened in the old AY code... ;)
I will give the new code a go...
Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 08:04, 22 June 11
I tested the game Death Wish 3 with the new AY code.
The keyboard bug still remains...  :'(
Title: Re: Which emulator has the most accurate sound playback?
Post by: arnoldemu on 09:22, 22 June 11
Quote from: Devilmarkus on 08:04, 22 June 11
I tested the game Death Wish 3 with the new AY code.
The keyboard bug still remains...  :'(
I have updated my ay code and it works fine.
So you have another bug somewhere.

edit: death wish 3 doesn't autostart for me.

I think I have another bug in the keyboard handling because two mag's menu doesn't seem to respond to key presses for me.
I will fix this soon.


Title: Re: Which emulator has the most accurate sound playback?
Post by: Xyphoe on 06:24, 24 June 11
I hope Richard doesn't take offense to this, but I have to admit having tried this recently the music and sfx does sound a lot more 'vibrant' in CPCE compared to WinApe - and I actually much prefer this. It's even made me think of switching which I use to do my YouTube videos on, especially when a game has such a great soundtrack - Ghost N Goblins for example that I'd rather hear it recorded from CPCE than WinApe. Also the AVI file from WinApe when you put it into editing software you can see the wave form for the audio is completely 'peaked' and ends up distorting with nasty pops and crackles. This is why I have to import and re-encode after reducing the audio volume (hence why a lot of my videos they're recorded at low volume which I sometimes get complaints about). In WinApe's defence for recording video - it works much better than CPCE which seems to have a few bugs, for example I have to quit CPCE after recording a video before starting another recording, which is annoying. But anyway, I think that's a different issue and one I need to test and examine in more detal.

Back to my original observation re CPCE vs WinApe - can anyone explain the reason for this difference? Is it do with the demonstration and graphs Markus produced?

I don't know which is more 'accurate' as I'd have to move the PC downstairs and set the same game running on both machines to compare. Of course you have to factor in that playback through different mediums will produce different results - ie PC speakers, much the same if you compared the sound from the back of the CPC compared to hooking it up to a hi-fi. However I don't think different sound cards or onboard sound chips in PC's will produce different if anything noticeable results as the technology hasn't really changed or improved much over the years.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Executioner on 07:30, 24 June 11
The sound in the next release has somewhat of an overhaul in order to address the volume level complaints and to get some specific games and demos to work properly that didn't before. I may release a version this week, even though there are still more things I would have liked to get in to 2.0A18.
Title: Re: Which emulator has the most accurate sound playback?
Post by: PulkoMandy on 20:39, 27 June 11
Hello there !
We've been working hard on Reloaded to improve the emulation quality. The AY is now very accurate. You can get the emulator and have a look at the source here :
http://code.google.com/p/cpcsdk/ (http://code.google.com/p/cpcsdk/)


This emulator is based on Caprice, but rewritten in C++. It has some better features. Our AY code is a fork of libstsound, but was tweaked with :
  * Volume curves based on measurements from Grimmy (grimware.org)
  * Some tweaks to the noise generation, per Targhan's advice
  * Stereo output
  * Improved filter


The sound output is really near to the real hardware. It's almost identical to the code used in Arkos Tracker.


Give it a try and tell us how we can improve !


Oh, and don't thrust the datasheets, they aren't accurate :)
Title: Re: Which emulator has the most accurate sound playback?
Post by: McKlain on 21:36, 27 June 11
Hey, in stereo the channels are in the wrong order, the central channel is on the right. Also, are you going to include a QWERTY layout?  ;D

I was testing the windows version.
Title: Re: Which emulator has the most accurate sound playback?
Post by: PulkoMandy on 18:26, 28 June 11
Just use the right ROM to match your keyboard layout. The emulator layout can be configured in the settings window.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Phi2x on 23:54, 01 July 11
.
Title: Re: Which emulator has the most accurate sound playback?
Post by: PulkoMandy on 19:37, 03 July 11
mcklain : doh! I noticed I was using an older version of our libstsound in windows releases. It's fixed in the new one, along with some other bugs.
Title: Re: Which emulator has the most accurate sound playback?
Post by: McKlain on 21:27, 03 July 11
I downloaded it but it says that there is some long-named dll missing.
Title: Re: Which emulator has the most accurate sound playback?
Post by: PulkoMandy on 17:49, 04 July 11
Mh... I have a lot of dll on my hard disk. Could you be a bit more precise please ?
Title: Re: Which emulator has the most accurate sound playback?
Post by: arnoldemu on 09:31, 05 July 11
Quote from: PulkoMandy on 17:49, 04 July 11
Mh... I have a lot of dll on my hard disk. Could you be a bit more precise please ?
I'm guessing it's one of the wxwidget ones ;)

Title: Re: Which emulator has the most accurate sound playback?
Post by: arnoldemu on 09:36, 05 July 11
Quote from: phi2x on 23:54, 01 July 11
The AY engine has been seriously beefed up on CPCBox (http://www.cpcbox.com) ;)

http://www.cpcwiki.eu/forum/index.php?topic=1332.msg26071#msg26071 (http://www.cpcwiki.eu/forum/index.php?topic=1332.msg26071#msg26071)
This is a nice game of who's is better ;)

I can confirm that on the work in progress Arnold, the sound is non-existant, and the sound emulation is poor. ;)
In addition the monitor emulation is so bad it will make you cry.

However, I can confirm that other parts of the hardware are emulated accurately.

I planned to go into details, but they can wait until I actually release it  :laugh:

EDIT: It's build on wxwidgets and SDL currently and works well under linux.

Title: Re: Which emulator has the most accurate sound playback?
Post by: Devilmarkus on 09:44, 05 July 11
Quote from: arnoldemu on 09:36, 05 July 11
This is a nice game of who's is better ;)

You are right.

But IMO:
Is this really so important?
I don't improve JavaCPC because I want to be better...
I just do this for fun.
Of course I am happy when 1-2 features work better than in other emulators, but not, because I want to be the "top elite coder" but because I am proud of my results...
Title: Re: Which emulator has the most accurate sound playback?
Post by: McKlain on 10:05, 05 July 11
And the funniest thing is that a few demos only work properly in javacpc  :laugh:
Title: Re: Which emulator has the most accurate sound playback?
Post by: einoeL on 21:40, 06 July 11
 :P :P :P
Title: Re: Which emulator has the most accurate sound playback?
Post by: Bryce on 22:04, 06 July 11
Quote from: arnoldemu on 09:36, 05 July 11
I can confirm that on the work in progress Arnold, the sound is non-existant, and the sound emulation is poor. ;)
In addition the monitor emulation is so bad it will make you cry.

Who cares, it runs on a Linux box (without an internet connection) which still puts it in Pole position for me.

Everybody will have their own reason for preferring a certain Emulator, no matter how good certain features are on one or the other.

Bryce.
Title: Re: Which emulator has the most accurate sound playback?
Post by: Gryzor on 16:33, 07 July 11
Quote from: Bryce on 22:04, 06 July 11
Who cares, it runs on a Linux box (without an internet connection) which still puts it in Pole position for me.

Everybody will have their own reason for preferring a certain Emulator, no matter how good certain features are on one or the other.

Bryce.

You can always tape a screenshot of Teenage Queen on your monitor. This way it will work for every OS, even with the machine turned off :D

Just kidding.

Title: Re: Which emulator has the most accurate sound playback?
Post by: Cld on 19:11, 07 July 11
@Bryce
Reloaded works on Linux, Haiku, MacOS X, OpenBSD,... and sometime on Windows too but it's not our fault... :)
Powered by SMFPacks Menu Editor Mod