Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Rodrigo Yeowtch ! (Registered 2024-11-24) 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: 498
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: 498
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: 2014
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: 498
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
zscs
megasoftargentina
Kakka/Extend, Damone..
astaroth/TRSI
Mixer
Ixon
katon/Lepsi De
Fresh
Brittle/Dentifrice^(?)
Guests online: 128
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Mojo  (9.6)
6 Uncensored  (9.6)
7 Wonderland XIV  (9.6)
8 Comaland 100%  (9.6)
9 What Is The Matrix 2  (9.6)
10 No Bounds  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Party Elk 2  (9.6)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.6)
5 Libertongo  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Morph  (9.5)
9 Dawnfall V1.1  (9.5)
10 It's More Fun to Com..  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Nostalgia  (9.3)
5 Censor Design  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 Tim  (9.7)

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