21 May 2021, 14:53 | #1 |
Registered User
Join Date: Feb 2021
Location: Germany
Posts: 116
|
SonicArranger
Hi there. Currently I want to create a library to load and play SonicArranger files on modern systems like Win10, Linux or even mobile.
I managed to find some resources and decoded much of it. I am not that good with m68k and prefer C# but can also read other languages including C/C++. The samples play just fine already but the wavetables do not sound right at all. Maybe someone has some knowledge of the internals of SonicArranger or wavetables in trackers in general. My understanding is that the wavetable contains one period of the wave and I can play it with a given note frequency. But as I said that does not produce a sound that is related to the original. Even when adding the ADSR waves it won't change. I tested a normal sine wave without ADSR. In SA it sounds interesting. On the PC it is just an annoying sound. I know there are two LPFs on Amiga but I can't imagine that it will change that much. Any insight is appreciated. How are LPFs implemented? How is wavetable synthesis done in SA? What happens if the ADSR waves has more bytes than the synth wave? There are so many open questions. My goal is to provide a cross platform lib to empower everyone to load and play SA music on modern PCs. Maybe someone can help me on my journey. Any documentation or background knowledge is appreciated. Thanks in advance |
21 May 2021, 15:03 | #2 |
Registered User
Join Date: Feb 2021
Location: Germany
Posts: 116
|
I already can load packed and non-packed SA files, play notes with instruments. But only sampled instruments sound like in original.
I also can load synthetic wavetables, ADSR and AMF waves and combine them. But I can't get the right sound output. Most effects also have to be implemented yet including vibrato and arpeggio. |
21 May 2021, 15:22 | #3 |
Registered User
Join Date: Aug 2018
Location: Untergrund/Germany
Posts: 410
|
I'm afraid i have not enough information about your code to give you a qualified answer, but perhaps you don't emulate Paula correctly. Paula frequency registers are not linear for instance. I would suggest to look through the replayer codes from 8bitBubsy and see how his Paula emulation works.
|
21 May 2021, 15:24 | #4 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,437
|
Wish I could help you, but I know nothing about SonicArranger
One thing that *may* be an issue (no idea if this is a real issue here, just a guess) is that the Amiga CPU's work using Big Endian byte order and over on PC's CPU's normally work with Little Endian byte order. This could definitely cause playback issues, depending on how many bytes are written out at once. But to be 100% clear, I have no idea what you coded so it's equally possible you already know this and took care of it |
21 May 2021, 15:54 | #5 |
Registered User
Join Date: Feb 2021
Location: Germany
Posts: 116
|
Thanks for you replies. I will share my code soon. I considered the big endian stuff and the wavetables contain just bytes (8 bit) so that shouldn't be an issue.
I don't emulate Paula. I only calculate the correct tempo / frequency based on it and then just convert the data to PCM. Thanks for your info I will have a look. |
21 May 2021, 16:05 | #6 | |
Registered User
Join Date: Aug 2018
Location: Untergrund/Germany
Posts: 410
|
Quote:
Good luck! Back in the day i bought Sonic Arranger.. instrument handling was quite versatile. Now Recover the Sonics! |
|
21 May 2021, 21:11 | #7 |
Registered User
Join Date: Dec 2014
Location: germany
Posts: 439
|
One of the authors (Carsten Herbst) is on youtube and has commented on a SonicArranger video recently, so he could be able and willing to help you:
[ Show youtube player ] |
21 May 2021, 22:53 | #8 |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,466
|
You could ask Jools Wills aka BuZz of Exotica to fix the link to this file
http://www.exotica.org.uk/tunes/form...c/SONIC_AR.TXT There was a remake of Lionheart by the very cool DJThunder. Lionheart is another Thalion game which also has SA music written by Matthias Steinwachs. In that game the author implemented an sc68 player his remake was in Java but I think sc68 is C. DJThunder is/was very approachable. https://github.com/b3dgs/sc68 sc68 is (i think) a container format for running 68000 programs such as Amiga and Atari music player routines http://sc68.atari.org/developers_fileformat.html Last edited by alexh; 21 May 2021 at 23:28. |
21 May 2021, 23:43 | #9 |
Registered User
Join Date: Feb 2021
Location: Germany
Posts: 116
|
Thanks chb. I will contact Carsten.
Hi Alex. Thanks. I already found the mentioned text file via way back machine. You can find it now here and the module format here. I also decoded more of it like the mentioned wavetables and found some bugs. For example the order of the effect values is loaded in a slightly different order than documented. I also found out some additional things like how the song speed really affects tempo and sampling rate etc or how long one note entry is played. But I can't get my head around the wavetable stuff. For example the first Ambermoon song uses a wave that is only 32 bytes in size. It forms some wave. But the resulting song has a very diverse sound with that little wave while I only hear some short beeps in my reimplantation. I don't know how such a small wave could even produce such interesting sound even with an ASDR envelop or LPF. I also created a new song with an instrument that only has a 32 byte sine shaped wave. It sound pretty nice in SA but is only a boring beep when playing it on PC. There must be something else which shapes that wave. Maybe some algorithm which dynamically affects the wave. |
21 May 2021, 23:45 | #10 |
Registered User
Join Date: Feb 2021
Location: Germany
Posts: 116
|
Ah I forgot. I already found DJThunders player and the sc68 but I can't find the real code which plays the patterns or waves yet. Will have a look again. Thanks for the links.
There is also AmiMus by IllidanS4. It can convert SA to midi. Unfortunately he does not work with the real instruments but you have to provide a mapping from original instruments to midi instruments. I learned much from his tool but it won't help with instruments or effects. IllidanS4 seems to have done a lot cool stuff including much of Albion format decoding which helped me with Ambermoon decoding. But for SA I guess he just had the text files I linked above. Last edited by Pyrdacor; 21 May 2021 at 23:57. |
22 May 2021, 00:06 | #11 |
Registered User
Join Date: Feb 2021
Location: Germany
Posts: 116
|
My current implementation is part of my Ambermoon rework at the moment. I will move it into its own GitHub project later. For now you can find it here: https://github.com/Pyrdacor/Ambermoo.../SonicArranger
I documented most stuff in code. For example in the main file: https://github.com/Pyrdacor/Ambermoo...rrangerFile.cs The PCM conversation and anything which processes the sound can be found here: https://github.com/Pyrdacor/Ambermoo...nger/Output.cs I have more stuff in development on my local PC but it is not stable. Currently some music of Ambermoon plays partially correct. Songs which mostly use samples are very similar to the originals already. |
22 May 2021, 01:00 | #12 |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,466
|
I don't know if this is a clue but the Deliplayer native SA player for windows had an Arpeggio option. Ambermoon SA files play with this in the wrong setting but sound very wrong. Could that imply some of the information is in the replay-routine not the SA files?
Last edited by alexh; 22 May 2021 at 01:11. |
22 May 2021, 07:41 | #13 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
IIRC SA 1.x and SA 2.x interpret some effect differently.
|
22 May 2021, 10:15 | #14 |
Registered User
Join Date: Feb 2021
Location: Germany
Posts: 116
|
Could be. If we could reverse engineer the replayer we would know how it's done. It is at the end of the code hunk of the AM2_CPU of Ambermoon. But I guess you need to be a real supernerd to make sense of it.
|
22 May 2021, 11:14 | #15 | |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,466
|
Quote:
I'm not sure there is a rip of Ambermoon in sc68 format so maybe mute Last edited by alexh; 22 May 2021 at 11:22. |
|
22 May 2021, 11:55 | #16 |
Registered User
Join Date: Feb 2021
Location: Germany
Posts: 116
|
I prefer native solutions without emulation. I guess it can't be too hard to implement wavetable synthesis and a few effects when I know the backgrounds. It is a bit sad that old-school software is not documented or open sourced or that it is lost all together. We need more future proof archives or GitHub / GitLab repos to save those precious information IMHO. Operating systems, programming languages and most of all hardware come and go but the knowledge and technical background could be preserved. But working on Ambermoon and related stuff teaches me that most knowledge, source code and documentation is just lost or very hard to find. This is very sad.
|
23 May 2021, 10:41 | #17 |
Registered User
Join Date: Mar 2005
Location: Germany
Age: 44
Posts: 210
|
Unfortunately (at least for reverse engineering) Sonic Arranger seems to be quite advanced in respect to what can be done at the instrument level. If even simple sinus waves sound interesting it's probably because of the use of the ADSR, arpeggio and vibrato functions.
If I was to reverse engineer this format, I'd probably load up the editor and start with an empty "Wave" instrument. If you click the "SINE" preset a couple of times, you will get a basic sine wave which should sound completely blunt, because no effects are applied. After that I'd have a look at a single effect, eg. vibrato and play a bit with the settings to get a feeling, of what might be going on (maybe also record to wave and have a look at the actual waveforms). Repeat for all effects/envelopes and you have a working replayer. Maybe some other replayers can give you hints on how the individual effects are actually implemented. I guess that vibrato for Protracker mods might be quite similar even if it's implemented on the pattern level there. Also, there are some coders (Don Adan?) who are quite competent in Amiga sound stuff and reverse engineering. Maybe someone in Coders.General is willing to help. (BTW: I'm watching the Ambermoon remake project with great interest. Keep up the good work) Last edited by Jerry; 23 May 2021 at 10:48. |
23 May 2021, 23:34 | #18 |
Registered User
Join Date: Feb 2021
Location: Germany
Posts: 116
|
Thanks for your reply. Yeah this is the approach I'm using. My problem is more to get used to the SA interface. For now I used a existing song, muted all instruments except for one and changed the one to pure sine wave (as you mentioned) and no ADSR nor vibrato. It still sounds quiet good. The wave is stored as a 32 byte sine wave. It has no ADSR wave or vibrato as mentioned. So I thought there must be something else.
But it was no new song with only that instrument. I will try to create one I think. But maybe my implementation is just wrong I will first try to isolate that single sine wave and convert it to PCM. If this works I have made some mistake on my end. I guess next week will let me do some progress. I will keep you up to date. And maybe I find some helping hands as well. |
26 May 2021, 17:55 | #19 |
Registered User
Join Date: Feb 2021
Location: Germany
Posts: 116
|
We found the code inside the Ambermoon assembly. Now happy reverse engineering is in progress. Found a lot of stuff already including effects, ADSR and even AMF. Will keep you up to date. But I guess it should be only a matter of time until I have all the stuff decoded and moved over to C#.
|
27 May 2021, 11:33 | #20 |
Registered User
Join Date: Feb 2021
Location: Germany
Posts: 116
|
If you're interested, the research will be tracked here: https://github.com/Pyrdacor/Ambermoon.net/issues/82
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|