Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > CSDb Entries > Release id #160971 : Tiny'R'Sid [reloaded]
2023-05-12 17:09
spider-j

Registered: Oct 2004
Posts: 449
Release id #160971 : Tiny'R'Sid [reloaded]

Is there an easy way using this as JS sidplayer like jsSID-0.9.1?
I found a current repo at https://bitbucket.org/wothke/websid/src/master/ but can't build it on linux.

Even if I could: is there an easy way to play SID tunes with it? I looked at the JS includes of deepsid, but couldn't figure it out.

Is there a simple "play", "stop", "pause" API of some kind?

Thanks!
spider.
2023-05-24 10:38
spider-j

Registered: Oct 2004
Posts: 449
Okay, answering this for myself (and maybe the next one who stumbles over this thread), it's quite a complicated process. I peeked at deepsid to find this solution:

1. make sure your webserver correctly serves .wasm files

2. git clone https://bitbucket.org/wothke/websid.git
and git clone https://bitbucket.org/wothke/webaudio-player.git

3. copy "scriptprocessor_player.js" from webaudio-player to your JavaScript directory and include it in your webpage

4. copy "htdocs/backend_tinyrsid.js" from websid to your JavaScript directory and include it in your webpage

5. copy "htdocs/tinyrsid.wasm" from websid to your web root directory

6. include base64 encoded versions of C64 BASIC, CHARSET and KERNAL ROMS as variables in your JavaScript (usually /usr/share/vice/C64/basic, /usr/share/vice/C64/chargen, /usr/share/vice/C64/kernal)

var BASIC_ROM = ... $INSERT_BASE64_BASIC_HERE$ ...;
var CHAR_ROM = ... $INSERT_BASE64_CHARGEN_HERE$ ...;
var KERNAL_ROM = ... $INSERT_BASE64_KERNAL_HERE$ ...;


7. in your JavaScript you can make a wrapper class for simple load and stop actions:

var playerWrapper = function ()
{
    var _ = this;

    _.webSidBackend = new SIDBackendAdapter(BASIC_ROM, CHAR_ROM, KERNAL_ROM);
    window.ScriptNodePlayer.createInstance(
        _.webSidBackend,
        '',
        [],
        false,
        (function(){}),
        (function(){}),
        (function(){}),
        undefined,
        undefined,
        16384
    );
    _.webSid = window.ScriptNodePlayer.getInstance();

    _.play = function (link, subtune)
    {
        if (typeof(subtune) === "undefined") subtune = 0;

        _.webSid.loadMusicFromURL(link, options, (function(){}), (function(){}), (function(){}));
    }

    _.stop = function ()
    {
        _.webSid.pause();
    }
}


8. You can then call simple play() and stop() functions like so:

var player = new playerWrapper();

// play a SID, subtune is optional
player.play(url, subtune);

// stop a playing SID
player.stop();
2023-05-24 15:54
JackAsser

Registered: Jun 2002
Posts: 1995
Not only is subtune optional, it's not even used. :)

But thanks for the info spider!
2023-05-24 16:18
spider-j

Registered: Oct 2004
Posts: 449
Quoting JackAsser
Not only is subtune optional, it's not even used. :)

Oh, you're right. That happens when you "on the fly" cut out pieces of a larger code and paste it together again.

This should work:

var playerWrapper = function ()
{
    var _ = this;

    _.webSidBackend = new SIDBackendAdapter(BASIC_ROM, CHAR_ROM, KERNAL_ROM);
    window.ScriptNodePlayer.createInstance(
        _.webSidBackend,
        '',
        [],
        false,
        (function(){}),
        (function(){}),
        (function(){}),
        undefined,
        undefined,
        16384
    );
    _.webSid = window.ScriptNodePlayer.getInstance();

    _.play = function (link, subtune)
    {
        if (typeof(subtune) === "undefined") subtune = 0;

        var options = {
            track: subtune
        };

        _.webSid.loadMusicFromURL(link, options, (function(){}), (function(){}), (function(){}));
    }

    _.stop = function ()
    {
        _.webSid.pause();
    }
}
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
WVL/Xenon
goerp/F4CG/HF
Guests online: 76
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.7)
6 No Bounds  (9.6)
7 Aliens in Wonderland  (9.6)
8 Comaland 100%  (9.6)
9 Uncensored  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 It's More Fun to Com..  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Nostalgia  (9.4)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 SHAPE  (9.3)
Top Fullscreen Graphicians
1 Joe  (9.7)
2 Veto  (9.6)
3 Facet  (9.6)
4 The Sarge  (9.6)
5 Carrion  (9.5)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.038 sec.