Page 5 of 16

Re: SD player UI development

Posted: Sat Apr 14, 2018 6:59 pm
by randytsuch
I downloaded the amplitude zip file, and unziped/copied it to a subdirectory on my mac.

From there, went to amplitude-3.2.3/examples/multiple-songs
made a copy of index.html to play with
Added a songs subdirectory in examples (where multiple-songs and album-art and a bunch of other directories are)
Added a couple test songs in songs directory.

Change preferences in text edit to edit html files (go to preferences, then open and save, then check box to Display HTML files as HTML code

Edit index.html, towards the bottom find
"url": "../songs/Offcut6-LittlePeople.mp3",

change to:
"url": "../songs/test.mp3",

save and exit.

Double click index.html and it will open a browser window for the player.
press play for Offcut and it will play test.mp3

So very labor intensive, but I was able to modify this to play a song from my hard drive.
I think a programmer type would be able to write a little program that reads the sd music directory, and then writes an html file that would let you play the songs.

Randy

Re: SD player UI development

Posted: Sat Apr 14, 2018 8:22 pm
by jkeny
Great work Randy - taxes & audio testing in one day - I'm impressed

I haven't yet been able to get my version to display properly on a PC

Yes, the playlist is a series of HTML text giving artist, song title, location, cover art, etc - location is the only required field
These get set as the initial playlist in the (init) function

But this can be left blank & songs played via Amplitude in different ways.

What I have been envisaging all along is three main blocks:
- a separate music library manager which provides a nice interface/navigation through the library & allows us to select songs for playing/adding to a playlist. These songs (list) gets passed to:
- Amplitude & played from there. This Play function transmits the song via WiFi to the
- SD card Player for playing

Here's one way I just found to send an individual song to Amplitude for playing (no need to edit the Amplitude html)

Code: Select all

### Dynamic Mode

Dynamic mode is a new feature in AmplitudeJS. It allows you to utilize the features of AmplitudeJS without initializing any songs.
To activate dynamic mode, set dynamic_mode to true in your initialization:

```javascript
<script type="text/javascript">
	Amplitude.init({
		"dynamic_mode": true
	});
</script>
```

Now you can pass a song object using the publicPlayNow() function and Amplitude will play that song right away.  Dynamic mode is
used in places where you want to have an array of songs or a group of songs added after Amplitude is initialized.  When dynamic mode
is turned on you also have access to the Amplitude.play() and Amplitude.pause() methods allowing you to control the active song
in Amplitude.
I found it in this write-up on Amplitude http://arcalus.com.br/arcalus.com.br/am ... NTATION.md

Re: SD player UI development

Posted: Sat Apr 14, 2018 9:48 pm
by jkeny
Sorry that was old documentation for an older version of Amplitude
In the latest 3.2.3 you just issue the command - Amplitude.playNow( {song_object} );

We can also add a song with - Amplitude.addSong( {song_object} );

But I don't understand this
"Adds a song to the AmplitudeJS player. You will need to write a method yourself to add the visual side of things to fit your custom design, and then call the bindNewElements() method to make sure it works. This method returns the index of the song added to the player."
I thought we just had to have the link to cover art as part of the song_object?

Re: SD player UI development

Posted: Sat Apr 14, 2018 10:19 pm
by jkeny
Ah, if we want a similar screen design to the example then it seems like it's not enough to just pass a link to send the song_object (which includes a link to the cover art image) - we have to do other stuff which makes it difficult to bridge/send data from any other program (music library manager) to AmplitudeJS.

So, even though it seems to have callback functions for button presses which would have allowed us to interface to SDP, I think the above is a show stopper

So I'm going to look into Beets again

Re: SD player UI development

Posted: Sun Apr 15, 2018 12:49 am
by jkeny
This could be useful ESP8266 + IR blaster + code
https://github.com/mdhiggins/ESP8266-HTTP-IR-Blaster

And a pcb design/schematic to go with it https://easyeda.com/raptordemon/ESP8266 ... e32759fc23

I'm coming around to thinking this is the best approach after I looked into how to generate IR codes through a phone's 3.5mm audio socket

Maybe this is better? https://github.com/markszabo/IRremoteESP8266

Re: SD player UI development

Posted: Sun Apr 15, 2018 6:50 pm
by randytsuch
jkeny wrote: Sun Apr 15, 2018 12:49 am This could be useful ESP8266 + IR blaster + code
https://github.com/mdhiggins/ESP8266-HTTP-IR-Blaster

And a pcb design/schematic to go with it https://easyeda.com/raptordemon/ESP8266 ... e32759fc23

I'm coming around to thinking this is the best approach after I looked into how to generate IR codes through a phone's 3.5mm audio socket

Maybe this is better? https://github.com/markszabo/IRremoteESP8266
I think if you're going to use an ESP, then skip IR and use optocouplers. You would need an opto per switch, but that should be fairly easy to do.

With this software
https://www.letscontrolit.com/wiki/index.php/ESPEasy

You load the esp with ESPEasy, configure the esp via a webpage, and then send it commands via url's, and you're done.
Don't need to worry about learning and duplicating ir codes.

Randy

Re: SD player UI development

Posted: Sun Apr 15, 2018 6:55 pm
by jkeny
randytsuch wrote: Sun Apr 15, 2018 6:50 pm
jkeny wrote: Sun Apr 15, 2018 12:49 am This could be useful ESP8266 + IR blaster + code
https://github.com/mdhiggins/ESP8266-HTTP-IR-Blaster

And a pcb design/schematic to go with it https://easyeda.com/raptordemon/ESP8266 ... e32759fc23

I'm coming around to thinking this is the best approach after I looked into how to generate IR codes through a phone's 3.5mm audio socket

Maybe this is better? https://github.com/markszabo/IRremoteESP8266
I think if you're going to use an ESP, then skip IR and use optocouplers. You would need an opto per switch, but that should be fairly easy to do.

With this software
https://www.letscontrolit.com/wiki/index.php/ESPEasy

You load the esp with ESPEasy, configure the esp via a webpage, and then send it commands via url's, and you're done.
Don't need to worry about learning and duplicating ir codes.

Randy
Yea, good points - I'm fully on-board with this approach now - I'm easily swayed when it makes sense :)
Forget IR codes & IR transmitters - it seemed so simple to start with but when you dig into it, not so.

