avatar_mr_lou

Which emulator has the most accurate sound playback?

Started by mr_lou, 16:51, 14 June 11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bryce

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.

mr_lou

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.  :)

arnoldemu

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.)
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Bryce

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

Devilmarkus

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
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Executioner

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.

AMSDOS

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!  :(
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Bryce

Shit, so our parents were right all along! Listening to Alice Cooper at that volume WILL make us deaf :D

Bryce.

Devilmarkus

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);
}
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Executioner

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.

Devilmarkus

Winape (And also JEMU, JavaCPC) also have as "ringing" noise in TAF- demo.
I will record a snippet and upload it to see...
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Devilmarkus

#36
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;
                    }
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

einoeL

CPCE sounds nice and punchy, WinApe sounds awful.

Devilmarkus

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.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

einoeL

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.

McKlain


mr_lou

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.

Devilmarkus

#42
@ 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

Also make sure that "AY-Effect" is not enabled! It gives false noises.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Executioner

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.

AMSDOS

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
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Devilmarkus

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 ;)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Executioner

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.

Devilmarkus

#47
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
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Devilmarkus

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...
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

McKlain


Powered by SMFPacks Menu Editor Mod