Skip to content

Mp3 stream to I2S Stutter, pauses, noises etc. #510

@alexliit

Description

@alexliit

Hello!

I have played a bit with the provided example (streams-url_mp3-i2s.ino) but the audio output suffer from stutters, noises, pauses etc.. randomly: it may play perfectly for 1 or 2 minutes, then started to make some noise or stops for a second...restart to play ok for 30" then noise ...etc.
No warning seen on serial output
AudioLogger::instance().begin(Serial, AudioLogger::Warning);
changed also buffer size without any effect on the issue
URLStream url("xxx","xxxxxx",4048);
also changed the source stream
url.begin("http://direct.fipradio.fr/live/fip-midfi.mp3","audio/mp3");
Also changed some different power sources (USB powerbank, PC USB..).

Any hint?

May be it is some chip issues (ESP32 or I2S MAX98357A)?

Below the full code.

Thanks!

`/**
 * @file streams-url_mp3-i2s.ino
 * @author Phil Schatzmann
 * @brief decode MP3 stream from url and output it on I2S
 * @version 0.1
 * @date 2021-96-25
 * 
 * @copyright Copyright (c) 2021
 */

// install https://github.com/pschatzmann/arduino-libhelix.git

#include "AudioTools.h"
#include "AudioCodecs/CodecMP3Helix.h"


URLStream url("xxx","xxxxx",4048);
I2SStream i2s; // final output of decoded stream
EncodedAudioStream dec(&i2s, new MP3DecoderHelix()); // Decoding stream
StreamCopy copier(dec, url); // copy url to decoder


void setup(){
  Serial.begin(115200);
  AudioLogger::instance().begin(Serial, AudioLogger::Warning);  


  // setup i2s
  auto config = i2s.defaultConfig(TX_MODE);
  // you could define e.g your pins and change other settings
  config.pin_ws=13;
  config.pin_bck=12;
  config.pin_data=15;

  LogarithmicVolumeControl lvc(0.5);


  //config.mode = I2S_STD_FORMAT;
  i2s.begin(config);

  // setup I2S based on sampling rate provided by decoder
  dec.setNotifyAudioChange(i2s);
  dec.begin();

// mp3 radio
  url.begin("http://stream.srg-ssr.ch/m/rsj/mp3_128","audio/mp3");
  //url.begin("http://direct.fipradio.fr/live/fip-midfi.mp3","audio/mp3");
  

}

void loop(){
  copier.copy();
}`

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