Re: SD player UI development

Posted: Sun Apr 15, 2018 7:07 pm
by randytsuch
jkeny wrote: Sun Apr 15, 2018 6:55 pm Yea, good points - I'm fully on-board with this approach now - I'm easily swayed when it makes sense :)
Forget IR codes & IR transmitters - it seemed so simple to start with but when you dig into it, not so.
lol. Yeah, I had looked into learning/duplicating ir codes in the past when I thought I might want to do it for interfacing my HA setup with my tv. In the end I found another way to do what I wanted, and kept them separate, and didn't need to mess with ir.

Its certainly doable, but does take some effort.

Randy

Re: SD player UI development

Posted: Sun Apr 15, 2018 7:31 pm
by jkeny
I liked the idea of keeping a separate & completely different channel for communicating button control events - one that didn't have any chance of affecting the WiFi connectivity with the SD card but realising this approach gets complicated the more you research it.
So we are left with whatever complexity communicating with two nodes requires - one for SD card comms & the other for button press event comms with the arduino - don't know if this will prove to be a deal breaker - can't imagine it will be but haven't thought too much about it.

BTW, here's my thinking on the functional divisions of how this might work:
- SDP only has up/down/next/back/play/pause/reset button functions so we need to limit control App to navigation through single playlist folder
- Only store music playlist folder on SD card - updates to this are transmitted from control device (PC/phone)
- Use control App to navigate through playlist & transmit navigation keys - use WiFi to ESP8266 & optocoupler or ? to action SDP key functions
- Control app should allow more intuitive navigation of music library to select files to add to playlist

So I saw this scenario as 2 possible programs:
- Music library manager which allows user to navigate library intuitively (point & click) without having to use up/down navigation keys & generates playlist from these selections (this may generate WiFi transmission of file selected to SDP playlist to keep them in synch)?
- playlist manager (which may be part of above app) & allows navigation (up/down/next/prev) through playlist & control of current file being played (pause/play). These key actions are transmitted to ESP Wifi node for actioning

Re: SD player UI development

Posted: Tue Apr 17, 2018 2:50 pm
by aidan959
He its aidan, tonys son,
Was told to check out this thread by him so I thought i would.

If by any chance could a Git repository be started for the code in this project for easier reading and updating?

I'm not sure if any of you have heard of Kodi before, but the version for the Raspberry Pi does all of this natively, and has a nice mobile web interface thats give you full control :)
https://osmc.tv/