├── screenshot.gif ├── resources ├── mod │ ├── sac06.mod │ ├── sac14.mod │ ├── agnostic.mod │ ├── class11.mod │ ├── complex.mod │ ├── delicate.mod │ ├── rainfore.mod │ ├── -super_mario_land.mod │ ├── goto8o-dansa_i_neon.mod │ └── wotw-commodore_rulez.mod ├── fonts │ ├── bitboy.png │ └── bitboy.fnt └── texture │ └── TextureAtlas.png ├── .gitignore ├── default.settings ├── README.md ├── src ├── java │ └── com │ │ └── audiotool │ │ └── bitboy │ │ ├── dsp │ │ ├── Effects.java │ │ ├── Tables.java │ │ ├── Channel.java │ │ ├── PlayerState.java │ │ ├── Player.java │ │ └── ChannelState.java │ │ ├── model │ │ └── Model.java │ │ ├── ui │ │ ├── Button.java │ │ ├── ToggleButton.java │ │ ├── Slider.java │ │ ├── Frequencies.java │ │ ├── TextureAtlas.java │ │ ├── UserInterface.java │ │ └── Design.java │ │ ├── format │ │ ├── Step.java │ │ ├── Format.java │ │ ├── Waveform.java │ │ └── FormatParser.java │ │ └── playlist │ │ └── Playlist.java └── java.web │ ├── Boot.java │ └── WebAudio.java ├── target └── web │ └── index.html └── macro └── java.web └── webAudio └── WebAudioHelperMacro.java /screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/screenshot.gif -------------------------------------------------------------------------------- /resources/mod/sac06.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/resources/mod/sac06.mod -------------------------------------------------------------------------------- /resources/mod/sac14.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/resources/mod/sac14.mod -------------------------------------------------------------------------------- /resources/fonts/bitboy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/resources/fonts/bitboy.png -------------------------------------------------------------------------------- /resources/mod/agnostic.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/resources/mod/agnostic.mod -------------------------------------------------------------------------------- /resources/mod/class11.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/resources/mod/class11.mod -------------------------------------------------------------------------------- /resources/mod/complex.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/resources/mod/complex.mod -------------------------------------------------------------------------------- /resources/mod/delicate.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/resources/mod/delicate.mod -------------------------------------------------------------------------------- /resources/mod/rainfore.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/resources/mod/rainfore.mod -------------------------------------------------------------------------------- /resources/texture/TextureAtlas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/resources/texture/TextureAtlas.png -------------------------------------------------------------------------------- /resources/mod/-super_mario_land.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/resources/mod/-super_mario_land.mod -------------------------------------------------------------------------------- /resources/mod/goto8o-dansa_i_neon.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/resources/mod/goto8o-dansa_i_neon.mod -------------------------------------------------------------------------------- /resources/mod/wotw-commodore_rulez.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defrac/defrac-sample-8bitboy/HEAD/resources/mod/wotw-commodore_rulez.mod -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # defrac 2 | ########## 3 | *.class 4 | target/ 5 | .idea/ 6 | 7 | # OS 8 | ########## 9 | .DS_Store 10 | .DS_Store? 11 | ._* 12 | .Spotlight-V100 13 | .Trashes 14 | ehthumbs.db 15 | Thumbs.db 16 | -------------------------------------------------------------------------------- /default.settings: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Bitboy", 3 | "package": "com.audiotool.bitboy", 4 | "version": "1.0", 5 | 6 | "main": "Boot", 7 | 8 | "targets": [ 9 | "web" 10 | ], 11 | 12 | "web": { 13 | "debug": "false", 14 | "strictMode": "false", 15 | "js": "bitboy.js", 16 | "optimize": "true" 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 8bitboy 2 | ======= 3 | ![8bitboy](/screenshot.gif?raw=true "8bitboy") 4 | 5 | defrac version of an Amiga Modplayer to playback old mod formats. 6 | 7 | This sample works currently only in the web and makes use of 8 | the Web Audio API. 9 | 10 | 11 | Amiga Modformat 12 | --------------- 13 | Read this [article](http://en.wikipedia.org/wiki/MOD_(file_format) "Mod Format") on Wikipedia 14 | for more information. 15 | 16 | Online Demo 17 | =========== 18 | https://www.defrac.com/sample-8bitboy/ 19 | -------------------------------------------------------------------------------- /src/java/com/audiotool/bitboy/dsp/Effects.java: -------------------------------------------------------------------------------- 1 | package com.audiotool.bitboy.dsp; 2 | 3 | /** 4 | * @author Andre Michelle 5 | */ 6 | final class Effects 7 | { 8 | static final int Arpeggio = 0x0; 9 | static final int PortamentoUp = 0x1; 10 | static final int PortamentoDown = 0x2; 11 | static final int TonePortamento = 0x3; 12 | static final int Vibrato = 0x4; 13 | static final int TonePortamentoVolumeSlide = 0x5; 14 | static final int VibratoVolumeSlide = 0x6; 15 | static final int Tremolo = 0x7; 16 | static final int SetPanning = 0x8; 17 | static final int SampleOffset = 0x9; 18 | static final int VolumeSlide = 0xa; 19 | static final int PositionJump = 0xb; 20 | static final int SetVolume = 0xc; 21 | static final int PatternBreak = 0xd; 22 | static final int ExtendedEffect = 0xe; 23 | static final int SetSpeed = 0xf; 24 | } -------------------------------------------------------------------------------- /src/java/com/audiotool/bitboy/model/Model.java: -------------------------------------------------------------------------------- 1 | package com.audiotool.bitboy.model; 2 | 3 | import defrac.event.EventDispatcher; 4 | import defrac.event.EventListener; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | /** 9 | * @author Andre Michelle 10 | */ 11 | public final class Model 12 | { 13 | public static Model create( @Nonnull final T value ) 14 | { 15 | return new Model( value ); 16 | } 17 | 18 | private final EventDispatcher> dispatcher; 19 | 20 | private T value; 21 | 22 | private Model( @Nonnull final T value ) 23 | { 24 | this.value = value; 25 | 26 | dispatcher = new EventDispatcher<>(); 27 | } 28 | 29 | public void setValue( @Nonnull final T value ) 30 | { 31 | if( this.value != value ) 32 | { 33 | this.value = value; 34 | 35 | dispatcher.dispatch( this ); 36 | } 37 | } 38 | 39 | @Nonnull 40 | public T getValue() 41 | { 42 | return value; 43 | } 44 | 45 | public void setDispatch( @Nonnull final EventListener> listener ) 46 | { 47 | dispatcher.add( listener ); 48 | 49 | listener.onEvent( this ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/java/com/audiotool/bitboy/dsp/Tables.java: -------------------------------------------------------------------------------- 1 | package com.audiotool.bitboy.dsp; 2 | 3 | import java.util.HashMap; 4 | 5 | /** 6 | * @author Andre Michelle 7 | */ 8 | final class Tables 9 | { 10 | static final int[] Tone = new int[]{ 11 | 856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453, 12 | 428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226, 13 | 214, 202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113 14 | }; 15 | 16 | static final HashMap ToneIndices = generateToneIndex(); 17 | 18 | static final int[] Sine = new int[]{ 19 | 0, 24, 49, 74, 97, 120, 141, 161, 20 | 180, 197, 212, 224, 235, 244, 250, 253, 21 | 255, 253, 250, 244, 235, 224, 212, 197, 22 | 180, 161, 141, 120, 97, 74, 49, 24, 23 | 0, -24, -49, -74, -97, -120, -141, -161, 24 | -180, -197, -212, -224, -235, -244, -250, -253, 25 | -255, -253, -250, -244, -235, -224, -212, -197, 26 | -180, -161, -141, -120, -97, -74, -49, -24 27 | }; 28 | 29 | private static HashMap generateToneIndex() 30 | { 31 | final HashMap map = new HashMap<>(); 32 | 33 | final int n = Tone.length; 34 | 35 | for( int i = 0 ; i < n ; ++i ) 36 | map.put( Tone[ i ], i ); 37 | 38 | return map; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/java/com/audiotool/bitboy/ui/Button.java: -------------------------------------------------------------------------------- 1 | package com.audiotool.bitboy.ui; 2 | 3 | import defrac.display.Image; 4 | import defrac.display.Texture; 5 | import defrac.display.event.UIEvent; 6 | import defrac.display.event.UIEventType; 7 | import defrac.display.event.UIProcessHook; 8 | import defrac.lang.Procedure; 9 | 10 | import javax.annotation.Nonnull; 11 | import javax.annotation.Nullable; 12 | 13 | /** 14 | * @author Andre Michelle 15 | */ 16 | class Button extends Image implements UIProcessHook 17 | { 18 | private final Texture[] textures; 19 | 20 | @Nullable 21 | private Procedure