Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Samuel Goldszmidt
    @ouhouhsami
    so, good luck with all that stuff ;)
    Hugh Rawlinson
    @hughrawlinson
    Thanks! :)
    Samuel Goldszmidt
    @ouhouhsami
    cheers
    Jefferson de Andrade Santos
    @jersobh
    Hi folks
    I'm trying to create a simple code to play a mp3 file
    const AudioContext = require('web-audio-api').AudioContext
      , audioCtx = new AudioContext
      , Speaker = require('speaker')
    
      var constraints = {
        audio: {
          echoCancellation: true
        }
      };
    
      var player = new Audio();
      player.src= "samba.mp3"
      audioSource = this.audioCtx.createMediaElementSource(player);
      audioSource.connect(this.music_node);
      this.music_node.connect(this.outputNode);
    
      this.outputNode = this.audioCtx.createGain();
      this.voice_node = this.audioCtx.createGain();
      this.music_node = this.audioCtx.createGain();
      this.voice_volume = 50
      this.music_volume = 50
      this.output = 100
    
    var channels = 2;
    
    audioCtx.outStream = new Speaker({
      channels: channels,
      bitDepth: 128,
      sampleRate: 44100
    })
    but I can't create the "new Audio()"
    ReferenceError: Audio is not defined
    Would that be the audioParam?
    Jefferson de Andrade Santos
    @jersobh
    I also have the option to get a stream data if this one is not possible.. but it would be great
    Jefferson de Andrade Santos
    @jersobh
    <3
    Please folks, I just need to create this API; just a simple mp3 player with web audio api
    Just to sync the node webaudio api data with my frontend data via websockets.
    Chinmay Pendharkar
    @notthetup
    @jersobh AFAIK this project is in a little bit of flux right now. You might have noticed the change in the repo ownership. So updates might take some time.
    Jefferson de Andrade Santos
    @jersobh
    But do you know how can I archieve this w/o web audio API?
    Chinmay Pendharkar
    @notthetup
    @jersobh If you just want to play an mp3 file, could you not just use something like https://www.npmjs.com/package/lame?
    and pipe that into speaker
    Jefferson de Andrade Santos
    @jersobh
    I'll take a look.. In fact i'm using liquidsoap, and I only know how to plug it in web audio API
    But i'll take a look, thanks
    Chinmay Pendharkar
    @notthetup
    so Webaudio API is a browser API
    it's pretty complex and lots of nuances involved in it
    it's not an easy task to implement that in node, hence this project is taking time
    Jefferson de Andrade Santos
    @jersobh
    I ser
    See*
    Chinmay Pendharkar
    @notthetup
    I'm still not sure what you're trying to achieve, so can't really help that much
    Jefferson de Andrade Santos
    @jersobh
    I'm thinking about using node-fluent-ffmpeg... But I couldn't figure out how to create the stream for broadcasting
    It's a radio platform
    Using liquidsoap/icecast
    I have the frontend up and running, but it only works if the browser is open
    I want to put it on a service running on a server
    To create that stream on server si de
    Chinmay Pendharkar
    @notthetup
    yea.. the frontend will only work if the browser is open..
    that's how browsers work
    so you wanted to have a mock server to test the streaming server?
    Jefferson de Andrade Santos
    @jersobh
    I was trying to say that the music can only be played while the browser is open
    so I need to create the streaming service
    I've already sync. the playlist with socket.io
    so when I open the frontend, it loads all the configs for the streaming, as the playlist
    but I need to play it on node's side, so when the browser is closed, it still plays
    Jefferson de Andrade Santos
    @jersobh
    this is how I connect it

    var webcast = this.audioCtx.createWebcastSource(4096, 2);

    this.outputNode.connect(webcast);

    webcast.connect(this.audioCtx.destination);

    webcast.connectSocket(encoder, this.url);

    I need to do this but from node, and the encoder param is the encoded audio
    Chinmay Pendharkar
    @notthetup
    sorry still confused :(
    createWebcastSource is from https://webcast.github.io/ right? So you're trying to stream FROM the browser TO some server?
    let's start from the beginning (for my sake) :)
    You have a audio streaming server that uses liquidsoap/icecast to stream out the audio
    are you trying to build a client that will receive that audio from the icecast server? or?
    Jefferson de Andrade Santos
    @jersobh
    That's what I'm already doing
    Streaming from the browser to a server
    Chinmay Pendharkar
    @notthetup
    oh! streaming from the browser to the server