Author Topic: Convert YM to AY?  (Read 2552 times)

0 Members and 1 Guest are viewing this topic.

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.489
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1074
  • Likes Given: 590
Convert YM to AY?
« on: 11:07, 18 July 17 »
Not really sure where to put this but since YM and AY files tend to be emulated versions of the CPC audio I put it in this subforum.  Please move if not suitable.

Is there a way to convert the often used YM format to an AY format for use in players that can play AY but not YM? 
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.140
  • Country: fr
  • Liked: 1078
  • Likes Given: 155
Re: Convert YM to AY?
« Reply #1 on: 13:29, 18 July 17 »
Mmmh, please enlighten me: what is AY format? Does it refer to player such as AYC by Madram?
Targhan/Arkos

Arkos Tracker 2 - alpha 9 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Offline ASiC

  • Supporter
  • CPC664
  • *
  • Posts: 120
  • Country: gb
  • Liked: 75
  • Likes Given: 317
Re: Convert YM to AY?
« Reply #2 on: 13:56, 18 July 17 »
From what I remember, AY contains the player code and the tune. It's a Z80 executable basically.
YM it's just the data stream to the registers of the chip.


I don't think that such a conversion would be possible.




EDIT
---------



WHAT IS A .AY FILE?


The AY file extension is a data format associated to General Instruments AY series sound chip. The AY files contain a "chiptune," that produces a sound format that enables the sound card chip to create sounds in real time. They were used by older computer games such as Amstrad CPC (Colour Personal Computer) games, Spectrum ZX games and Atari ST games. They are composed of blocks of compiled Zilog Z80 microprocessor code joined to a header. They are used to store information such as credits, titles, and copyright details. One AY file can contain multiple tunes despite its 8kb per file size. They can be loaded back using a program that emulates the AY sound chip or AY emulator. Files in AY format can be opened with Audio Overload, Ay_Emul, and Micro Speccy in Mac Os, Microsoft Windows based systems and Linux platforms. These files also used the YM file extension.
« Last Edit: 14:04, 18 July 17 by ASiC »

Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.140
  • Country: fr
  • Liked: 1078
  • Likes Given: 155
Re: Convert YM to AY?
« Reply #3 on: 14:07, 18 July 17 »

Thanks. Well then, in theory, you could *simply* call the Z80 code, read the YM values for each frame and create a big YM file that you could extract quite easily.With the now huge hard drive or memory expansion, the size of the YM shouldn't be a problem.

EDIT: Oh, I read AY->YM. Don't bother.
« Last Edit: 14:56, 18 July 17 by Targhan »
Targhan/Arkos

Arkos Tracker 2 - alpha 9 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Offline andycadley

  • Supporter
  • 6128 Plus
  • *
  • Posts: 908
  • Liked: 442
  • Likes Given: 73
Re: Convert YM to AY?
« Reply #4 on: 14:37, 18 July 17 »
Converting AY->YM is probably possible in that manner, although it will fall over if there are samples or similar effects (but for the most part should be OK). Going the other way, as per the original question, is trickier though since you need to compress the YM file back into something that could fit within the Z80 address space alongside a player routine.

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.489
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1074
  • Likes Given: 590
Re: Convert YM to AY?
« Reply #5 on: 15:12, 18 July 17 »
Sorry I'm a bit confused.   When I said 'players' I meant music playing programs on modern hardware.   Does that help?
I want to use a software that can play various 'old school' music formats such as NSF (NES), SPC (SNES) and it has AY listed as both Spectrum and Amstrad.   But almost all the Amstrad tunes I have are in YM format which is not supported.
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline robcfg

  • Supporter
  • 6128 Plus
  • *
  • Posts: 2.327
  • Country: se
  • 8-Bit Technomancer
    • index.php?action=treasury
  • Liked: 1037
  • Likes Given: 2488
Re: Convert YM to AY?
« Reply #6 on: 15:39, 18 July 17 »
For me the best option is WinAmp+ChipAmp.


Take a look at http://www.chipamp.org/.

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.489
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1074
  • Likes Given: 590
Re: Convert YM to AY?
« Reply #7 on: 15:45, 18 July 17 »
For me the best option is WinAmp+ChipAmp.


Take a look at http://www.chipamp.org/.


Sorry thanks for trying to help but that's not what I'm after.  I need an actual way of converting the YM files into AY.  The music player I wish to use is one that can be incorporated into my own game projects to avoid having to convert the YM's into huge MP3 files that would bloat the game to silly amounts when it's all chiptunes.

The original audio libraries be here:
http://blargg.8bitalley.com/libs/audio.html

And I want to use this Game Maker Studio extension (which uses those libraries) to use AY files in the PC versions of my Amstrad projects.
https://forum.yoyogames.com/index.php?threads/chiptune-player-game_music_emu-free.25121/
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline robcfg

  • Supporter
  • 6128 Plus
  • *
  • Posts: 2.327
  • Country: se
  • 8-Bit Technomancer
    • index.php?action=treasury
  • Liked: 1037
  • Likes Given: 2488
Re: Convert YM to AY?
« Reply #8 on: 16:10, 18 July 17 »
Then I'm afraid you're out of luck.


AY files are the code that is actually playing music on the machine. Say, you're playing RoboCop and you manage to isolate the code that plays the music. That's what you get on the AY file.


