Shop OBEX P1 Docs P2 Docs Learn Events
I give you, S3M 2 HSS — Parallax Forums

I give you, S3M 2 HSS

Sachiel7Sachiel7 Posts: 41
edited 2009-08-09 02:29 in Propeller 1
Totally digging that rockin' HSS but wishing you could have an all-in-one simple tool for converting your music?

Well my friends, wish no more, I give you S3M2HSS.

S3M2HSS is a simple tool that will convert any 4 track, 8363 Hz sample - based S3M and shoot out a nice hot, fresh HMUS file for you to load onto your prop and jam out. Or game out. Whatever your fancy.

It also includes instrument-specific resampling and will (in the future) support RMUS files. RMUS is a new format for HSS +Retro Mod, which is basically a stereo HSS mod. RMUS retains all panning and shifts in S3M files.

Anywho, enough talking, more Converting!
I've included 2 short little songs I keyed up in a jiffy just to test out the system.
Please, please leave me some feedback, I'd like to continue supporting this (and fixing any bugs that may still be crawling within, though I haven't seen any in a while!)
Make sure you do a quick check through the Help/About just to get some quick pointers for setting up your S3M files.

Enjoy! turn.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-=Sachiel7=-

Comments

  • Clock LoopClock Loop Posts: 2,069
    edited 2009-08-06 12:40
    Glad to see HSS getting more attention.

    I am about to release my own project based on HSS.


    [noparse]:)[/noparse]

    Thanks for your addition.
  • trodosstrodoss Posts: 577
    edited 2009-08-06 12:48
    Looks great! I am planning on giving this a try when I have a little more time.
    Also, I put a post on the "Projects" page in the Hydra forum, linking to this thread.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-08-06 16:54
    WOW! How did I miss this!

    Looks like I need to update the projects page...
    (I know what I'll be trying out later tonight.)

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-08-07 00:30
    Quick question...

    I'm getting hung up on converting samples to 8 bit.
    I'm assuming you are using Audacity? Can you share what you are using and
    some details on how to accomplish this?

    Thanks
    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Sachiel7Sachiel7 Posts: 41
    edited 2009-08-07 00:38
    I typically use ModPlug tracker for my s3m music creating. In modplug, you can right click on the sample waveform and choose "convert to 8 bit". I believe the smallest bitrate Audacity supports is 16 bit.
    What I typically do to convert samples is open the s3m in ModPlug, export all the Samples to wav files, open them in audacity and resample them at 8363 Hz, then reload the resampled files into the s3m in ModPlug, and trim them. Then I convert them to 8 bit as above, and set looping points, if necessary.
    I wouldn't mind adding support for 16 bit samples in a future version of S3M2HSS, but I'm not sure where the S3M file stores the Sample's bit rates (if it does). I have to double check my documentation, but it wouldn't be hard for me to add.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -=Sachiel7=-
  • Sachiel7Sachiel7 Posts: 41
    edited 2009-08-07 00:50
    Sorry for the double post, but I stand corrected.

    If you go to Edit>Preferences in Audacity, under the file formats tab you can choose to export *.wav in 8 bit PCM format.
    I haven't tried this, but I believe it should work fine. Lemme give it a try...

    EDIT: Yes, this method works properly. Make sure that you set your project rate in audacity to Custom>8363. Once you export your *.wav, you will probably want to re-open the exported file and trim it as Audacity preserves the original sample length, so there's typically a long period of silence on the end of your resampled files. You can do this in ModPlug as well.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -=Sachiel7=-

    Post Edited (Sachiel7) : 8/7/2009 12:58:12 AM GMT
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-08-07 02:38
    Ah...

    Right-click on the sample itself.. Duh.. I was making it too difficult.

    Here's one that I've attempted to convert, but for some reason it crashes your program.
    Perhaps a bug?

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Sachiel7Sachiel7 Posts: 41
    edited 2009-08-07 02:44
    I can tell you why; you can only convert music with a max of 16 samples. I'm trying to remove the unused samples from your file in ModPlug, but its not letting me easily. Lemme try MadTracker...
    EDIT: I think I'll add a warning dialog in the next release if there's more than 16 samples.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -=Sachiel7=-
  • Sachiel7Sachiel7 Posts: 41
    edited 2009-08-07 03:50
    Oldbitcollector, I've attached a modified S3M of your file, and my results converting it.

    This has raised a few notes for me to mention:
    -Only 16 samples. It seems S3M files are notorious for using empty samples with parts of the file comment as their name.
    I'm going to most likely add code to v1.1 that skips these, and warns the user if there are more than 16 nonempty samples.
    -Arpeggio effects aren't supported by HSS (as far as I know). This is any Jxx command, so things like track 4 in Oldbitcollectors sample will not play anything but a solid note. HSS recognizes the command JCC as a standard Tremolo. More documentation on effects is under the Help/About tab in the program.

    I am still trying to find out why ModPlug won't remove empty samples. Sometimes it will, sometimes it won't. I think that it has to do with the file comments being stored there, but even if a sample doesn't contain a comment, it doesn't always delete. I think I'm gonna have to make a post over on the ModPlug forum about this one...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -=Sachiel7=-
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-08-07 14:09
    I did some conversions this morning, but I don't have time to test
    before I go to work... So let me know if these work for you guys. [noparse]:)[/noparse]

    OBC

    Files failed: removed

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.

    Post Edited (Oldbitcollector) : 8/7/2009 11:14:31 PM GMT
  • trodosstrodoss Posts: 577
    edited 2009-08-07 15:31
    @OBC,
    Looks like all of those files are too large for HSSPLAY (>32K), so wouldn't be able to get those to work.
    Maybe it is the samples getting included making them large?

    --trodoss
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-08-07 15:58
    Maybe because I choise "8 bit" in the converter...

    I'll play with them more tonight..

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Sachiel7Sachiel7 Posts: 41
    edited 2009-08-07 20:50
    Yeah 8 bit will (obviously) result in larger files. However, you might want to also go through in ModPlug and trim the samples shorter. I'd suggest removing unused effects, instrument, and volume commands, but S3M2HSS should skip them already to save on size. Long songs will get hefty too, but I think its mostly the samples in the s3m files. (They're always to blame! mad.gif )
    In my files, Samples typically account for ~70% of HMUS size, and song data ~30% (For a longer track, like Mohauk in the included samples)

    You can check out the sample tracks I included and kinda compare sample lengths/ song length to the result file to get a feel for file size results. I try to keep sample length around 4000 at a max, and if I have one or two that are that big, that means the rest need to be tiny. With that methodology and about ~5/6 instruments, a long song of mine weighs in around 8-9k, give or take a few bytes.

    Another trick that's easy to use, is if you want that Retro feel, or you're sampling some 8 bit era music, you can have some REALLY short samples for Square, Sin, Saw, Noise, (like a single period of the waveform sampled at the frequency of whatever you want C5 to be, then resampled to 8363 Hz) and you're good to go. I think traditional 8 bit systems like the NES had 1 Tri channel, 2 Sqr channels, and a Noise channel. Those kind of music files tend to be ~2K at the most in my experiences. Yet another trick you can pull in HSS is to load multiple sets of Song Data, but reuse the same samples. Just stop playback, change the pointer to the song data, and restart playback. That gives me an idea...

    Perhaps I can add an option to S3M2HSS for a HSNG file export. This file would ONLY be SongData used by HSS.
    Then you could just add a function to HSS like, PlaySong, which in pseudo-spincode would be sonething like:
    PUB PlaySong(songptr)
     HSS.Stop()
     HSS.SongData_Ptr := songptr
     HSS.Play(@Song_Buffer)
    
    


    Where songptr is @Song.HSNG and Song_Buffer is the first HMUS file that contains the samples.
    In fact, I'm pretty sure you could make an HMUS with no Song Data (no notes/patterns, etc) just to store samples. S3M2HSS would simply write the first commands as v64 for all tracks, then Song End. You could then cue up the actual song data you want to play with something like PlaySong() above.

    I think this will definitely make it into a future version of S3M2HSS. smilewinkgrin.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -=Sachiel7=-
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-08-07 23:11
    I'm getting closer... Three hours later... Gheesh.. [noparse]:)[/noparse]

    For some reason my song is playing about 25% faster than expected.
    Perhaps I clipped my samples too much.. but it fits. and plays under hssplayer

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-08-07 23:38
    Here's a little better conversion...

    @Sachiel7: Any advice on a painless way to create extremely lowfi .wav files?

    Ghostbusters II for HSSPLAY

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Sachiel7Sachiel7 Posts: 41
    edited 2009-08-08 00:56
    Hey that sounds great!

    What I typically do for samples is this:
    -Load up a base sample in ModPlug, like dragging an instrument in from a Midi bank, or a Soundfont.
    -Try it at C5. HSS only covers the range C2-B6, so sometimes you may want to make a note if you want to
    shift the sound up or down an octave, depending on the range you want to get for that sample.
    -In ModPlug, export the sample as a Wav file.
    -Open the wav file in Audacity.
    -Set the Project Rate (Bottom Left in the main window) to Custom > 8363.
    -If I need to apply an octave shift, or any other effects (sometimes I fade off a sample early to trim it shorter) I do these now. You can octave-shift in Audacity under Effect > Change Pitch, and use semitones. I should note here, that we haven't converted our sample to 8363 Hz yet. You tend to get the best final sound when you apply all your effects, shifting, etc before converting the rate. Sometimes I'll mix two samples as well, as with my example file 'Rockit', the strings/choir are two separate samples mixed to one. If you have two instruments that will play the same notes all the time, this is a sneaky way to add more sound to the mix. This usually happens with multiple instruments in the same range. (Bass, Mid, Treble)
    -Once all is set, I export the WAV to a new WAV. I usually add a suffix of '2' to my files.
    -In ModPlug, load the new Wav in the sample window.
    -Audacity will leave alot of silence at the end of the sample, because it preserves the original sample length of the original bitrate. Select the waveform & a little silence on the left and Right Click > Trim. Repeat this until your sample is trimmed properly.
    -Try the sample again at C5. If it sounds any different in tone than the original, then something is wrong (as long as you didn't pitch-shift it.) Also note the Length of the sample in the sample window. I try not to exceed 4000 for a single sample, and having several close to that number will eat up Ram fast.
    -See if you can shorten the sample if it's too long. Sometimes you can get away with trimming a sample really short and looping it (easily done with basic waveforms) or trimming it shorter and looping the end (better for more complex sounds, sometimes) or sometimes just making it shorter in general. As I said above, sometimes I'll trim it down and fade off the end, and it still sounds ok.
    -Right click and Convert to 8 bit, if Audacity hasn't already exported 8 bit (see above post for 8 bit Audacity WAV export settings)

    At this point you should be good to go. You can calculate the size of samples in your hmus by:
    (Sum of all sample lengths) * HMus bitrate (8 bits or 4 bits).
    I try to keep my files to an 8K size, so I can have a dedicated 8K HSS buffer in memory, and load in and out of it from EEPROM or Serial (I have 4x1MB of Dedicated Runtime EEPROM storage on the Retrosys, as well as dataflash for primary storage).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -=Sachiel7=-
  • Sachiel7Sachiel7 Posts: 41
    edited 2009-08-08 01:10
    In regards to the Fletch1 conversion above, I can tell you why its playing faster. If you check the first line of each pattern, theres an A07 command. This sets the Rows/Beat to 7, whereas the file stores the default speed as 6. This is another one of those (silly) little things that some s3m files have. Why you would bother to reset the speed to 7 on every pattern instead of just adjusting the master speed is beyond me. Also, S3M2HSS sees any Axx command as a 'Set Loop Point'. It will set the start of the song loop at the last occurance of Axx (usually A06, since 6 is the most common speed). It will only loop with a Bxx command. The value xx doesn't matter for either loop commands, but its usually best to use the master speed in Axx so it still plays correctly in your tracker.

    I've attached a version of Fletch1 that has the initial speed set to 7, and a reconverted HMus at 4 bits.
    I'm glad to see that the tool is working OK, and not crashing on everyone! lol. Honestly, this is probably the first time I've released a more 'public' utility. roll.gif

    EDIT: One more thing I wanted to mention to anyone following this thread; above I stated that HSS doesn't do arpeggio. I'm not sure its true arpeggio but I tried some of the effects out today, and the tremolo effect, JCC (which is arpeggiation in S3M) sounds pretty close on HSS. Thus, my statement before about track 4 of Skate.s3m is probably wrong. I believe if you replace all the Jxx commands with JCC in track 4 of Skate it will sound close. I might give it a try later tonight just to see (I'm still trying to get these effects down, I wish ym2413a was around to answer a few questions...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -=Sachiel7=-

    Post Edited (Sachiel7) : 8/8/2009 1:24:41 AM GMT
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-08-08 14:48
    Here's another one that seems to crash the converter...

    I'm betting this .s3m file breaks a lot of rules... It's very SID sounding.. [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Ym2413aYm2413a Posts: 630
    edited 2009-08-08 16:05
    Good job! [noparse]:)[/noparse] I'm very glad with the job you did on the converting program! [noparse]:)[/noparse]

    Yeah a lot of interesting tracker commands aren't supported in HSS. Memory needed to be saved to fit everything in the 2.7k foot print. :P
    A lot of neat effects can be still down with sample tricks though. [noparse]:)[/noparse]

    Thanks all!
    --Andrew Arsenault.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Share the knowledge: propeller.wikispaces.com
    Lets make some music: www.andrewarsenault.com/hss

  • Ym2413aYm2413a Posts: 630
    edited 2009-08-08 16:12
    Ah another trick to overcome the sample memory limit is to use 4bit samples on some things.
    I don't know if this converter supports 4bit samples. But they work well for things like Hit-hats and high pitched synth sounds. [noparse]:)[/noparse]

    8bit samples work well for bass instruments.

    Thanks! [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Share the knowledge: propeller.wikispaces.com
    Lets make some music: www.andrewarsenault.com/hss

  • lonesocklonesock Posts: 917
    edited 2009-08-08 23:18
    Ym2413a said...
    Ah another trick to overcome the sample memory limit is to use 4bit samples on some things.
    I don't know if this converter supports 4bit samples. But they work well for things like Hit-hats and high pitched synth sounds. [noparse]:)[/noparse]

    8bit samples work well for bass instruments.

    Thanks! [noparse]:)[/noparse]
    HSS already supports a 1-bit ADPCM-like format, right? How hard would it be to support that format for the samples? (There's also an easy extension to that compression scheme which I documented here: lonesock.net/bba.html. It lets you compress to 1/2/3/6 samples per byte, and you can encode to/from any bit-depth you want (as if the prop needs 24-bit audio wink.gif )

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lonesock
    Piranha are people too.
  • Sachiel7Sachiel7 Posts: 41
    edited 2009-08-08 23:51
    Oldbitcollector, I'm running that s3m through the debug build of the tool, this is likely a bug in my program, there was very little that would've caused an issue with that file. I have a few hunches as to what it is...

    ym2413a, my converter lets you choose a sample by sample conversion rate. You can choose 4 or 8 bit sample rates. That way you can choose to make low frequency samples 8 bit, while downrating high frequency ones, if you choose. I tend to just convert all my samples to 4 bit.

    I'm glad you guys are sharing your S3M's with me, I tend to convert songs I've written with the converter in mind, so I'm less likely to catch bugs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -=Sachiel7=-
  • Sachiel7Sachiel7 Posts: 41
    edited 2009-08-09 02:15
    I'm gonna slap myself on the head! I spent the last hour or so comparing the data at the time of conversion to the binary file data, and it hit me. I double checked the file, and my suspicions were correct.
    There was a call to instrument #18. Even though there are only 14 instruments in the file (which should be ok) the file called instrument #18. For what reason, I dunno. I've noticed this happening in a few s3m's. That or you already trimmed the file down to < 16 instruments.

    I will make a note to have a fix in the next version for this.
    I only allot a byte for all commands to HSS. The way I build an instrument command (for instruments over #8) is: (Channel | Convert.ToByte(newInstrument - 8 << 5) | 0x10). Since HSS has only 16 instruments, this works fine, but if newInstrument > 16, the left shift overloads the command byte. I'll just add detection to skip command calls for instruments over 16.

    Thanks for bringing this up. You should be able to convert that file as is by just removing any instrument calls > 16.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -=Sachiel7=-
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-08-09 02:21
    Thanks for that!

    Yes, many of the decent mod, s3m, etc files do not regard a limitation like we have imposed on ourselves. [noparse]:)[/noparse]
    Being able to easily strip excess samples out without having to parse the file will be very helpful!

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Sachiel7Sachiel7 Posts: 41
    edited 2009-08-09 02:29
    Yeah, v1.1 will include:
    -Empty sample removal/ignorance
    -Automatic handling of > 16 instruments, both in the file in general, and calls to instruments > 16
    -HSNG export option - only export song data file. Use with a HMUS that has no pattern data but samples to swap out different songs that use the same samples.

    I'd also like to add support for files that have 16 bit samples, the only problem is that I can't find anywhere within the S3M file that it stores this information. I could easily add a check box for it though, but I need to do some more research of how S3M's are structured with those kind of samples. They would still have to be downrated to at least 8 bits.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -=Sachiel7=-
Sign In or Register to comment.