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: 443
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: 443
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: 1987
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: 443
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
iAN CooG/HVSC
Low Spirit
hedning/G★P
K-reator/CMS/F4CG
Oxbow/Xenon
Andy/AEG
Operator Teleksu
Guests online: 365
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 No Bounds  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 Party Elk 2  (9.7)
2 Cubic Dream  (9.6)
3 Copper Booze  (9.5)
4 Rainbow Connection  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Onscreen 5k  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Nostalgia  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

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