Also, for playing AY files, you need accurate Z80 emulation. YM files are a crude dump of chip registers along time, so a completely different approach.

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.489
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1074
  • Likes Given: 590
Re: Convert YM to AY?
« Reply #9 on: 16:57, 18 July 17 »
Well that bites.   Cos all the Amstrad tunes on places like CPC-power use YM format and such. 
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.140
  • Country: fr
  • Liked: 1078
  • Likes Given: 155
Re: Convert YM to AY?
« Reply #10 on: 17:12, 18 July 17 »
To me, it's quite simple to do (however, I don't know the AY structure). But the problem is the YM which will probably not fit within 64k. If that's the case, you could write a simple YM player (easy to do), embed it with the YM within the AY file. The real problem is the YM size. I'm sure the emulator playing the Z80 code is hardware-agnostic and doesn't know anything about bank switching or memory expansion.
Targhan/Arkos

Arkos Tracker 2 - alpha 9 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Offline ASiC

  • Supporter
  • CPC664
  • *
  • Posts: 120
  • Country: gb
  • Liked: 75
  • Likes Given: 317
Re: Convert YM to AY?
« Reply #11 on: 17:28, 18 July 17 »
I believe the DTC demo was playing music off a compressed YM stream.

Offline ASiC

  • Supporter
  • CPC664
  • *
  • Posts: 120
  • Country: gb
  • Liked: 75
  • Likes Given: 317
Re: Convert YM to AY?
« Reply #12 on: 17:35, 18 July 17 »
I believe the DTC demo was playing music off a compressed YM stream.

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.489
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1074
  • Likes Given: 590
Re: Convert YM to AY?
« Reply #13 on: 15:58, 20 July 17 »
So this is impossible then?  To convert the many YM files commonly used by CPC sites like CPC-Power into the AY format used by the libraries I would like to use for my PC retro projects? 
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.140
  • Country: fr
  • Liked: 1078
  • Likes Given: 155
Re: Convert YM to AY?
« Reply #14 on: 17:38, 20 July 17 »
To me it's absolutely possible, but you need some coding ability. However, if you can't do it yourself, I'm pretty sure you will have a hard time finding a CPC coder only to save a few mega-bytes on a PC game.
Targhan/Arkos

Arkos Tracker 2 - alpha 9 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.489
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1074
  • Likes Given: 590
Re: Convert YM to AY?
« Reply #15 on: 18:26, 20 July 17 »
To me it's absolutely possible, but you need some coding ability. However, if you can't do it yourself, I'm pretty sure you will have a hard time finding a CPC coder only to save a few mega-bytes on a PC game.

A few megabytes? 
Let's look at the NES-style project I have which the libaries will solve as I can use NSF format created in Famitracker for pure NES authentic music.
Game by itself about - 10MB.
Game with 10 NSF tunes all converted to mp3 in 192 VBR - 66MB
Game with 10 NSF tunes still as NSF.   - 10.5MB
What's more is that these are intended for mobile phone too and many phone users don't have anywhere near the storage space capacity an average PC has so every MB off a game file makes a purchase of the game much more appealing.

I'm mainly just confused why most CPC tunes are available in YM if AY is generally more used by majority of players and audio libraries since AY is also used for the Spectrum which still has a greater userbase.

No I have no real coding knowledge when it comes to this stuff which is why I asked in the first place if there was any easy way to do it.  I had hoped for an existing tool amongst the many quirky little programs the retro scene has for converting all sorts of things into other things.   I guess not.    :/
« Last Edit: 18:28, 20 July 17 by Carnivius »
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline robcfg

  • Supporter
  • 6128 Plus
  • *
  • Posts: 2.327
  • Country: se
  • 8-Bit Technomancer
    • index.php?action=treasury
  • Liked: 1037
  • Likes Given: 2488
Re: Convert YM to AY?
« Reply #16 on: 18:41, 20 July 17 »
Quote
I'm mainly just confused why most CPC tunes are available in YM if AY is generally more used by majority of players and audio libraries since AY is also used for the Spectrum which still has a greater userbase.


My guess is that capturing just the registers is easier than having to extract the player code from the original game. Specially, dumping the registers can be done with a simple program or a small modification to an emulator while the second require assembly skills, which most people don't have.




Offline ThomH

  • CPC664
  • ***
  • Posts: 57
  • Country: us
  • Liked: 39
  • Likes Given: 14
Re: Convert YM to AY?
« Reply #17 on: 18:23, 15 August 17 »



My guess is that capturing just the registers is easier than having to extract the player code from the original game. Specially, dumping the registers can be done with a simple program or a small modification to an emulator while the second require assembly skills, which most people don't have.
Having a quick look at the AY file format, it's from the Spectrum world. Per the author's reference
the author's reference it allows a CPC-compatible 1Mhz clock to be specified for the AY but then emulates a Z80 at the Spectrum clock rate, with the Spectrum's interrupt scheme, and with the AY sitting at the Spectrum's location. So you'd need not only to rip the code from your CPC game of choice but then also modify it for the different operating environment.

Offline Munchausen

  • 6128 Plus
  • ******
  • Posts: 777
  • Country: gb
  • Liked: 213
  • Likes Given: 215
Re: Convert YM to AY?
« Reply #18 on: 20:03, 15 August 17 »

It's a partial evaluation problem  ;D


If I were to tackle this I think I'd start with the aylet source code and replace some of the functions in sound.h/.c to write the AY register values to a YM file instead of emulating the AY.