Open Aleks-Ale opened 3 years ago
HI,Sorry, this one : https://github.com/baldram/ESP_VS1053_Library
Me too, I will try again… Do you have a plan to integrate a spectrum analyzer? For example like this: https://github.com/blotfi/ESP32-Radio-with-Spectrum-analyzer
No, never thought about integrating a spectrum analuzer. I just wanted a hands free radio 😁
Op wo 13 jan. 2021 15:39 schreef Aleks-Ale notifications@github.com:
HI,Sorry, this one : https://github.com/baldram/ESP_VS1053_Library https://github.com/baldram/ESP_VS1053_LibraryI%E2%80%99ll
Me too, I will try again… Do you have a plan to integrate a spectrum analyzer? For example like this: https://github.com/blotfi/ESP32-Radio-with-Spectrum-analyzer
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gitpeut/OranjeRadio/issues/1#issuecomment-759491053, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGEQRY2GUWA3XQ3ARRBDMB3SZWWC3ANCNFSM4WAZQFRA .
I just wanted a hands free radio
Really cool job! can play http and https? I'm looking your code.
int add_station( char *name, int protocol, char *host, char* path, int port ){
int i;
for ( i = 0; i< STATIONSSIZE; ++i ){
if ( stations[i].status == 0 ){
stations[i].name = ps_strdup( name);
stations[i].host = ps_strdup( host);
stations[i].path = ps_strdup( path);
stations[i].port = port;
stations[i].protocol = protocol; <--------?
stations[i].position = 0; <--------?
stations[i].status = 1; <--------?
break;
}
}
add_station("NPO Radio 1","icecast.omroep.nl","/radio1-bb-mp3",80); // Name, host, path, port ....
Do you mean http/https as protocol ? What is position and status? Please show full row for add_station.
Should be playing both http and https streams, but many https streams are encoded in a different way ( forgot the name) and I did not implement that.
Op wo 13 jan. 2021 17:36 schreef Aleks-Ale notifications@github.com:
I just wanted a hands free radio
You did a really cool job! can play http and https? I'm looking your code.
int add_station( char name, int protocol, char host, char* path, int port ){ int i;
for ( i = 0; i< STATIONSSIZE; ++i ){ if ( stations[i].status == 0 ){ stations[i].name = ps_strdup( name); stations[i].host = ps_strdup( host); stations[i].path = ps_strdup( path); stations[i].port = port; stations[i].protocol = protocol; <--------? stations[i].position = 0; <--------? stations[i].status = 1; <--------? break; } }
add_station("NPO Radio 1","icecast.omroep.nl","/radio1-bb-mp3",80); // Name, host, path, port ....
Do you mean http/https as protocol ? What is position and status? Please show full row for add_station.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gitpeut/OranjeRadio/issues/1#issuecomment-759569376, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGEQRYY2TWVJOXE6CFT7G5DSZXDXJANCNFSM4WAZQFRA .
Do you mean http/https as "protocol" ? What is "position" and "status"? Please show full row for add_station.
int add_station( char *name, int protocol, char *host, char* path, int port ){
int i;
for ( i = 0; i< STATIONSSIZE; ++i ){
if ( stations[i].status == 0 ){
stations[i].name = ps_strdup( name);
stations[i].host = ps_strdup( host);
stations[i].path = ps_strdup( path);
stations[i].port = port;
stations[i].protocol = protocol; <--------?
stations[i].position = 0; <--------?
stations[i].status = 1; <--------?
break;
}
}
add_station("NPO Radio 1","icecast.omroep.nl","/radio1-bb-mp3",80); // Name, host, path, port ....
Only one error after compilation. Could you please help me run your project.
void patchVS1053(void) {
int rv=0;
rv = read_VS1053_patches();
if (rv ) return;
for (int i=0;i < PATCH_CODE_SIZE;i++) {
player.write_register(atab[i], dtab[i]); <=======!!!
}
free(atab);
free(dtab);
delay(500);
Serial.printf("Applied VS1053 patches\n" );
}
\libraries\ESP_VS1053_Library-master\src/VS1053.h:103:10: error: 'void VS1053::write_register(uint8_t, uint16_t) const' is protected void write_register(uint8_t _reg, uint16_t _value) const;
patchVS1053:1560:43: error: within this context player.write_register(atab[i], dtab[i]);
/**
class VS1053 { private: uint8_t cs_pin; // Pin where CS line is connected uint8_t dcs_pin; // Pin where DCS line is connected uint8_t dreq_pin; // Pin where DREQ line is connected uint8_t curvol; // Current volume setting 0..100% const uint8_t vs1053_chunk_size = 32; // SCI Register const uint8_t SCI_MODE = 0x0; const uint8_t SCI_STATUS = 0x1; const uint8_t SCI_BASS = 0x2; const uint8_t SCI_CLOCKF = 0x3; const uint8_t SCI_AUDATA = 0x5; const uint8_t SCI_WRAM = 0x6; const uint8_t SCI_WRAMADDR = 0x7; const uint8_t SCI_AIADDR = 0xA; const uint8_t SCI_VOL = 0xB; const uint8_t SCI_AICTRL0 = 0xC; const uint8_t SCI_AICTRL1 = 0xD; const uint8_t SCI_num_registers = 0xF; // SCI_MODE bits const uint8_t SM_SDINEW = 11; // Bitnumber in SCI_MODE always on const uint8_t SM_RESET = 2; // Bitnumber in SCI_MODE soft reset const uint8_t SM_CANCEL = 3; // Bitnumber in SCI_MODE cancel song const uint8_t SM_TESTS = 5; // Bitnumber in SCI_MODE for tests const uint8_t SM_LINE1 = 14; // Bitnumber in SCI_MODE for Line input SPISettings VS1053_SPI; // SPI settings for this slave uint8_t endFillByte; // Byte to send when stopping song protected: inline void await_data_request() const { while (!digitalRead(dreq_pin)) { yield(); // Very short delay } }
inline void control_mode_on() const {
SPI.beginTransaction(VS1053_SPI); // Prevent other SPI users
digitalWrite(dcs_pin, HIGH); // Bring slave in control mode
digitalWrite(cs_pin, LOW);
}
inline void control_mode_off() const {
digitalWrite(cs_pin, HIGH); // End control mode
SPI.endTransaction(); // Allow other SPI users
}
inline void data_mode_on() const {
SPI.beginTransaction(VS1053_SPI); // Prevent other SPI users
digitalWrite(cs_pin, HIGH); // Bring slave in data mode
digitalWrite(dcs_pin, LOW);
}
inline void data_mode_off() const {
digitalWrite(dcs_pin, HIGH); // End data mode
SPI.endTransaction(); // Allow other SPI users
}
// uint16_t read_register(uint8_t _reg) const;
void sdi_send_buffer(uint8_t *data, size_t len);
void sdi_send_fillers(size_t length);
void wram_write(uint16_t address, uint16_t data);
uint16_t wram_read(uint16_t address);
public: // Constructor. Only sets pin values. Doesn't touch the chip. Be sure to call begin()! VS1053(uint8_t _cs_pin, uint8_t _dcs_pin, uint8_t _dreq_pin);
void begin(); // Begin operation. Sets pins correctly,
// and prepares SPI bus.
void startSong(); // Prepare to start playing. Call this each
// time a new song starts.
void playChunk(uint8_t *data, size_t len); // Play a chunk of data. Copies the data to
// the chip. Blocks until complete.
void stopSong(); // Finish playing a song. Call this after
// the last playChunk call.
void setVolume(uint8_t vol); // Set the player volume.Level from 0-100,
// higher is louder.
void setTone(uint8_t *rtone); // Set the player baas/treble, 4 nibbles for
// treble gain/freq and bass gain/freq
uint8_t getVolume(); // Get the currenet volume setting.
// higher is louder.
void printDetails(const char *header); // Print configuration details to serial output.
void softReset(); // Do a soft reset
bool testComm(const char *header); // Test communication with module
inline bool data_request() const {
return (digitalRead(dreq_pin) == HIGH);
}
void switchToMp3Mode();
bool isChipConnected();
void write_register(uint8_t _reg, uint16_t _value) const; //jb to apply patches
uint16_t read_register(uint8_t _reg) const;
};
Thx! A few more fixes and no more compilation errors. Thank you. I will try to buy a gesture sensor soon.
Good luck!
Op wo 13 jan. 2021 21:44 schreef Aleks-Ale notifications@github.com:
Thx! A few more fixes and no more compilation errors. Thank you. I will try to buy a gesture sensor soon.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gitpeut/OranjeRadio/issues/1#issuecomment-759728005, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGEQRY65VTZHYNNVAPTHAZDSZYA2DANCNFSM4WAZQFRA .
if you want to add a spectrum analyzer, just for fun, I will be very grateful to you.
This is a small but interesting feature.
// spectrumAnalyzerAppl1053b-2.plg
// results in XRAM 0x1810 .. 0x1877
#define BASE 0x1810
void VS1053::getBands()
{
write_register(SCI_WRAMADDR, BASE + 2);
bands = read_register(SCI_WRAM);
write_register(SCI_WRAMADDR, BASE + 4);
for (uint8_t i = 0; i < 14; i++) {
uint8_t val = read_register(SCI_WRAM);
/* current value in bits 5..0, normally 0..31
peak value in bits 11..6, normally 0..31 */
uint8_t cur1 = val & 31;
uint8_t cur = (cur1 * curvol) / 30; // big bars
if ( cur < 0 ) cur = 0;
else if ( cur > (Spectrum_hy - 4) ) cur = Spectrum_hy - 4;
spectrum[i][0] = cur;
}
}
Thank you! Have a nice day!
I'm sorry to bother you. I am trying to run a spectrum analyzer. Just one question so far. I don't know how to connect an array spectrum[14][3] to a function getBands. I don't know the syntax for connect an array. Can You help please?
githubOranjeRadio.ino
uint8_t bands = 14; // Number of bands Spectrum Analyzer
uint8_t spectrum[14][3]; // Array per Spectrum Analyzer
const uint8_t Spectrum_hy = 70;
player.getBands(bands, Spectrum_hy, spectrum[14][3] ) ; // <-----------------
VS1053.h
// inline void getBands();
inline void getBands(uint8_t bands, const uint8_t Spectrum_hy, uint8_t *spectrum [14][3]); //<-----------------
VS1053.cpp
// spectrumAnalyzerAppl1053b-2.plg
// results in XRAM 0x1810 .. 0x1877
#define BASE 0x1810
// void VS1053::getBands()
void VS1053::getBands(uint8_t bands, const uint8_t Spectrum_hy, uint8_t *spectrum [14][3]) //<-----------------
{
write_register(SCI_WRAMADDR, BASE + 2);
bands = read_register(SCI_WRAM);
write_register(SCI_WRAMADDR, BASE + 4);
for (uint8_t i = 0; i < 14; i++) {
uint8_t val = read_register(SCI_WRAM);
/* current value in bits 5..0, normally 0..31
peak value in bits 11..6, normally 0..31 */
uint8_t cur1 = val & 31;
uint8_t cur = (cur1 * curvol) / 30; // big bars
if ( cur < 0 ) cur = 0;
else if ( cur > (Spectrum_hy - 4) ) cur = Spectrum_hy - 4;
spectrum[i][0] = cur;
}
}
Attached my test program.
Hi, thank you! Where I can find it?
Test woud bebattached to the mail. I dus notntry a full implementation on the esp32.
Op za 16 jan. 2021 15:48 schreef Aleks-Ale notifications@github.com:
Attached my test program.
Hi, thank you! Where I can find it?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gitpeut/OranjeRadio/issues/1#issuecomment-761575519, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGEQRY3VVD4G7GFOJ67XB53S2GRNVANCNFSM4WAZQFRA .
Hi, can OranjeRadio run without gesture sensor and LEDs?
I have connected ESP 32-WROOM, VS1053 and a screen.
I have commented out the sensor initialization line.
// Serial.println("Gesture init");
// if ( gesture_init() ) Serial.println ( "FAILED to init gesture control");
here:https://github.com/gitpeut/GeleRadio 1.
But after comment
// initPixels();
Something wrong here?
player.startSong();
while ( uxQueueMessagesWaiting(playQueue) < (PLAYQUEUESIZE/2) ) {
Probably after they. Please die esp exception decoder to get a better idea.
I'll dig up my breadboard and try soon. I'm sure I had it working, but it's not rock solid.
Op ma 18 jan. 2021 00:04 schreef Aleks-Ale notifications@github.com:
here:https://github.com/gitpeut/GeleRadio
1.
[image: 2021-01-18_01-34-28] https://user-images.githubusercontent.com/69778440/104858018-75d18d80-592d-11eb-9895-c3a502f78e6f.png But after comment
// initPixels();
[image: 2021-01-18_01-47-38] https://user-images.githubusercontent.com/69778440/104858321-44f25800-592f-11eb-881e-407d49f263ef.png
Something wrong here?
player.startSong();
while ( uxQueueMessagesWaiting(playQueue) < (PLAYQUEUESIZE/2) ) {
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gitpeut/OranjeRadio/issues/1#issuecomment-761896652, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGEQRYZ242KDTF5NASDULDLS2NUH5ANCNFSM4WAZQFRA .
esp exception decoder
Thank you! :) I know about decoder now. :)
Hm. Have you uploaded the stations file to the SPIFFS partition? The code does not handle the case when there are 0 stations defined ( this is bug of course ). Later I will need to set up my test environment to give some more to-the-point comments.
Have you uploaded the stations file to the SPIFFS partition?
I think all files is uploaded.
Data folder content:
Uploaded:
Should this file be generated automatically?
Yes, it is created after you select a station.
Maybe create it manually for the first start?
Sure, you can try.
I tried creating an empty file and a file with content just number 1 without other characters. Does not work. Perhaps a different format for recording the station number is needed.
I have updated github with a valid last_station.txt in th data directory, try that file.
Unfortunately there is no good news.
new file uploaded. The same error persists on startup. Does the ESP32 configuration matter?
Yes, PSRAM needs to enabled, you need an ESP32 with PSRam for this (WROVER modules have PSRAM)
If you don’t have such a module,you can try changing all calls with ps_calloc and ps_malloc to just calloc and malloc, but you may run out of RAM.
changing all calls with ps_calloc and ps_malloc to just calloc and malloc
YES! You did it! :) Thank you! I will try to https stations I see in your list: "Canon" - https://peut.org/RoundMidnight.flac "Sh.flac" - https://peut.org/sh.flac Added: "RADIO NICE LOFI" https://radio-nice.ru:8285/stream
unfortunately the https stations does not work ... Does not switch to radioclient = & sclient;
I tried to use a simple IF but that doesn't work either.
if (stations[stationIdx].protocol == 0)
{
radioclient = &iclient;
}
else {
if ( stations[stationIdx].protocol == 1 )
radioclient = &sclient;
}
If the connection is not possible, the player goes into an endless cycle of connection attempts.
Hm, could be, in the original code use of TLS (the encryption protocol for https) is disabled by
#undef USETLS
Did change this to something like this:
#define USETLS 1
It hsould work but I haven't looked at it for a long time.
The https links ( like https://peut.org/sh.flac) worked with me because they also work with http.
Hi, I set up my breadboard and I got your station playing now, but quality is not always great, not sure if it's the station or the radio. As PSRAM on my test ESP32 suddenly failed(%$#$@$), I also changed all ps_alloc to normal allocs. I updated GeleRadio ( https://github.com/gitpeut/GeleRadio) with this (for me) working code.
I will have a look at the spectrum analyzer too, now that I am at it.
I updated GeleRadio
Dear Jose, thank you very much for your help. Unfortunately, yesterday I went to bed and could not see the results of your work. I'm going to run this code tonight.
in the original code use of TLS
As far as I know, TLS is a more secure protocol that requires a certificate. TLS as the top floor for the SSL. All https stations can be checked by specifying WiFiClientSecure as the default client. This does not require a certificate. All https radios work well. I've tried this on various web radio projects, including a project from Edzelf.
PSRAM on my test ESP32
Please show me a photo of your ESP32 board. Different boards may have different results and I will try to buy the same board as yours. I hope my order for the gesture sensor will be delivered in 2 weeks.
I will have a look at the spectrum analyzer too, now that I am at it.
Let me know if I can be of any help to you. For example, I can cut all the necessary pieces from the project https://github.com/blotfi/ESP32-Radio-with-Spectrum-analyzer A few days ago I already tried to implement a spectrum analyzer for another project that uses my favorite ili9341 screen. Unfortunately not successful. I only heard the first seconds of the sound and the static picture of the spectrum analyzer. The player freezes hard. And I'm guessing the screen driver TFT_eSPI problem. No freeze if I turned off the display of the 14 graphic sections of the spectrum analyzer. However, the output to the serial port showed zero values of the registers received from VS1053.
By the way, I don't understand why it is necessary to move write_register to "public" instead "private".
Do you think it makes sense to continue communicating here? if it is convenient for you, you can find my e-mail in this notification letter.
PSRAM: Unfortunately, I use my home build board, so a picture is useless. possible alternatives:
Look on Ali Express for ESP32 esp32 development board PSRAM
TLS: TLS has replaced SSL. I will try to always use the secure client
I use the write_register and read_register functions to apply the patches. I cannot use them outside the class when they are private. When public, I can always use them.
Email: better idea, but your email got lost. I'll try and send you my email address.
hello! Which VS1053 lib used?