So you want to make some audio or video for your Commodore 128?

You may already have the tools, but here are some more.  For example, if you want to play 8-bit audio files, you don't need any software if your audio is already in .WAV or .AIF format and your files meet the following requirements:

- PCM encoding
- 8-bit
- Mono
- Sample rate 7000~12000 Hz

If you have a .WAV file that does not meet those requirements, you can use 'SoundRecorder' included with MS Windows (look under 'accessories').  Just open your .WAV file, select 'Save As...', and at the bottom below the filename box, it will show the wave format.  Click on 'Change...' to change the format to requirments listed above.

If your audio file is not .WAV format, then you will need to convert it to .WAV format.  I recommend 'FFMPEG' which is freely available (see sourceforge.net) for different operating systems.  This software will let you convert almost any file audio file (or the audio from a video) into a .WAV file.  The typical command line would look like this:

>ffmpeg -i myaudio.mp3 -acodec pcm_u8 -ac 1 -ar 8500 myaudio.wav

This turns the .MP3 file 'myaudio' into a .WAV file with 8500Hz sample rate.  This should play on the C128 using a fast-serial device like 1581 or uIEC.  It has been reported that CMD-HD is slower than 1581 (go figure!), so you may want to use a lower sample rate (like 8000Hz).

Playing 8-bit audio on the SID chip can produce a high-pitched wistle that the SID filter can't eliminate completley.  Using a different frequency for the audio file, or adjusting the SID filter settings in the player can help a little.  It also helps to boost the volume of the source file (this increases the signal-to-noise ratio).  Of course if you boost the volume too much, you will create 'clip' distortion.  Use the -vol argument with FFMPEG to boost the volume when making a .WAV file.  Or use the option 'Increase volume 50%' option in SoundRecorder before saving.

The 'whistle' noise varies quite a bit depending on the type of SID and filter capacitors in your C128.  If you have an REU for your C128, then you can use a sample rate of 10000 to help eliminate the noise (that is too fast for the serial bus, which is why you need an REU).

------------------------
About the utilities

Media Player 128 can also play 4-bit and 2-bit audio files.  The 4-bit files don't have the problem with 'whistle' discussed above, and the files will be 1/2 the size.  Although 4-bit might seem to be only 1/2 as good as 8-bit, you can also use a higher sample rate, like 11000 Hz without the need for an REU.  It sounds pretty good, and is what I prefer.

There are 2 MS Windows (command line) utilities for making audio files.  Use 'WAVTO4B.EXE' to transform an 8-bit .WAV file into a 4-bit .CIF file.  The typical command would be like:

>wavto4b myaudio.wav myaudio.cif 100 /v

The 100 is the volume level (100=normal).  The /v switch invokes Verbose mode, and will tell you the minimum and maximum volume levels, and the number of samples that were clipped.  Normally you want the the maximum to be 15 or more.  If it is less, use a higher volume level.  If the maximum is more than 15, it may still be okay... look at the number of samples that were clipped.  If the value is large (over 1000) then you should probably reduce the volume level.

The other 'WAVTO2B.EXE' works about the same, but creates 2-bit audio files (without a file header).  The 2-bit audio sounds really crummy, but was created as a low-bandwidth solution for playing videos on the C128.  The fact that it has no file header means it can't be played directly with MP128, but used to make videos instead.  For videos, the audio rate must be about 7816Hz (this is the average VIC 2-raster rate of NTSC and PAL machines).

The final utility is BMP2VIC2.EXE which is used to make a video for the C128 in .CIF format.  You will need a 2-bit audio file (created as disscussed above) and a folder of images for the video.  A minimal command line would be:

>bmp2vic2 video_folder myvideo.cif /af myaudio.cif /c /c2 /r4.0 /bw6100

The /c option tells the utility to compile the images into a video (otherwise it will create individual VIC bitmap files).  The /c2 option tells the utility to make a multi-color bitmap.  The /r4.0 says the images are at 4 frames per second.  The /bw6100 controls the bandwidth (discussed below).  There are other options to control brightness, contrast, color saturation, etc.  Try running without any arguments to see the full list.

The images you must supply has to be either .BMP or .PPM files.  They can be either 24-bit color or 8-bit monochrome.  So how do you get the images?  The useful FFMPEG software!  You might enter a command like this:

(linux)
>ffmpeg -i myvideo.mp4 -r 4 -s 144x136 video_folder/%04d.ppm

(windows)
>ffmpeg -i myvideo.mp4 -r 4 -s 144x136 video_folder\%04d.bmp

This turns the video into a folder of images at the requested rate (4 frames per second), and size (discussed below), and image type (.BMP or .PPM)

There are 3 important parameters for making a video: the bandwidth, the image size, and the frame rate, and most inter-relate.  A bandwidth (data rate) of 6100 should work on both NTSC and PAL machines at the recommended size using a 1581.  A higher bandwidth is possible with a faster device (like a uIEC or REU).  With a higher bandwidth, you can increase the frame rate or the image size.  If you increase the image size, you should decrease the frame rate or increase the bandwidth.

Recommended image sizes:

108x136 (4:3)*
116x144 (4:3)
120x152 (4:3)
128x160 (4:3)

144x136 (16:9)*
152x144 (16:9)
160x152 (16:9)

160x112 (12:5)*

So to make a video, follow 3 steps:

- Generate a folder of images (FFMPEG)
- Convert audio to 2-bit (WAVTO2BIT)
- Compile video (BMP2VIC2)

