Skip to content
This repository was archived by the owner on Jun 9, 2019. It is now read-only.
This repository was archived by the owner on Jun 9, 2019. It is now read-only.

Alright, I give up. Can someone help, please? #65

Description

@FireController1847

Now I know this isn't an issue but I am completely lost. I'm quite new to this so please bare with me. This is my current attempt code:

const Speaker = require("speaker");
const AudioContext = require("web-audio-engine").StreamAudioContext;
const decode = require("audio-decode");
const fs = require("fs");
const context = new AudioContext();

console.log("Running");
(async () => {
  const file = fs.readFileSync("./myfile.mp3");
  console.log("Decoding");
  const buffer = await decode(file);
  console.log("Decoded");
  const amp = context.createGain();

  const source = context.createBufferSource();
  source.buffer = buffer;
  source.connect(amp);
  source.start();

  amp.gain.value = 1;
  amp.connect(context.destination);
  
  context.pipe(new Speaker());
  context.resume();
  console.log("End");
})();

I am attempting to pipe the stream into a new speaker, and play the mp3 file attached (essentially creating a mini audio player). Issue is, this literally does nothing. It doesn't error. It doesn't work. It does nothing. The only thing it does is log my three logs, and then there's absolutely no audio. I can get the example on the main page to work, but that's it, I can't seem to find anything else in this world that will work. Can someone help me out, please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions