Sampling a whole song on SNES
BotB Academy n00b s0z
 
 
182535
Level 22 Chipist
Opilion
 
 
 
post #182535 :: 2024.01.09 12:07am
  
  VirtualMan and damifortune liēkd this
I'm trying to make music on SNES/SPC700 with the following process:
- creating a song with any software and render it to wav
- loading the whole wav file in the SPC700 RAM
- rendering it to a format that can be played on SNES/emulator (such as .spc)

I actually found a way to do this but for now I can't make songs that are longer than something like 1:00~1:10. I'm posting here because there is possibly an easy way to make quite longer songs but I'm not very knowledgeable with .it trackers.


TEST SONG
I made a test song called 32bits, I just took the mp3 from the entry I made for the last day of the Advent Calendar battle and rendered it to a .spc file using OpenMPT and SNESMOD.

It doesn't sound nice as it is now because I just used some random song that was already made, but I think it's possible to make some cool stuff if you make a song especially for the purpose of converting it to spc.

Here are the links to
- the entry: https://battleofthebits.com/arena/Entry/Flurry/64373/
- the .it module as well as .spc and .mp3 renders: https://drive.google.com/drive/folders/1CJEqRBf3d6GIDKhqawUx9fshxcuGmsGd?usp=sharing

Note: the song is only 50 seconds long but it didn't use the whole RAM, I think it's fairly possible to go above 1 minute if you repeat the process with another song instead


METHOD
As the SPC700 chip only has 64KB of audio RAM, you can only load a few seconds of audio. I don't know the exact number but I did some tests in furnace and it seems you can import a sample of 2 seconds without problem (it even leaves some unused RAM, which is good because I'm using SNESMOD).

So the first step will be to shrink your song into a sample of 2 seconds or lower. To do this I imported my song in Audacity and multiplied the speed by 32 (Effects -> Pitch and Tempo -> Change Speed). If the song has an initial length of 64 seconds, the result will be exactly 2 seconds long, so you will be able to use it as a SNES sample. In my case the result was shorter than two seconds because my base song was only 50 seconds long.

Once the speed up song is imported as a sample in OpenMPT, the last thing to do is to revert it to it's original length!

Playing the note C5 will play the sample at it's base pitch, so C4 will lower it by one octave and C0 by 5 octaves. But lowering a sample by one octave is actually the same as dividing its speed by two. Hence C4 will halve the sample's speed and, as 32 is 2 at the power of 5, C0 will divide it by 32. So, to revert the song to its original speed, you just have to play the related sample with the note C0.


IMPROVEMENTS
To make longer songs, I'd like to repeat the same process with greater speed values. Imagine you multiply the speed of your long by 64 with Audacity, then you would have to lower it by 6 octaves in OpenMPT to go back to the original speed....... but it would require either:
- to play octaves below C0
- or to have the base pitch of the sample on C6 instead of C5, so that playing C0 would lower it by 6 octaves

Do you now how to do this with OpenMPT? If you have a solution that doesn't use OpenMPT or SNESMOD, I'm also curious to know about it!

Thanks for your answers and sorry for the long reading!!
 
 
182567
Level 31 Chipist
damifortune
 
 
 
post #182567 :: 2024.01.09 1:01pm :: edit 2024.01.09 1:16pm
  
  Opilion liēkd this
this is something i've sort of explored a few times

rather than repitching the audio itself you can achieve the same resulting lower filesize by downsampling - lowering the sample rate from e.g. 44100hz down to 22050 down to 11025 etc. pretty much the lowest floor you'll get much texture out of is 3000hz, but the lower you go, the more you're gonna lose high frequency content regardless of your method. downsampling will allow you some more freedom about your octave selections though

my first couple attempts were aimed at sampling chunks of my own finished music to combine together into a song, rather than just trying to play back a whole existing song - anywhere from a couple seconds to a whole ~20sec phrase of music

1. Rubescent Isle of Reincarnation - five samples of my own music plus noise channel to help make up for the lack of high frequencies in the low fidelity samples
2. Amaranthine Isle of Automation - used the samples of my own music that didn't make it into the other song, plus a sinewave, also 21edo handling of 12edo samples ha

i uploaded the batch of samples here
if you want to check them out, both original quality and edited for fitting into the 64kb ARAM

i also used a very similar principle on most of my SNES album
- i wasn't sampling whole songs, but i would record parts and phrases with my MPE keyboard, sample them, and edit + downsample them to fit. stuff like "what slips through the cracks" and "Lazuline Isle of Lakes" were entirely made this way, and also "the moon is made of water" samples a recording of me playing a phrase of music on the piano, chopped up into several parts

there's definitely a pretty harsh limit imposed by the 64kb, especially if you want the sound to not be super muffled, but there's still plenty to be said for the kind of weird atmosphere you get from heavily reduced quality sampling. it'd be nice if the interpolation wasn't forced on the system

ostensibly it is possible to swap out samples on the fly - for example this is something the Tales of Phantasia opening theme
achieves with the vocals. but that's something you'd have to figure out how to program yourself for the SNES, i don't know of any existing tools/drivers that can do this for you and it'd have to be a ROM (.smc/.sfc) instead of an .spc which is always gonna be restricted in size as a self-contained thing. but it should be theoretically possible to have something resembling a full song at 32000hz if you swap out nearly-64kb-sized samples over and over and over? i don't know if there'd be little clicks or hiccups between each sample - maybe. but i think games like this are doing it by loading a big sample into the 64kb of audio RAM, then removing and replacing it once it's done playing
 
 
182576
Level 22 Chipist
Opilion
 
 
 
post #182576 :: 2024.01.09 5:19pm :: edit 2024.01.09 5:19pm
  
  damifortune liēkd this
Wow thanks for sharing this! I'll listen to your songs later but from what you wrote, downsampling really seems to be something worth to experiment with!

The sound quality of the vocals of the opening theme of Tales of Phantasia is very impressive indeed! A possibility to do something similar would be to split an initial song into chunks of a few seconds that are meant to be played in order, which imply as you said to load big samples in the ARAM and cycle through all of them. A simple way to achieve this with existing tools would be to export several .spc files and play them as a playlist on SPCPlay... but I don't know if it would be considered either as chiptune or as fakebit. I'm afraid the only solution for this requires to do a lot of programming ah ah
 
 

LOGIN or REGISTER to add your own comments!