Skip to content

Trying the measuring stream example #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
podaen opened this issue Apr 26, 2022 · 20 comments
Closed

Trying the measuring stream example #183

podaen opened this issue Apr 26, 2022 · 20 comments

Comments

@podaen
Copy link
Contributor

podaen commented Apr 26, 2022

communication example

I want to try it, but I can't find MeasuringStream out;

Thanks

@pschatzmann
Copy link
Owner

pschatzmann commented Apr 26, 2022

Just wrap your final input or output in this class and use it instead. Example: https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-communication/communication-ip-send/communication-ip-send.ino
ps. The log level needs to be on info to see the result in the log.
If you don't wrap you can only write to it (use it a copy destination) to measure the output speed.

@podaen
Copy link
Contributor Author

podaen commented Apr 26, 2022

measuring class still undefined, if I know the .h file, I could manual imported. Or you could included in to audiotools...

@pschatzmann
Copy link
Owner

What do you mean - I don't understand. It has been defined in AudioStreams.h.
Maybe you have an old version ?

@podaen
Copy link
Contributor Author

podaen commented Apr 26, 2022

I have updated, now it is recognized. Thanks

@podaen
Copy link
Contributor Author

podaen commented Apr 26, 2022

it is not for measuring an http link? I see server begin...

@pschatzmann
Copy link
Owner

pschatzmann commented Apr 26, 2022

It measures the troughput by calculating the total amount of data written or read per second and can be used on any Stream

@podaen
Copy link
Contributor Author

podaen commented Apr 26, 2022

Doesn't see any difference in the serial monitor.

#include <WiFiClientSecure.h>
#include <ssl_client.h>
#include "AudioTools.h"
#include <WiFi.h>

const char* ssid = "ssid";
const char* password = "pass";

uint16_t sample_rate = 44100;// 16000;
uint16_t port = 8000;// 8000;
uint8_t channels = 1;  // The stream will have 2 channels
URLStream url(ssid, password);
//WiFiServer server(port);
//WiFiClient client;
//MeasuringStream out;
HexDumpStream out;
//StreamCopy copier(out, client);
StreamCopy copier(out, url);



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

    // connect to WIFI
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }
    Serial.println();
    Serial.println(WiFi.localIP());



    // start server
    //server.begin();

    //url.begin("https://centralcharts.ice.infomaniak.ch/centralcharts-128.mp3", "audio/mp3");
    url.begin("http://22183.live.streamtheworld.com/JOE.mp3", "audio/mp3");

    // start out
    out.begin();

    Serial.println("started...");
}

void loop() {
    // get a new connection if necessary
    //if (!client) {
    //    client = server.available();
    //    client.setNoDelay(true);
    //}
    //// copy data if we are connected
    //if (client.connected()) {
    //    copier.copy();
    //}
    copier.copy();
}

@pschatzmann
Copy link
Owner

Obviously you did not process any data yet, since the log states that it's waiting for data.
If you want to look at the data you can use a HexDumpStream as output.

@podaen
Copy link
Contributor Author

podaen commented Apr 26, 2022

yep, see now some data

@podaen
Copy link
Contributor Author

podaen commented Apr 26, 2022

what am I seen now... Input data of the content before it is decoded and outputed?

@podaen
Copy link
Contributor Author

podaen commented Apr 26, 2022

Now, how can I found the beginning of the frame or padding or content or package or what ever?

@podaen
Copy link
Contributor Author

podaen commented Apr 26, 2022

Soo, I was right,

for this link

url.begin("http://22183.live.streamtheworld.com/JOE.mp3", "audio/mp3");

the input stops, if it is input what I am seening, still don't know...

But I think soo, because HexDumpStream out; is an output of the stream in serial monitor of my URLStream url(ssid, password);

I got a lot of data don't know where the beginning is

8F D2 DD E DF A9 8A EC - 31 CD 66 DE 8A F9 B3 A6
B9 D1 AF BB 16 ED F4 2F - A8 20 AF F0 5F F2 FE 11
BE 8B F8 BA 17 E8 7F C1 - FE 76 FF A1 7D 42 2B F8
E0 FE AD 95 FE 10 53 7D - 7E 82 D9 B F2 3 1F 5A
62 A 6A 28 0 0 0 FF - FB 92 64 0 0 3 E4 5A
5E EE 3D 0 0 3A C0 77 - A4 C1 8 0 10 1 13 67
7D 85 80 0 E8 80 1F 2F - 82 30 0 29 FF FC 40 6
C7 82 E4 49 AC 34 A2 5A - C3 F9 60 80 AA 41 1B 76
EE 2 3D F 4B 47 8A 88 - 60 4A 3C 4F 7 EC E 0
8 27 80 F3 C0 68 B0 E0 - E8 42 7E D5 C3 F1 60 A0
80 2F 6A 8E F6 7D 83 52 - 84 2 F 91 83 DE FF E5
FF C6 A F3 F7 89 DE 29 - ED 2E 87 AC 8B D 8E 53
E7 F4 FB FE A5 FD 9F EA - 62 A7 5D 23 4F 9F F4 B9
EF B8 EB DA 26 AA 2E 3F - 84 A9 BF FF FE 9A 51 46
44 8D 50 84 24 FB 5E B0 - 0 1 6 0 20 20 2B E1
74 62 C7 8B 91 D0 A5 BB - 4 9 ED CF AD 91 33 F4
2C E C9 D2 DE 2C 0 26 - 59 F2 CF F9 72 1D AA 3D
FE 51 12 F0 55 8B 2D 9E - FE 93 99 C0 1C 9F FF FF
FF 81 28 2F 58 0 0 A - ED 4F 0 32 17 F2 55 35
9B 32 C8 DC 62 1A 97 43 - 70 D4 31 33 4D C 10 40
C8 EB F C7 47 81 4C 10 - 80 54 72 B0 21 19 97 96
A7

and than it stoped

@podaen
Copy link
Contributor Author

podaen commented Apr 26, 2022

Now I am going to config it and see if data still coming in. Seems a good strategie.

@podaen
Copy link
Contributor Author

podaen commented Apr 26, 2022

My question now is... do we need to get two channels for the audio player? It will calmen the input stream

#define DEFAULT_CHANNELS 2

@podaen
Copy link
Contributor Author

podaen commented Apr 26, 2022

These settings doesn't effect the stream player???

#ifndef DEFAULT_BUFFER_SIZE 
#define DEFAULT_BUFFER_SIZE 1024//6144//4096//512//1024//2048//1024
#endif

#ifndef DEFAULT_SAMPLE_RATE 
#define DEFAULT_SAMPLE_RATE 88200//44100
#endif

#ifndef DEFAULT_CHANNELS 
#define DEFAULT_CHANNELS 1

I have the url player running on the same time with the same settings and the player is still running but the stream url stops.

@pschatzmann
Copy link
Owner

If you process MP3 the audio information is part of the MP3 format, so all audio parameters are not relevant.

@podaen
Copy link
Contributor Author

podaen commented Apr 26, 2022

what could I do to change some settings of the input audio?

@pschatzmann
Copy link
Owner

@podaen
Copy link
Contributor Author

podaen commented Apr 27, 2022

This maybe also important related to the url-stream.

long rssi = WiFi.RSSI();
Serial.print("Signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");

also ping and measuring the internet speed, this could be done when the program starts as info. But measure the internet speed take some time, soo this is maybe not soo good idea...

@pschatzmann
Copy link
Owner

I think the measuring stream question has been answered.
In order to avoid any confusion I am closing this issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants