• Hello, Guest! Welcome back, and be sure to check out this post for more info about the recent service interruption and migration.

October 2021 Project: reverse-engineering Studio Session song format

Mu0n

Well-known member
My project is not new, it's a continuation of something I pushed forward in 2019 back in another thread:

The goal of retrochallenge is to advance and/or complete projects, right and talk about some milestones, right? Here goes.

Goal: Load a Studio Session song file (along with its instruments) and play it back, close to the original in a custom game program (eg in an intro splash screen)

Context: Studio Session from Bogas Productions released in 1986. It uses 11 kHz instrument sound samples of arbitrary sizes and mixes up to 6 tracks together to create music that went beyond the default Apple Sound Driver, whose most similar mode of usage featured 4 channels of 256 byte-long sound waves.

Official website: https://mu0n.github.io/ForayInto68k/ress/

Code: - available when phase 1 is mostly done, but will be here: https://github.com/Mu0n/ForayInto68k -

Use case if the project comes to completion: This song format has a very mature song editor with the usual Mac GUI frills using standard musical notation. There are nifty tools that allows to re-use chunks of music (phrase library) and repeat some sections. If I can programmatically play back a song, this could be incorporated into a game programming project very easily. Some advanced music could be played back in a title screen or during a non-cpu intensive part of a game (cinematics for example). This was done commercially in some games like Tetris, Falcon F-16 and Vette!, all from Spectrum Holobytes. The code they used would be what the final form of this project strives to reach.

Target Hardware Environment: same machines that used to run Studio Session, which is probably a stock Mac Plus with a 68000 and 1Mb of RAM

Target Software Environment: A System version that supports the Sound Driver at first. If all goes well, target the next few versions of System which made use of the Sound Manager. I suspect this is a high step between these 2.

Programming Tools: Symantec THINK C 6.0, THINK Reference, ResEdit, SoundCap (or others), Studio Session


Phase 1 (in progress):
---DONE:

-Load a song file
-Detect basic info: instrument list, master key, master tempo, most proprietary commands
-Use the Sound Driver square-wave synth to play back a channel
---TO DO:
-Create an interface that displays song info
-Select a channel to play back
-Very aggressively cut up the source code into many small files for future management
-Get some timing measurement routines to test out some optimizations

Phase 2:
---TO DO:

-Use the 4-synth driver to select and play 4 channels at once
-Figure out how the notes are synchronized together, ie, what's the smallest time slice where note changes happen, instruments come in/out, etc.
-Figure out buffering used during playback - can the whole song be loaded at once, or is it done on the fly
-Figure out if sync needs to happen with video blanking (VBL) interrupts

Phase 3:
--TO DO:

-Figure out how much memory is needed
-Figure out a mixing method to avoid saturation of the freeform synth driver - divide by 2, sqrt(2) or 6?
-Re-figure out buffering used during playback - can the whole song be loaded at once, or is it done on the fly
-Optimize data transfers to squeeze out some free CPU cycles as much as possible
-Explore using ASM blocks for some critical parts of the program as needed
-Find a good pipeline for making new instrument sound files
 

Attachments

  • Studio Session Song (.sss).txt
    7.8 KB · Views: 3
Last edited:

Crutch

Well-known member
Still a great project. Though I’d love to just reverse engineer how it’s done in Tetris. There must just be a VBL task or driver running that plays Studio Session sound files. It would be fun to figure out where that code is and just pluck it out.
 

Mu0n

Well-known member
about.png

Things done in the first week:

-Plunge back into 2 year old code
-Chop down the main C file very aggressively into many sub files (DealWithMouse.c, DealWithKeyboard.c, Menu.c, Loadsong.c, etc)
-Retool my brain away from Java classes and into using a bunch of #pragma once lines everywhere, as little few globals as needed and efficient and minimal cross talk between my source files
-About screen as an alert (as seen above in the image)
-Working menu events
-Refresh on the usage of a resource file tied to the THINK C project - it's currently driving the window, menus and alert
 
Top