Notifications
Clear all

Questions about the ESP32 Sound - Working with I2S

6 Posts
2 Users
0 Likes
391 Views
Barrett
(@barrett)
Member
Joined: 9 months ago
Posts: 4
Topic starter  

I am working on a project that will require using both cores of the processor of the ESP32.  Right now, I have one side of this project working on one ESP32 board.  I am working on the sound side of this project, using another ESP32 board and am making progress but ran into a stop as I can't find answers to.  I have followed the instructions in the video in the title and it is working as it should.  My current source file duplicates what is in the video. How can I make the sound file loop continuously?  With the code as it is, the sound file plays once and stops.

Once I have that working, I need to be able to start and stop the playing of the file by using a pin as a trigger.

Barrett


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7088
 

Posted by: @barrett

I am working on a project that will require using both cores of the processor of the ESP32.  Right now, I have one side of this project working on one ESP32 board.  I am working on the sound side of this project, using another ESP32 board and am making progress but ran into a stop as I can't find answers to.  I have followed the instructions in the video in the title and it is working as it should.  My current source file duplicates what is in the video. How can I make the sound file loop continuously?  With the code as it is, the sound file plays once and stops.

Once I have that working, I need to be able to start and stop the playing of the file by using a pin as a trigger.

Barrett

I had a quick look at Bill's examples and they are all looping, am I misunderstanding?

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Barrett
(@barrett)
Member
Joined: 9 months ago
Posts: 4
Topic starter  

@zander 

That's correct!  The place where I'm having the problem is in the void loop() section.  The sound file plays once.  Perhaps I could put the audio.loop() funcfion in it's own loop?  The wording of the audio.loop() function seems to me to indicate that it loops.  But, it doesn't.  I don't think I should go into the code of the library, but perhaps that's the place. ??


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7088
 

@barrett AFAIK using the construct of (below) is all you need, but of course, what that code does is dependent on the setup code. If the setup connects to a single file, it will play once, but if you connect to an internet radio, it will play as long as they are on the air.

void loop{
   audio.loop();
}

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Barrett
(@barrett)
Member
Joined: 9 months ago
Posts: 4
Topic starter  

@zander This is what I have found.  But it's not what I need it to do.  I need to play a short file repeatedly.  The setup code runs only once, so I can't control it there.  I found, by putting messages in the loop section, that the audio.loop() function plays only an extremely short part of the file until it is done, but continues to run after the sound file is complete.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7088
 

@barrett Have you tried to take the key code out of the setup and put it inside the loop?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote