What can I use to rip AY tunes?

edited May 2008 in Emulators
Because I really like the music from Dragonia, but it isn't in the AY archive. Does anybody know of a program that I can extract it with?

I'd also like a counterpart for the C64.
Post edited by Lockett on

Comments

  • edited May 2008
    There's a util to make ripped AY data into an AY tune, but you must know Z80 assembly and hack out the code in advance.

    http://www.worldofspectrum.org/x128/aymake.html

    I don't know if there's a tutorial or notes around to figure this all out.
  • edited May 2008
    Lockett wrote: »
    Because I really like the music from Dragonia, but it isn't in the AY archive. Does anybody know of a program that I can extract it with?

    I'd also like a counterpart for the C64.


    Woo-hoo, Lockett may be a C64 owner, but the Speccy is working it's magic on him. Soon he'll prefer the gameplay and clear colours of the Speccy over the endless crappy boring scrolling shooters with muddy pixels the size of house bricks that the C64 owners call a software range.


    (Sorry Lockett, it's just that I've been reading the C64 vs. Speccy thread at:

    http://www.worldofspectrum.org/forums/showthread.php?p=270244&posted=1#post270244

    so I couldn't resist this little (and innacurate) dig at you and the C64 :razz:)


    Anyway, sorry, I can't help you, but if no-one sends you the file, then post a request for it, and hopefully someone will extract if for you.
  • edited May 2008
    Does anyone know what tool they used for the AufWeidersein Monty 128K Music.
    Years ago I discovered that I could load in the final 16K block and call commands to reset, change track and "play" the music (calls 25 times a second).
    My skills in using trackers are non-existant however.
  • edited May 2008
    Bulba Sergey Vlad's AyEmul 2.9 has a tune ripper in it.

    the ripper stays very hidden, Click TL button and switch to "searching for tunes" page.

    it can search for multiple tracker files, if you are lucky you can rip your tune.

    (I never got lucky anyway. I'm a "addams family" title tune fan)
  • edited May 2008
    Arda wrote: »
    Bulba Sergey Vlad's AyEmul 2.9 has a tune ripper in it.

    Thanks, I'll try it when my computer gets back from the repair shop today.
  • edited May 2008
    Unfortunately I doubt that AyEmul will have any success ripping music from commercial-era games (with the possible exception of ones with music by Fuxoft) - the data formats it supports all come from trackers originating from the demo scene, which date from 1991 and later.

    In the general case it's not going to be possible to rip AY music (that is, in the sense of extracting the player routine and data, which is what the .AY file format requires - logging the AY output to a file format like PSG is easy) without hacking. For demo scene music, it's possible because there are a small number of widely-used data formats that Sergey Bulba has studied to the point of writing an automatic extractor for; on the other hand, as far as I know all game musicians used their own home-grown routines, and none of them have been studied to that level.

    (Well, that's not quite true. Tim Follin's beeper music is still of continued interest, and Poke and TDM have put some work into analysing his routines and writing new tunes. But for everything else - it's just not worth it, since every other music routine just has a handful of tunes written for it, and no real prospect of anyone writing new ones.)
  • edited May 2008
    gasman wrote: »
    Unfortunately I doubt that AyEmul will have any success ripping music from commercial-era games (with the possible exception of ones with music by Fuxoft) - the data formats it supports all come from trackers originating from the demo scene, which date from 1991 and later.

    In the general case it's not going to be possible to rip AY music (that is, in the sense of extracting the player routine and data, which is what the .AY file format requires - logging the AY output to a file format like PSG is easy) without hacking. For demo scene music, it's possible because there are a small number of widely-used data formats that Sergey Bulba has studied to the point of writing an automatic extractor for; on the other hand, as far as I know all game musicians used their own home-grown routines, and none of them have been studied to that level.

    (Well, that's not quite true. Tim Follin's beeper music is still of continued interest, and Poke and TDM have put some work into analysing his routines and writing new tunes. But for everything else - it's just not worth it, since every other music routine just has a handful of tunes written for it, and no real prospect of anyone writing new ones.)

    Thanks, I think that I'll sit in my room and have a good cry now.
  • edited May 2008
    Very... 'un-beating an egg' is the (not-very-good) metaphor I keep using here :-)

    Tracker formats are highly structured and hierarchical: a song is a list of 'positions', which dictate which patterns to play when; a pattern is a list of note events, each of which may have samples, ornaments and other effects (pitch bends, volume settings) applied to them, all of which together determine the values to be sent to the AY over time.

    To go from a raw stream of AY register values to a tracker format would take several levels of immensely sophisticated fuzzy pattern matching, and I'm not sure if those sorts of techniques exist even at the highest levels of academia, let alone amongst people like us pottering around with old computers...
  • edited May 2008
    But if the target is to get an .AY file from a commercial game without having to understand the original code...

    Would it not be possible to log the AY data, then add a simple z80 player routine to replay that data and wrap it up into a .AY file? That way, the original music code wouldn't be required at all, but you'd still have your .AY file.

    I'm probably talking out of my arse, I usually am...

    Mike
  • edited May 2008
    But if the target is to get an .AY file from a commercial game without having to understand the original code...

    Would it not be possible to log the AY data, then add a simple z80 player routine to replay that data and wrap it up into a .AY file? That way, the original music code wouldn't be required at all, but you'd still have your .AY file.

    I'm probably talking out of my arse, I usually am...

    Mike

    My knowledge of music programming is rather limited but it sounds interesting.
    If we allow a person with musical education to listen to AY tune (or any other tune) he will be able to write down the notes which make the music.

    So would it be difficult to write a PC program which would listen to sound output of emulator (or to a recorded .wav file) and identify the played chords?

    I'm not sure... would it be an easy task or would it involve heavy artificial intelligence like with recognising letters in pictures?

    Now, if we got the notes, we could write a standard player to play them. That wouldn't be exactly the original tune, it would be rather an aproximation, like playing with trumptet a tune, which was originally played with violin.

    However it could be quite good aproximation as AY basically plays simple square wave tones and nothing more (or am I raving here?) so there isn't much freedom how to play a peculiar note.

    We would lose of course lose all data organisation, patterns etc. so it would make the data bigger as it would be "uncompressed". Again I'm not sure how much: twice, 5 times, 10 times bigger it would be.

    What do you think about it?
  • edited May 2008
    Ralf wrote: »
    My knowledge of music programming is rather limited but it sounds interesting.
    If we allow a person with musical education to listen to AY tune (or any other tune) he will be able to write down the notes which make the music.

    So would it be difficult to write a PC program which would listen to sound output of emulator (or to a recorded .wav file) and identify the played chords?

    I'm not sure... would it be an easy task or would it involve heavy artificial intelligence like with recognising letters in pictures?

    Now, if we got the notes, we could write a standard player to play them. That wouldn't be exactly the original tune, it would be rather an aproximation, like playing with trumptet a tune, which was originally played with violin.

    However it could be quite good aproximation as AY basically plays simple square wave tones and nothing more (or am I raving here?) so there isn't much freedom how to play a peculiar note.

    We would lose of course lose all data organisation, patterns etc. so it would make the data bigger as it would be "uncompressed". Again I'm not sure how much: twice, 5 times, 10 times bigger it would be.

    What do you think about it?

    I think that it's irrelevant.
  • edited May 2008
    MikeW: In principle, that would be an option. The snag is that unless it's a particularly short or simplistic song, the raw data will probably come out at more than 64K. Having said that, it does compress quite well if you do it right - the VTX file format is essentially 13 LZ-compressed data streams, one for each AY register, and they typically come out as 4-5K. I don't know if decompressing them within the memory and CPU limitations of a Spectrum is an option, but I'm willing to buy a beer for anyone who manages it :-)

    ...But maybe that's all academic anyway. If you just want a file to play, why does it need to be .AY format? You can play a PSG or VTX file with AY_Emul. Or just load up the game and have your emulator running in the background :-) Or in fact, since an .AY player is basically just an emulator without a screen or keyboard running a cut-down snapshot, maybe embedding an entire unhacked snapshot into the AY file would work...
  • edited May 2008
    Ralf wrote: »
    However it could be quite good aproximation as AY basically plays simple square wave tones and nothing more (or am I raving here?) so there isn't much freedom how to play a peculiar note.

    Well, not exactly. When you play a note in a tracker, you're triggering a sample, which (in the AY music world) means a description of how the AY parameters (such as volume and pitch) change over time in units of 1/50 seconds. And then, on top of that you can apply pitch bends and ornaments. One note definitely isn't equivalent to a single square wave.

    And then you've got the added issues of noise and envelopes (the latter of which can be used to create triangular waves, with some trickery).
  • edited May 2008
    @Ralf: What he meant was that your idea isn't exactly what he's looking for.

    Still, nice to see that this subject is also being discussed here. :D
    Lockett wrote: »
    Because I really like the music from Dragonia, but it isn't in the AY archive...[/SIZE]

    Hmmm, is .AY the only file format you're considering? If filesize isn't an issue, you could capture the sound and convert it to mp3.

    Sorry if we're considering other options, but I think it's important we discuss them too. There are many AY fans out there.

    After alll the explanations I've seen (thanks Gasman!), I concluded that there is no way to automate this process. If we want a nice, perfect AY rip we have to look at the code that produces it, and if we want a tool to do it for us the result would be approximate, not a perfect rip. I can envision a PC tool that would look at the raw data contained captured by an emulator while playing the music and 'listen' to each channel separately, while interpreting and recreating it using new code and a new player routine, or a tool that would do something similar but would also try to extract the player and raw data from a snapshot without having to run the code.
    There's nothing like multi-track recordings where you can mute all but one and copy the notes, effects, sustain, etc. But when you buy a movie music score, for example, you get everything mixed. It's the same with the AY chip tunes. :-o But the same way I can recreate a music score on a keyboard, saving track by track (slow strings, flute, choir, bass, etc.), it should be possible to do something with the PSG output.

    I'll go back to my corner now. :)
  • edited May 2008
    Lockett wrote: »
    Thanks, I think that I'll sit in my room and have a good cry now.
    If you are really that desperate, I might have a look at that. Coincidentally, bcass of Project AY fame has asked me if I could eventually check some of the tunes, so I might as well throw this one in, too. Don't hold your breath, though.

    Patrik
  • edited May 2008
    zxbruno wrote: »
    If we want a nice, perfect AY rip we have to look at the code that produces it, and if we want a tool to do it for us the result would be approximate, not a perfect rip.

    I was thinking that if WinAPE can do it with YM tunes(that's how I got the Zynaps title song in my collection), that there would be similar programs for the SID and AY chips. Granted, it basically just records the song in YM format from one point to another, but that's all that I'm looking for. If I could do the same thing with Dragonia's music, it would be great.

    But, I guess that I can't.
  • edited May 2008
    Ah, right... yes, .YM files are a completely different beast to .AY - they just store the stream of YM data, so you can record them without needing to do any hacking (but on the downside, you lose the ability to loop them properly, and miss out on the essential 'structure' of the music file that would let you do stuff like loading it back onto a real Spectrum). If that's what you're after, then you should look to the .PSG, .VTX and .OUT formats (all of which are playable by AyEmul). Offhand I don't know what the current crop of Windows emulators are capable of producing in that area, but: Fuse and X128 can record to PSG; Z80 and WinZ80 can record to OUT; and RealSpectrum can record to... something or other (I think VTX, along with the less useful AZX and WAV formats).
  • edited May 2008
    Here's a challenge:
    Make a program (PC/MAc/whatever) which can take in a "pure" AY tune (in WAV, WMA, etc) and then reverse engineer the music/sounds as an actual AY file.

    Can it be done? (not "Is it feasible")
  • edited May 2008
    See previous answers (un-beating an egg etc). I won't say outright that it's impossible, but anyone with the know-how to do it would be far better off doing a PhD in video compression algorithms or speech recognition or something rather than fiddling around with Spectrum music.
  • edited May 2008
    gasman wrote: »
    See previous answers (un-beating an egg etc). I won't say outright that it's impossible, but anyone with the know-how to do it would be far better off doing a PhD in video compression algorithms or speech recognition or something rather than fiddling around with Spectrum music.

    Ahhh! So it can be done! ;-)

    ( Like I said: Can it be done? (not "Is it feasible"))
  • edited May 2008
    gasman wrote: »
    Ah, right... yes, .YM files are a completely different beast to .AY - they just store the stream of YM data, so you can record them without needing to do any hacking (but on the downside, you lose the ability to loop them properly, and miss out on the essential 'structure' of the music file that would let you do stuff like loading it back onto a real Spectrum). If that's what you're after, then you should look to the .PSG, .VTX and .OUT formats (all of which are playable by AyEmul). Offhand I don't know what the current crop of Windows emulators are capable of producing in that area, but: Fuse and X128 can record to PSG; Z80 and WinZ80 can record to OUT; and RealSpectrum can record to... something or other (I think VTX, along with the less useful AZX and WAV formats).

    Thanks. My computer got back today, so I'll see what works.
Sign In or Register to comment.