Coder Social home page Coder Social logo

kenrick95 / nikku Goto Github PK

View Code? Open in Web Editor NEW
51.0 5.0 7.0 3.68 MB

👽 Web-based BRSTM player

Home Page: https://kenrick95.github.io/nikku/

License: MIT License

JavaScript 13.30% HTML 3.46% CSS 2.91% TypeScript 80.33%
brstm web-audio-api webaudio music

nikku's Introduction

Nikku

Web-based BRSTM player

Just open the demo in modern browser, select a .brstm file, and enjoy!

What Is BRSTM?

BRSTM is a file format that contains audio data that's being used for some Nintendo consoles. One of the differences with the usual audio format (MP3, etc) is that this format can contain a loop point, making it suitable for usage in games.

.brstm file is not included in the repository.

Some places to look for BRSTM files:

Browser Requirements

There are no polyfill included in the demo.

Browser needs to support the following features without any vendor prefix:

References

  • WiiBrew, for BRSTM file description.
  • BrawlLib codes, on how to decode BRSTM.

See Also

nikku's People

Contributors

dependabot[bot] avatar ic-scm avatar kenrick95 avatar rphsoftware avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nikku's Issues

(Improvement) BRSTM reader doesn't support BRSTM track information

The BRSTM reader does not support the full track information data in BRSTM files (https://wiibrew.org/wiki/BRSTM_file#HEAD_chunk_part_2). This information is important for multi-track files as they don't always have 2 channel stereo tracks, they can also have mono tracks or both stereo and mono tracks in a single file.
I'm attaching a 3 channel file with a 2 channel stereo track and a second mono track. The player only shows the first stereo track because I'm guessing that it always assumes all tracks to be stereo tracks in files with more than 2 channels.
test-3ch.zip

skipping backwards into negative time while paused

As you can see in the following image, the song is playing at the negative 21 minutes mark, and I think this is because of some part of the code which handles skipping backwards. It seems to be happening in the background even when the music is paused, so leaving it paused for an extended period of time (mine was paused for more than an hour) and then unpausing it results in negative time. (technically, this timestamp isn't wrong, but it also isn't very helpful.)

image

No little endian file support

The BRSTM reader module does not work with little endian files. The endianness of the file is specified in the byte order mark at offset 0x04 (https://wiibrew.org/wiki/BRSTM_file#BRSTM_header, 0xFEFF for big endian and 0xFFFE for little endian), but the BRSTM reader ignores that, and when a little endian file is loaded the reader still tries to interpret it as a big endian file which will usually cause some crazy javascript error.

Little endian BRSTM files are very rare so this could be simply fixed by checking the byte order mark and returning some error like "Little endian files are not supported." when the byte order mark is little endian, but to support little endian files the reading functions like getSliceAsNumber would have to be changed to support both LE and BE numbers. This could probably be done by having two different functions (for example getSliceAsNumber_BE and getSliceAsNumber_LE) and then setting getSliceAsNumber as a pointer/reference to one of those functions (if javascript supports that) after reading the byte order mark from the file.

BCSTM/BFSTM files are often little endian, this issue would have to be fixed to implement a BCSTM/BFSTM reader in this module (issue #9).

UI to play certain streams/tracks

Feedback from Reddit

[..] perhaps make an option to only play certain streams at once? (perhaps with checkboxes "Stream 1", "Stream 2" etc)

it was hard to find an easy way to play multiple streams at once, and having the ability to change which streams i'm hearing would be great!

some BRSTM files only play the first stream, too.


The second comment with links to the BRSTM files in question

The given files have a weird number of tracks and channels 😂

  • Wii Fit Plus - Balance Bubble
    • numberChannels = 4 !?
    • numberTracks = 2 !?
    • Actual behavior: Played both tracks simultaneously
    • Expected outcome: UI to control which track to play simultaneously
  • Wii Fit Plus - Snowball Fight
    • numberChannels = 8 !?
    • numberTracks = 4 !?
    • Actual behavior: Played only the 1st track
    • Expected outcome: UI to control which track to play simultaneously

During my testing all my brstm files only have 2 channels with 1 track 😅


For reference, BrawlBox have this kind of UI for the stream/track selection:

Annotation 2019-07-16 232430


Some reference for research

Making an APK Version for Android

Greetings! I would like to inquire about if it would be possible to eventually create like an APK version of this BRSTM Player, in order to allow for us to play BRSTMs offline and on the go. Thanks!

Correct description of BRSTM files

BRSTM files are not lossless - the linked answers are wrong. ADPCM is a lossy codec. BRSTM files are only lossless when storing audio as uncompressed PCM data, which is rarely the case.
I think it'll be better to remove the false information from the README, help text, and any other places, to prevent misleading more people into thinking it is a lossless format.

Issue with the volume

I love this player so much I have a dedicated bookmark for it whenever I want to listen to some music from my favorite games! There’s just one issue though. At the time of me making this comment, over the past few hours, I’ve been having an issue regarding the volume. Whenever I try to adjust it to turn the volume down, the audio just shuts off and the track bar completely bugs out, going off of the lane it’s supposed to be in and over to the sides of the page. It’s really bizarre, and this hasn’t happened before until now. It also only happens when I click on anything regarding the volume. The track bar itself is just fine, it’s just that the audio settings are really wonky as is. A proper fix as soon as you can would be more than helpful. Thanks!

Offline Support Request (via index.html)

Hello there. I appreciate this web player as I can play video game music without having to rewind them manually.
If only I can run this from index.html when offline (e.g. when on a vacation). I downloaded the .zip file of source code from Release page, unzipped it, and run the index.html from Chrome (both from PC and Android).
Only the Select file is available and the music player itself (progress bar, play buttons, and volume control) does not load, even after selecting a .BRSTM file.
image
One currently-closed issue (#28) kinda points this out, but for me making this music player available offline to run via index.html is enough. Thanks a lot in advance.

Progress Bar Bugs

  • When paused, if I drag the progress bar, the music unpauses, but the progress bar stays still. While in this state, pausing and unpausing unfreezes the progress bar.
  • I am unable to drag the progress bar when on a mobile touchscreen device (both in and out of Desktop mode; I use an Android). Maybe has something to do with the fact that one can zoom the page by pinching the screen.

P.S.
Sorry for the title edits. My keyboard was broken (I could not Shift + W) when I typed the title and had to restart the PC.

Add support for BFSTM types of files

Hello Kenrick95,

I would like to suggest to add support for BFSTM.
This file is used in most Nintendo Switch and Wii U Games.

Thank you for the amazing work you have done making a web-based media player!

Kind regards,
MVDW.

When a new file is selected, the volume slider is treated as if it's at 100%, until it is changed again

The site includes a volume slider. If you lower the volume for the current song, then select another one, the next song plays at 100% volume, regardless of the state of the slider. Only if you move the slider some amount, will the reduced volume take effect.

This should be fixed by making the volume slider affect the playback of a song after a new one is selected with the "Select file..." button.

Add back Drag'n'drop support

Hi, although I really like the new design, a consequence is that you cannot drag'n'drop brstm files in to the browse button anymore. Can you reenable that feature?

Audio player cannot merge more than 2 tracks

The track/stream merger in the player doesn't seem to be able to merge more than 2 tracks at a time. When I enable more than 2 tracks, another track will go silent, and with some combinations it's even weirder and plays only 1 track or doesn't mix them properly. Tried with a 14 channel (7 stereo tracks) file, and an 8 channel file (4 stereo tracks), in both Chromium and Firefox based web browsers. I'm attaching a test 8 channel file with a different pair of sine waves on each track.
8ch-sinetest.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.